Closed Bug 1142108 Opened 5 years ago Closed 5 years ago

Make TestUtils.topicObserved cover more use cases

Categories

(Testing :: General, defect)

defect
Not set
Points:
1

Tracking

(firefox39 fixed)

RESOLVED FIXED
mozilla39
Iteration:
39.2 - 23 Mar
Tracking Status
firefox39 --- fixed

People

(Reporter: Paolo, Assigned: Paolo)

References

Details

Attachments

(1 file)

Attached patch The patchSplinter Review
Sometimes the subject of an observer notification is the interesting result when a topic is observed, while sometimes the data string is. The TestUtils.topicObserved API can be made more flexible by using a callback to determine if the notification is relevant, and resolving with the subject and data.

For example, for checking that a login is added to the database:


let promiseLogin = TestUtils.topicObserved("passwordmgr-storage-changed",
                                           (_, data) => data == "addLogin");
let [login] = yield promiseLogin;


In this patch I've also fixed an unterminated promise chain.
Attachment #8576058 - Flags: review?(smacleod)
Iteration: --- → 39.2 - 23 Mar
Points: --- → 1
Flags: firefox-backlog+
Blocks: 1142110
Comment on attachment 8576058 [details] [diff] [review]
The patch

Review of attachment 8576058 [details] [diff] [review]:
-----------------------------------------------------------------

oo, I like this change a lot :D
Attachment #8576058 - Flags: review?(smacleod) → review+
Thanks for the quick review! Will land when the tree reopens.
Assignee: nobody → paolo.mozmail
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/d1ffaeb0dbfd
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in before you can comment on or make changes to this bug.