зеркало из https://github.com/mozilla/pjs.git
Bug 668728 - Teach the mochitest harness to verify that the test calling finish is the same one that we expect it to be, to avoid drastic failures such as test_reftests_with_caret.html inadvertently navigating back, and skipping half of its tests; r=ted
This commit is contained in:
Родитель
b6a0be7e32
Коммит
2766eeb70f
|
@ -194,6 +194,20 @@ TestRunner._makeIframe = function (url, retry) {
|
|||
return iframe;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the current test URL.
|
||||
* We use this to tell whether the test has navigated to another test without
|
||||
* being finished first.
|
||||
*/
|
||||
TestRunner.getLoadedTestURL = function () {
|
||||
var prefix = "";
|
||||
// handle mochitest-chrome URIs
|
||||
if ($('testframe').contentWindow.location.protocol == "chrome:") {
|
||||
prefix = "chrome://mochitests";
|
||||
}
|
||||
return prefix + $('testframe').contentWindow.location.pathname;
|
||||
};
|
||||
|
||||
/**
|
||||
* TestRunner entry point.
|
||||
*
|
||||
|
@ -367,9 +381,17 @@ TestRunner.testFinished = function(tests) {
|
|||
}
|
||||
|
||||
function runNextTest() {
|
||||
if (TestRunner.currentTestURL != TestRunner.getLoadedTestURL()) {
|
||||
TestRunner.log("TEST-UNEXPECTED-FAIL | " +
|
||||
TestRunner.currentTestURL +
|
||||
" | finished in a non-clean fashion (in " +
|
||||
TestRunner.getLoadedTestURL() + ")");
|
||||
tests.push({ result: false });
|
||||
}
|
||||
|
||||
var runtime = new Date().valueOf() - TestRunner._currentTestStartTime;
|
||||
TestRunner.log("TEST-END | " +
|
||||
TestRunner._urls[TestRunner._currentTest] +
|
||||
TestRunner.currentTestURL +
|
||||
" | finished in " + runtime + "ms");
|
||||
|
||||
TestRunner.updateUI(tests);
|
||||
|
|
Загрузка…
Ссылка в новой задаче