Bug 735879 - Add more delay to some browser chrome tests that often timeout. r=fryn

This commit is contained in:
Marco Bonardo 2012-03-14 16:11:20 -07:00
Родитель ad5dbd581e
Коммит babb5628f1
7 изменённых файлов: 46 добавлений и 20 удалений

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

@ -109,7 +109,8 @@ let gTests = [
ok(snippetsElt, "Found snippets element");
is(snippetsElt.getElementsByTagName("span").length, 1,
"A default snippet is visible.");
let storage = getStorage();
storage.removeItem("snippets");
executeSoon(runNextTest);
}
},

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

@ -2,6 +2,8 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
let assertNumberOfTabs = function (num, msg) {
is(gBrowser.tabs.length, num, msg);
}
@ -25,11 +27,13 @@ function test() {
assertNumberOfPinnedTabs(2, "both tabs are now pinned");
// run the test
ss.setBrowserState(JSON.stringify({ windows: [{ tabs: [{ url: "about:blank" }] }] }));
assertNumberOfTabs(1, "one tab left after setBrowserState()");
assertNumberOfPinnedTabs(0, "there are no pinned tabs");
is(gBrowser.tabs[0].linkedBrowser, linkedBrowser, "first tab's browser got re-used");
waitForExplicitFinish();
waitForSaveState(finish);
waitForBrowserState(
{ windows: [{ tabs: [{ url: "about:blank" }] }] },
function () {
assertNumberOfTabs(1, "one tab left after setBrowserState()");
assertNumberOfPinnedTabs(0, "there are no pinned tabs");
is(gBrowser.tabs[0].linkedBrowser, linkedBrowser, "first tab's browser got re-used");
finish();
}
);
}

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

@ -14,10 +14,14 @@ function test() {
// window is now in _closedWindows.
waitForExplicitFinish();
requestLongerTimeout(2);
// We speed up the interval between session saves to ensure that the test
// runs quickly.
Services.prefs.setIntPref("browser.sessionstore.interval", 2000);
Services.prefs.setIntPref("browser.sessionstore.interval", 4000);
registerCleanupFunction(function () {
Services.prefs.clearUserPref("browser.sessionstore.interval");
});
// We'll clear all closed windows to make sure our state is clean
// forgetClosedWindow doesn't trigger a delayed save
@ -97,7 +101,6 @@ function openTab() {
}
function done() {
Services.prefs.clearUserPref("browser.sessionstore.interval");
gBrowser.removeTab(newTab);
// The API still represents the closed window as closed, so we can clear it
// with the API, but just to make sure...

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

@ -7,9 +7,14 @@ let tabState = {
function test() {
waitForExplicitFinish();
requestLongerTimeout(2);
Services.prefs.setIntPref("browser.sessionstore.interval", 4000);
registerCleanupFunction(function () {
Services.prefs.clearUserPref("browser.sessionstore.interval");
});
let tab = gBrowser.addTab("about:blank");
registerCleanupFunction(function () gBrowser.removeTab(tab));
let browser = tab.linkedBrowser;
@ -26,7 +31,9 @@ function test() {
is(entries.length, 1, "tab has one history entry");
ok(!entries[0].children, "history entry has no subframes");
finish();
// Make sure that we reset the state.
let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank" }] }]}]};
waitForBrowserState(blankState, finish);
});
// reload the browser to deprecate the subframes
@ -36,8 +43,8 @@ function test() {
// create a dynamic subframe
let doc = browser.contentDocument;
let iframe = doc.createElement("iframe");
iframe.setAttribute("src", "about:mozilla");
doc.body.appendChild(iframe);
iframe.setAttribute("src", "about:mozilla");
});
});
}
@ -53,5 +60,5 @@ function whenChildCount(aEntry, aChildCount, aCallback) {
if (aEntry.childCount == aChildCount)
aCallback();
else
executeSoon(function () whenChildCount(aEntry, aChildCount, aCallback));
setTimeout(function () whenChildCount(aEntry, aChildCount, aCallback), 100);
}

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

@ -7,9 +7,14 @@ let tabState = {
function test() {
waitForExplicitFinish();
requestLongerTimeout(2);
Services.prefs.setIntPref("browser.sessionstore.interval", 4000);
registerCleanupFunction(function () {
Services.prefs.clearUserPref("browser.sessionstore.interval");
});
let tab = gBrowser.addTab("about:blank");
registerCleanupFunction(function () gBrowser.removeTab(tab));
let browser = tab.linkedBrowser;
@ -25,7 +30,11 @@ function test() {
let sessionHistory = browser.sessionHistory;
let entry = sessionHistory.getEntryAtIndex(0, false);
whenChildCount(entry, 0, finish);
whenChildCount(entry, 0, function () {
// Make sure that we reset the state.
let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank" }] }]}]};
waitForBrowserState(blankState, finish);
});
});
// reload the browser to deprecate the subframes
@ -35,8 +44,8 @@ function test() {
// create a dynamic subframe
let doc = browser.contentDocument;
let iframe = doc.createElement("iframe");
iframe.setAttribute("src", "about:mozilla");
doc.body.appendChild(iframe);
iframe.setAttribute("src", "about:mozilla");
});
});
}
@ -52,5 +61,5 @@ function whenChildCount(aEntry, aChildCount, aCallback) {
if (aEntry.childCount == aChildCount)
aCallback();
else
executeSoon(function () whenChildCount(aEntry, aChildCount, aCallback));
setTimeout(function () whenChildCount(aEntry, aChildCount, aCallback), 100);
}

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

@ -3,6 +3,7 @@
function test() {
waitForExplicitFinish();
requestLongerTimeout(2);
newWindowWithTabView(onTabViewWindowLoaded);
}
@ -105,8 +106,8 @@ function onTabViewWindowLoaded(win) {
// Close the window and we're done!
win.close();
finish();
}, 6000, false);
},1000);
}, 10000, false);
}, 2000);
});

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

@ -172,6 +172,7 @@ function test() {
}
waitForExplicitFinish();
requestLongerTimeout(2);
next();
}