Bug 576151 - Better message for leftover tabs and windows on timed out browser-chrome tests. r=gavin

This commit is contained in:
Marco Bonardo 2010-07-15 22:38:03 +02:00
parent 7dc17cbb3f
commit db29d29142

View File

@ -71,11 +71,16 @@ Tester.prototype = {
},
waitForWindowsState: function Tester_waitForWindowsState(aCallback) {
let timedOut = this.currentTest && this.currentTest.timedOut;
let baseMsg = timedOut ? "Found a {elt} after previous test timed out"
: this.currentTest ? "Found an unexpected {elt} at the end of test run"
: "Found an unexpected {elt}";
if (this.currentTest && window.gBrowser && gBrowser.tabs.length > 1) {
while (gBrowser.tabs.length > 1) {
let lastTab = gBrowser.tabContainer.lastChild;
let msg = "Found an unexpected tab at the end of test run: " +
lastTab.linkedBrowser.currentURI.spec;
let msg = baseMsg.replace("{elt}", "tab") +
": " + lastTab.linkedBrowser.currentURI.spec;
this.currentTest.addResult(new testResult(false, msg, "", false));
gBrowser.removeTab(lastTab);
}
@ -86,11 +91,9 @@ Tester.prototype = {
while (windowsEnum.hasMoreElements()) {
let win = windowsEnum.getNext();
if (win != window && !win.closed) {
let msg = "Found an unexpected browser window";
if (this.currentTest) {
msg += " at the end of test run";
let msg = baseMsg.replace("{elt}", "browser window");
if (this.currentTest)
this.currentTest.addResult(new testResult(false, msg, "", false));
}
else
this.dumper.dump("TEST-UNEXPECTED-FAIL | (browser-test.js) | " + msg + "\n");
@ -222,6 +225,7 @@ Tester.prototype = {
return;
}
self.currentTest.addResult(new testResult(false, "Timed out", "", false));
self.currentTest.timedOut = true;
self.currentTest.scope.__waitTimer = null;
self.nextTest();
}, TIMEOUT_SECONDS * 1000);