Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 843780 - Fix SMS mockup for desktop testing #8246

Merged
merged 1 commit into from Feb 23, 2013

Conversation

jugglinmike
Copy link
Contributor

This script was created to facilitate development on desktops using with
FireFox. It has broken since being implemented. This commit restores the
intended functionality.

sent.message.delivery = 'sent';
MessageManager.onMessageSent(sent);

if (typeof callback==="function") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: typeof callback==="function" => typeof callback === "function"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely. I've re-written the commit to address this.

@borjasalguero
Copy link
Contributor

@jugglinmike I will review this during the morning. Meanwhile could you take a look to #8262 ? I would like to know your opinion as well. Thanks! Gracias!

};
MessageManager.handleEvent.call(MessageManager, evt);
// the SMS DB is written after the callback
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this comment due to there is no DB anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@borjasalguero
Copy link
Contributor

@jugglinmike The code looks nice! I've left small comments. Meanwhile Im gonna test that everything works as expected.

}, 3000 * Math.random());

// Wait between [1000, 2000] milliseconds to simulate network latency.
}, 1000 + 1000 * Math.random());

if (simulateFail)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we get a simulateFail with a 1/2 of probability? For having all UI states with a well know pattern. Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, messages fail based on their text content--specifically, if it contains the string "fail":

    var simulateFail = /fail/i.test(text);

This was how the mock behaved prior to this patch, and I feel it is preferable to random failures because it allows developers to control the outcome of the operation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok!

@borjasalguero
Copy link
Contributor

@jugglinmike I like to see all these mockups restored! Your code works as expected. Take a look to the comments and please change the commit name adding the reviewer. In this case would be something like "Bug 843780 - Fix SMS mockup for desktop testing r=borjasalguero" . Let me know when you have the code ready and I will test it again. Thanks a lot!

@borjasalguero
Copy link
Contributor

@jugglinmike Once you have these small changes please squash your changes and change the commit as I told you before ok? The patch looks good so we could have it landed asap!

receiver: number,
delivery: 'sending',
body: text,
id: messagesHack.length,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will also be changing this to use a global message counter--using the array length introduces race conditions.

This script was created to facilitate development on desktops using with
FireFox. It has broken since being implemented. This commit restores the
intended functionality and prevents race conditions in message creation.
@jugglinmike
Copy link
Contributor Author

Okay, amended the commit. How does it look now, @borjasalguero ?

@borjasalguero
Copy link
Contributor

@jugglinmike Hi again! The code looks nice, it's ready for merging. However we have to make a small step before! Please go to the bug https://bugzilla.mozilla.org/show_bug.cgi?id=843780 and in the 'details' section of your attachment please add me as a 'reviewer'.
For making this you have to go to Details > Flags > review and select ? and in the field type :borjasalguero and you will find me. Once I receive this I will mark it as r+ and you will be able to merge it!

@jugglinmike
Copy link
Contributor Author

Alrighty--all set!

@borjasalguero
Copy link
Contributor

@jugglinmike r+! Thanks for restoring SMS mockup.

@jugglinmike
Copy link
Contributor Author

No problem. I don't have write access to the repository, so I think you'll have to merge it on my behalf.

@borjasalguero
Copy link
Contributor

@jugglinmike No prob. Merging...!

borjasalguero pushed a commit that referenced this pull request Feb 23, 2013
Bug 843780 - Fix SMS mockup for desktop testing
@borjasalguero borjasalguero merged commit 48e5aa9 into mozilla-b2g:master Feb 23, 2013
@jugglinmike
Copy link
Contributor Author

Ah, great--thanks!

borjasalguero pushed a commit that referenced this pull request Feb 26, 2013
Bug 843780 - Fix SMS mockup for desktop testing(cherry picked from commit 48e5aa9)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants