Bug 1586393, part 1 - Add test-complete observer notification. r=mconley

This allows generic code, like a testing JSM, to do clean up when a
test completes, in a way that will work in different test suites.

Differential Revision: https://phabricator.services.mozilla.com/D50648

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew McCreight 2019-10-29 21:25:02 +00:00
parent b114ae02a3
commit 9cdc76e45f
3 changed files with 6 additions and 0 deletions

View File

@ -589,6 +589,8 @@ Tester.prototype = {
}
}
Services.obs.notifyObservers(null, "test-complete");
if (
this.currentTest.passCount === 0 &&
this.currentTest.failCount === 0 &&

View File

@ -1249,6 +1249,8 @@ SimpleTest.finish = function() {
};
executeCleanupFunction();
SpecialPowers.notifyObservers(null, "test-complete");
};
/**

View File

@ -647,6 +647,8 @@ function _execute_test() {
.then(() => (complete = true));
_Services.tm.spinEventLoopUntil(() => complete);
_Services.obs.notifyObservers(null, "test-complete");
// Restore idle service to avoid leaks.
_fakeIdleService.deactivate();