зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1549261 - Improved reliability of full-screen addon install block test. r=johannh
Differential Revision: https://phabricator.services.mozilla.com/D30471 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4e6bb3e03d
Коммит
6ff10519fa
|
@ -36,15 +36,6 @@ function waitForNextAddonEvent() {
|
|||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an addon installation prompt is visible
|
||||
*/
|
||||
function addonPromptVisible(browser) {
|
||||
if (!PopupNotifications.isPanelOpen) return false;
|
||||
if (ADDON_EVENTS.some(id => PopupNotifications.getNotification(id, browser) != null)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns content task in browser to enter / leave fullscreen
|
||||
* @param browser - Browser to use for JS fullscreen requests
|
||||
|
@ -75,14 +66,19 @@ add_task(async function testFullscreenBlockAddonInstallPrompt() {
|
|||
Assert.equal(eventStr, "addon-install-blocked-silent", "Addon installation was blocked");
|
||||
|
||||
// Test if addon installation prompt has been blocked
|
||||
Assert.ok(!addonPromptVisible(), "Addon installation prompt not opened");
|
||||
let panelOpened;
|
||||
try {
|
||||
panelOpened = await TestUtils.waitForCondition(() => PopupNotifications.isPanelOpen, 100, 10);
|
||||
} catch (ex) {
|
||||
panelOpened = false;
|
||||
}
|
||||
is(panelOpened, false, "Addon installation prompt not opened");
|
||||
|
||||
await changeFullscreen(browser, false);
|
||||
window.fullScreen = false;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
// This tests if the addon install prompt is closed when entering fullscreen
|
||||
add_task(async function testFullscreenCloseAddonInstallPrompt() {
|
||||
// Open example.com
|
||||
|
@ -96,14 +92,17 @@ add_task(async function testFullscreenCloseAddonInstallPrompt() {
|
|||
Assert.ok(eventStr === "addon-install-started", "Addon installation started");
|
||||
|
||||
// Test if addon installation prompt is visible
|
||||
Assert.ok(addonPromptVisible(), "Addon installation prompt opened");
|
||||
await TestUtils.waitForCondition(() => PopupNotifications.isPanelOpen, "Waiting for addon installation prompt to open");
|
||||
Assert.ok(ADDON_EVENTS.some(id => PopupNotifications.getNotification(id, browser) != null), "Opened notification is installation prompt");
|
||||
|
||||
// Test for addon installation prompt close
|
||||
let panelClosePromise = TestUtils.waitForCondition(() => !PopupNotifications.isPanelOpen, "Waiting for addon installation prompt to close");
|
||||
|
||||
// Switch to fullscreen
|
||||
await changeFullscreen(browser, true);
|
||||
|
||||
// Test if addon installation prompt has been closed
|
||||
Assert.ok(!addonPromptVisible(), "Addon installation prompt closed for fullscreen");
|
||||
await panelClosePromise;
|
||||
|
||||
await changeFullscreen(browser, false);
|
||||
window.fullScreen = false;
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче