Bug 598821 - test-tabs and test-windows failures on Linux. r+a=myk 0.8rc1
authorDrew Willcoxon <adw@mozilla.com>
Thu, 23 Sep 2010 12:21:57 -0700
changeset 830 56e8179ff5b467959ddf33978558d7eb5346ee53
parent 829 7d01e428b30f99f7554807f350bcaff667626f2c
child 831 51a22a186b1c7d8e7292a5ec9670752dad223ca1
push id346
push userdwillcoxon@mozilla.com
push dateThu, 23 Sep 2010 19:23:14 +0000
bugs598821
Bug 598821 - test-tabs and test-windows failures on Linux. r+a=myk
packages/jetpack-core/tests/test-panel.js
--- a/packages/jetpack-core/tests/test-panel.js
+++ b/packages/jetpack-core/tests/test-panel.js
@@ -46,36 +46,35 @@ tests.testHideBeforeShow = function(test
       test.done();
     }
   }));
   panel.show();
   panel.hide();
 };
 
 tests.testSeveralShowHides = function(test) {
+  test.waitUntilDone();
   let hideCalled = 0;
-  test.waitUntilDone();
   let panel = panels.add(panels.Panel({
     onShow: function () {
-      test.assertEqual(3, hideCalled, 'shold call only second show');
-      test.done();
+      panel.hide();
     },
     onHide: function () {
-      hideCalled ++ ;
+      hideCalled++;
+      if (hideCalled < 3)
+        panel.show();
+      else {
+        test.pass("onHide called three times as expected");
+        test.done();
+      }
     }
   }));
   panel.on('error', function(e) {
     test.fail('error was emitted:' + e.message + '\n' + e.stack);
-  })
-  panel.show();
-  panel.hide(); // 1
-  panel.show();
-  panel.hide(); // 2
-  panel.show();
-  panel.hide(); // 3
+  });
   panel.show();
 };
 
 tests.testContentURLOption = function(test) {
   const URL_STRING = "about:buildconfig";
   const HTML_CONTENT = "<html><title>Test</title><p>This is a test.</p></html>";
 
   let (panel = Panel({ contentURL: URL_STRING })) {