fune/browser/base/content/test/alerts/browser_notification_open_settings.js
Matthew Noorenberghe d1625cdffe Bug 1208295 - Open content preferences after receiving notifications-open-settings. r=jaws
--HG--
rename : browser/base/content/test/general/browser_notification_tab_switching.js => browser/base/content/test/alerts/browser_notification_tab_switching.js
rename : browser/base/content/test/general/file_dom_notifications.html => browser/base/content/test/alerts/file_dom_notifications.html
extra : commitid : L8SBHW3urul
extra : rebase_source : 2b308872a836a6df9634e991409c008f3e72040c
2015-09-25 13:18:29 -07:00

18 lines
780 B
JavaScript

"use strict";
add_task(function* test_settingsOpen() {
info("Opening a dummy tab so openPreferences=>switchToTabHavingURI doesn't use the blank tab.");
yield BrowserTestUtils.withNewTab({
gBrowser,
url: "about:robots"
}, function* dummyTabTask(aBrowser) {
let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "about:preferences#content");
info("simulate a notifications-open-settings notification");
let uri = NetUtil.newURI("https://example.com");
let principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
Services.obs.notifyObservers(principal, "notifications-open-settings", null);
let tab = yield tabPromise;
ok(tab, "The notification settings tab opened");
BrowserTestUtils.removeTab(tab);
});
});