mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 1259651 - Add the ability to register callback functions to be notified when a mochitest times out to SimpleTest. r=ted.
MozReview-Commit-ID: 2p7qqFMxHpW
This commit is contained in:
parent
61b8bad2ea
commit
3191a9a1a8
@ -217,6 +217,7 @@ if (typeof(computedStyle) == 'undefined') {
|
||||
SimpleTest._tests = [];
|
||||
SimpleTest._stopOnLoad = true;
|
||||
SimpleTest._cleanupFunctions = [];
|
||||
SimpleTest._timeoutFunctions = [];
|
||||
SimpleTest.expected = 'pass';
|
||||
SimpleTest.num_failed = 0;
|
||||
SimpleTest._inChaosMode = false;
|
||||
@ -988,6 +989,10 @@ SimpleTest.registerCleanupFunction = function(aFunc) {
|
||||
SimpleTest._cleanupFunctions.push(aFunc);
|
||||
};
|
||||
|
||||
SimpleTest.registerTimeoutFunction = function(aFunc) {
|
||||
SimpleTest._timeoutFunctions.push(aFunc);
|
||||
};
|
||||
|
||||
SimpleTest.testInChaosMode = function() {
|
||||
if (SimpleTest._inChaosMode) {
|
||||
// It's already enabled for this test, don't enter twice
|
||||
@ -997,6 +1002,13 @@ SimpleTest.testInChaosMode = function() {
|
||||
SimpleTest._inChaosMode = true;
|
||||
};
|
||||
|
||||
SimpleTest.timeout = function() {
|
||||
for (let func of SimpleTest._timeoutFunctions) {
|
||||
func();
|
||||
}
|
||||
SimpleTest._timeoutFunctions = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes the tests. This is automatically called, except when
|
||||
* SimpleTest.waitForExplicitFinish() has been invoked.
|
||||
@ -1021,6 +1033,8 @@ SimpleTest.finish = function() {
|
||||
SimpleTest._tests.push(test);
|
||||
}
|
||||
|
||||
SimpleTest._timeoutFunctions = [];
|
||||
|
||||
SimpleTest.testsLength = SimpleTest._tests.length;
|
||||
|
||||
SimpleTest._alreadyFinished = true;
|
||||
|
@ -119,6 +119,7 @@ TestRunner._checkForHangs = function() {
|
||||
|
||||
function killTest(win) {
|
||||
if ("SimpleTest" in win) {
|
||||
win.SimpleTest.timeout();
|
||||
win.SimpleTest.finish();
|
||||
} else if ("W3CTest" in win) {
|
||||
win.W3CTest.timeout();
|
||||
|
Loading…
Reference in New Issue
Block a user