зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1244991: re-enable browser_backgroundTab.js UITour test and to make sure it doesn't fail on slower hardware, wait for the visibilitychange event explicitly since it may occur later than the tab open and switch. r=MattN
This commit is contained in:
Родитель
9b1d466451
Коммит
2f92671a5a
|
@ -6,7 +6,6 @@ support-files =
|
|||
../UITour-lib.js
|
||||
|
||||
[browser_backgroundTab.js]
|
||||
skip-if = e10s # Intermittent failures, bug 1244991
|
||||
[browser_closeTab.js]
|
||||
[browser_fxa.js]
|
||||
skip-if = debug || asan # updateAppMenuItem leaks
|
||||
|
|
|
@ -7,7 +7,6 @@ var gContentWindow;
|
|||
requestLongerTimeout(2);
|
||||
add_task(setup_UITourTest);
|
||||
|
||||
|
||||
add_UITour_task(function* test_bg_getConfiguration() {
|
||||
info("getConfiguration is on the allowed list so should work");
|
||||
yield* loadForegroundTab();
|
||||
|
@ -20,7 +19,7 @@ add_UITour_task(function* test_bg_showInfo() {
|
|||
info("showInfo isn't on the allowed action list so should be denied");
|
||||
yield* loadForegroundTab();
|
||||
|
||||
yield showInfoPromise("appMenu", "Hello from the backgrund", "Surprise!").then(
|
||||
yield showInfoPromise("appMenu", "Hello from the background", "Surprise!").then(
|
||||
() => ok(false, "panel shouldn't have shown from a background tab"),
|
||||
() => ok(true, "panel wasn't shown from a background tab"));
|
||||
|
||||
|
@ -29,6 +28,19 @@ add_UITour_task(function* test_bg_showInfo() {
|
|||
|
||||
|
||||
function* loadForegroundTab() {
|
||||
// Spawn a content task that resolves once we're sure the visibilityState was
|
||||
// changed. This state is what the tests in this file rely on.
|
||||
let promise = ContentTask.spawn(gBrowser.selectedTab.linkedBrowser, null, function* () {
|
||||
return new Promise(resolve => {
|
||||
let document = content.document;
|
||||
document.addEventListener("visibilitychange", function onStateChange() {
|
||||
Assert.equal(document.visibilityState, "hidden", "UITour page should be hidden now.");
|
||||
document.removeEventListener("visibilitychange", onStateChange);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
yield BrowserTestUtils.openNewForegroundTab(gBrowser);
|
||||
yield promise;
|
||||
isnot(gBrowser.selectedTab, gTestTab, "Make sure tour tab isn't selected");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче