Bug 654423 - Intermittent TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/browser/base/content/test/tabview/browser_tabview_bug630102.js | application timed out; r=ehsan

This commit is contained in:
Tim Taubert 2011-05-04 00:36:05 +02:00
Родитель cffd866d59
Коммит 40985caabc
1 изменённых файлов: 30 добавлений и 42 удалений

Просмотреть файл

@ -2,63 +2,51 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
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 win, contentWindow, originalTab, newTab1, newTab2;
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();
hideTabView(partTwo, win);
};
let partTwo = function() {
window.removeEventListener("tabviewhidden", partTwo, false);
gBrowser.unpinTab(newTab1);
window.addEventListener("tabviewshown", partThree, false);
TabView.toggle();
let partTwo = function () {
win.gBrowser.unpinTab(newTab1);
showTabView(partThree, win);
};
let partThree = function() {
window.removeEventListener("tabviewshown", partThree, false);
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);
}