From 65d95048a7aa62c4fc4ae78ee39b8958216f7937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Sun, 13 Dec 2009 21:46:15 +0100 Subject: [PATCH] improve browser_354894.js output --HG-- extra : rebase_source : 0091d4b16fae7732d4dd382f2cfab8c1bc404c43 --- .../test/browser/browser_354894.js | 59 ++++++++++--------- .../browser_focus_steal_from_chrome.js | 2 +- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/browser/components/sessionstore/test/browser/browser_354894.js b/browser/components/sessionstore/test/browser/browser_354894.js index c68ca8af057..aca10708136 100644 --- a/browser/components/sessionstore/test/browser/browser_354894.js +++ b/browser/components/sessionstore/test/browser/browser_354894.js @@ -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(); + }); + }); + }); + }); + }); + }); } } diff --git a/dom/tests/browser/browser_focus_steal_from_chrome.js b/dom/tests/browser/browser_focus_steal_from_chrome.js index 4f4e20e8e4b..3fca8ed71d9 100644 --- a/dom/tests/browser/browser_focus_steal_from_chrome.js +++ b/dom/tests/browser/browser_focus_steal_from_chrome.js @@ -166,4 +166,4 @@ function test() { } runNextTest(); -} \ No newline at end of file +}