зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1398491 - Use SpecialPowers.pushPermissions instead of Services.perms.add in browser_notification_open_settings.js. r=MattN
MozReview-Commit-ID: NzlSA8Kt2t --HG-- extra : rebase_source : 81539819ba3e41020a6d75a1b306fdd9364ea526
This commit is contained in:
Родитель
979b5671a6
Коммит
92b40bd5fa
|
@ -24,43 +24,43 @@ add_task(async function test_settingsOpen_observer() {
|
|||
});
|
||||
|
||||
add_task(async function test_settingsOpen_button() {
|
||||
let pm = Services.perms;
|
||||
info("Adding notification permission");
|
||||
pm.add(makeURI(notificationURL), "desktop-notification", pm.ALLOW_ACTION);
|
||||
await new Promise(resolve => {
|
||||
SpecialPowers.pushPermissions([{
|
||||
type: "desktop-notification",
|
||||
allow: true,
|
||||
context: notificationURL,
|
||||
}], resolve);
|
||||
});
|
||||
|
||||
try {
|
||||
await BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: notificationURL
|
||||
}, async function tabTask(aBrowser) {
|
||||
// Ensure preferences is loaded before removing the tab.
|
||||
let syncPaneLoadedPromise = TestUtils.topicObserved("sync-pane-loaded", () => true);
|
||||
await BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: notificationURL
|
||||
}, async function tabTask(aBrowser) {
|
||||
// Ensure preferences is loaded before removing the tab.
|
||||
let syncPaneLoadedPromise = TestUtils.topicObserved("sync-pane-loaded", () => true);
|
||||
|
||||
info("Waiting for notification");
|
||||
await openNotification(aBrowser, "showNotification2");
|
||||
info("Waiting for notification");
|
||||
await openNotification(aBrowser, "showNotification2");
|
||||
|
||||
let alertWindow = Services.wm.getMostRecentWindow("alert:alert");
|
||||
if (!alertWindow) {
|
||||
ok(true, "Notifications don't use XUL windows on all platforms.");
|
||||
await closeNotification(aBrowser);
|
||||
return;
|
||||
}
|
||||
let alertWindow = Services.wm.getMostRecentWindow("alert:alert");
|
||||
if (!alertWindow) {
|
||||
ok(true, "Notifications don't use XUL windows on all platforms.");
|
||||
await closeNotification(aBrowser);
|
||||
return;
|
||||
}
|
||||
|
||||
let closePromise = promiseWindowClosed(alertWindow);
|
||||
let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, expectedURL);
|
||||
let openSettingsMenuItem = alertWindow.document.getElementById("openSettingsMenuItem");
|
||||
openSettingsMenuItem.click();
|
||||
let closePromise = promiseWindowClosed(alertWindow);
|
||||
let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, expectedURL);
|
||||
let openSettingsMenuItem = alertWindow.document.getElementById("openSettingsMenuItem");
|
||||
openSettingsMenuItem.click();
|
||||
|
||||
info("Waiting for notification settings tab");
|
||||
let tab = await tabPromise;
|
||||
ok(tab, "The notification settings tab opened");
|
||||
info("Waiting for notification settings tab");
|
||||
let tab = await tabPromise;
|
||||
ok(tab, "The notification settings tab opened");
|
||||
|
||||
await syncPaneLoadedPromise;
|
||||
await closePromise;
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
} finally {
|
||||
info("Removing notification permission");
|
||||
pm.remove(makeURI(notificationURL), "desktop-notification");
|
||||
}
|
||||
await syncPaneLoadedPromise;
|
||||
await closePromise;
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче