improve browser_354894.js output
authorDão Gottwald <dao@mozilla.com>
Mon, 14 Dec 2009 11:18:06 +0100
changeset 35714 c961ea762a53c8c87e8d5c48372d61345480c22b
parent 35713 4b6e6432bd40562d7e54cb47360541ec2cec5313
child 35715 f5ae3ffa3363a50ea9c5a339419958c9e1450b24
push id10690
push userdgottwald@mozilla.com
push dateMon, 14 Dec 2009 10:18:38 +0000
treeherdermozilla-central@c961ea762a53 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.3a1pre
improve browser_354894.js output
browser/components/sessionstore/test/browser/browser_354894.js
--- a/browser/components/sessionstore/test/browser/browser_354894.js
+++ b/browser/components/sessionstore/test/browser/browser_354894.js
@@ -101,30 +101,32 @@
  * although there are no windows left)
  * @note There is a difference when closing a browser window with
  * BrowserTryToCloseWindow() as opposed to close(). The former will make
  * nsSessionStore restore a window next time it gets a chance and will post
  * notifications. The latter won't.
  */
 
 function browserWindowsCount(expected, msg) {
+  if (typeof expected == "number")
+    expected = [expected, expected];
   let count = 0;
   let e = Cc["@mozilla.org/appshell/window-mediator;1"]
             .getService(Ci.nsIWindowMediator)
             .getEnumerator("navigator:browser");
   while (e.hasMoreElements()) {
     if (!e.getNext().closed)
       ++count;
   }
-  is(count, expected, msg + " (nsIWindowMediator)");
+  is(count, expected[0], 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)");
+  is(JSON.parse(state).windows.length, expected[1], msg + " (getBrowserState)");
 }
 
 function test() {
   browserWindowsCount(1, "Only one browser window should be open initially");
 
   waitForExplicitFinish();
 
   // Some urls that might be opened in tabs and/or popups
@@ -522,23 +524,28 @@ function test() {
         browserWindowsCount(1, "Only one browser window should be open eventually");
         finish();
       });
     });
   }
   else {
     // Non-Mac Tests
     testOpenCloseNormal(function () {
+      browserWindowsCount([0, 1], "browser windows after testOpenCloseNormal");
       testOpenClosePrivateBrowsing(function () {
+        browserWindowsCount([0, 1], "browser windows after testOpenClosePrivateBrowsing");
         testOpenCloseWindowAndPopup(function () {
+          browserWindowsCount([0, 1], "browser windows after testOpenCloseWindowAndPopup");
           testOpenCloseOnlyPopup(function () {
+            browserWindowsCount([0, 1], "browser windows after testOpenCloseOnlyPopup");
             testOpenCloseRestoreFromPopup (function () {
+              browserWindowsCount([0, 1], "browser windows after testOpenCloseRestoreFromPopup");
               testNotificationCount(function () {
                 cleanupTestsuite();
-                browserWindowsCount(1, "Only one browser window should be open eventually");
+                browserWindowsCount(1, "browser windows after testNotificationCount");
                 finish();
               });
             });
           });
         });
       });
     });
   }