improve browser_354894.js output

--HG--
extra : rebase_source : 0091d4b16fae7732d4dd382f2cfab8c1bc404c43
This commit is contained in:
Dão Gottwald 2009-12-13 21:46:15 +01:00
parent 833ad9da43
commit 65d95048a7
2 changed files with 31 additions and 30 deletions

View File

@ -105,7 +105,7 @@
* notifications. The latter won't.
*/
function browserWindowsCount() {
function browserWindowsCount(expected, msg) {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
@ -114,11 +114,16 @@ function browserWindowsCount() {
if (!e.getNext().closed)
++count;
}
return count;
is(count, expected, msg + " (nsIWindowMediator)");
let state = Cc["@mozilla.org/browser/sessionstore;1"]
.getService(Ci.nsISessionStore)
.getBrowserState();
info(state);
is(JSON.parse(state).windows.length, expected, msg + " (getBrowserState)");
}
function test() {
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
browserWindowsCount(1, "Only one browser window should be open initially");
waitForExplicitFinish();
@ -511,34 +516,30 @@ function test() {
setupTestsuite();
if (navigator.platform.match(/Mac/)) {
// Mac tests
testMacNotifications(
function() testNotificationCount(
function() {
cleanupTestsuite();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}
)
);
testMacNotifications(function () {
testNotificationCount(function () {
cleanupTestsuite();
browserWindowsCount(1, "Only one browser window should be open eventually");
finish();
});
});
}
else {
// Non-Mac Tests
testOpenCloseNormal(
function() testOpenClosePrivateBrowsing(
function() testOpenCloseWindowAndPopup(
function() testOpenCloseOnlyPopup(
function() testOpenCloseRestoreFromPopup (
function() testNotificationCount(
function() {
cleanupTestsuite();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}
)
)
)
)
)
);
testOpenCloseNormal(function () {
testOpenClosePrivateBrowsing(function () {
testOpenCloseWindowAndPopup(function () {
testOpenCloseOnlyPopup(function () {
testOpenCloseRestoreFromPopup (function () {
testNotificationCount(function () {
cleanupTestsuite();
browserWindowsCount(1, "Only one browser window should be open eventually");
finish();
});
});
});
});
});
});
}
}

View File

@ -166,4 +166,4 @@ function test() {
}
runNextTest();
}
}