Bug 654423 - Intermittent TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/browser/base/content/test/tabview/browser_tabview_bug630102.js | application timed out; r=ehsan
authorTim Taubert <tim.taubert@gmx.de>
Fri, 10 Jun 2011 11:40:25 +0200
changeset 70869 0c47cb07f689
parent 70868 cb2a5954a5b4
child 70870 3a5d39bd32a6
push id20435
push usereakhgari@mozilla.com
push date2011-06-10 20:08 +0000
treeherdermozilla-central@28217403cd02 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs654423, 630102
milestone7.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 654423 - Intermittent TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/browser/base/content/test/tabview/browser_tabview_bug630102.js | application timed out; r=ehsan
browser/base/content/test/tabview/browser_tabview_bug630102.js
--- a/browser/base/content/test/tabview/browser_tabview_bug630102.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug630102.js
@@ -1,64 +1,52 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function test() {
-  waitForExplicitFinish();
+  let win, contentWindow, originalTab, newTab1, newTab2;
 
-  let originalTab = gBrowser.visibleTabs[0];
-  let newTab1 = gBrowser.addTab("about:blank", { skipAnimation: true });
-  let newTab2 = gBrowser.addTab("about:blank", { skipAnimation: true });
-  
-  gBrowser.pinTab(newTab1);
-  
-  let contentWindow;
-
-  let partOne = function() {
-    window.removeEventListener("tabviewshown", partOne, false);
-
-    contentWindow = document.getElementById("tab-view").contentWindow;
-    is(contentWindow.GroupItems.groupItems.length, 1, "There is only one group item");
-
+  let partOne = function () {
     let groupItem = contentWindow.GroupItems.groupItems[0];
     let tabItems = groupItem.getChildren();
     is(tabItems.length, 2, "There are two tab items in that group item");
     is(tabItems[0].tab, originalTab, "The first tab item is linked to the first tab");
     is(tabItems[1].tab, newTab2, "The second tab item is linked to the second tab");
 
-    window.addEventListener("tabviewhidden", partTwo, false);
-    TabView.toggle();
-  };
-
-  let partTwo = function() {
-    window.removeEventListener("tabviewhidden", partTwo, false);
-
-    gBrowser.unpinTab(newTab1);
-
-    window.addEventListener("tabviewshown", partThree, false);
-    TabView.toggle();
+    hideTabView(partTwo, win);
   };
 
-  let partThree = function() {
-    window.removeEventListener("tabviewshown", partThree, false);
+  let partTwo = function () {
+    win.gBrowser.unpinTab(newTab1);
+    showTabView(partThree, win);
+  };
 
+  let partThree = function () {
     let tabItems = contentWindow.GroupItems.groupItems[0].getChildren();
     is(tabItems.length, 3, "There are three tab items in that group item");
-    is(tabItems[0].tab, gBrowser.visibleTabs[0], "The first tab item is linked to the first tab");
-    is(tabItems[1].tab, gBrowser.visibleTabs[1], "The second tab item is linked to the second tab");
-    is(tabItems[2].tab, gBrowser.visibleTabs[2], "The third tab item is linked to the third tab");
-
-    window.addEventListener("tabviewhidden", endGame, false);
-    TabView.toggle();
-  };
-
-  let endGame = function() {
-    window.removeEventListener("tabviewhidden", endGame, false);
-
-    gBrowser.removeTab(newTab1);
-    gBrowser.removeTab(newTab2);
+    is(tabItems[0].tab, win.gBrowser.tabs[0], "The first tab item is linked to the first tab");
+    is(tabItems[1].tab, win.gBrowser.tabs[1], "The second tab item is linked to the second tab");
+    is(tabItems[2].tab, win.gBrowser.tabs[2], "The third tab item is linked to the third tab");
 
     finish();
   };
 
-  window.addEventListener("tabviewshown", partOne, false);
-  TabView.toggle();
+  let onLoad = function (tvwin) {
+    win = tvwin;
+    registerCleanupFunction(function () win.close());
+
+    for (let i = 0; i < 2; i++)
+      win.gBrowser.loadOneTab("about:blank", {inBackground: true});
+
+    [originalTab, newTab1, newTab2] = win.gBrowser.tabs;
+    win.gBrowser.pinTab(newTab1);
+  };
+
+  let onShow = function () {
+    contentWindow = win.TabView.getContentWindow();
+    is(contentWindow.GroupItems.groupItems.length, 1, "There is only one group item");
+
+    partOne();
+  };
+
+  waitForExplicitFinish();
+  newWindowWithTabView(onShow, onLoad);
 }