Bug 1381944 - Adjust browser_notification_open_settings.js to work with both old and new forms of about:preferences. r?jaws draft
authorMike Conley <mconley@mozilla.com>
Tue, 18 Jul 2017 12:02:05 -0700
changeset 610823 845237266eea7cd7801ceed2f7f35a8409dc8ccc
parent 610822 a90f8e94849d6a2fa4f7ccf97c3168c9d4855ea9
child 637956 5042851180345d0f50bc8cd2aec4c01191b461c5
push id69001
push userbmo:mconley@mozilla.com
push dateTue, 18 Jul 2017 19:06:19 +0000
reviewersjaws
bugs1381944
milestone55.0
Bug 1381944 - Adjust browser_notification_open_settings.js to work with both old and new forms of about:preferences. r?jaws MozReview-Commit-ID: 9JIcNFnz0hv
browser/base/content/test/alerts/browser_notification_open_settings.js
--- a/browser/base/content/test/alerts/browser_notification_open_settings.js
+++ b/browser/base/content/test/alerts/browser_notification_open_settings.js
@@ -1,19 +1,21 @@
 "use strict";
 
 var notificationURL = "http://example.org/browser/browser/base/content/test/alerts/file_dom_notifications.html";
+var expectedURL = Services.prefs.getBoolPref("browser.preferences.useOldOrganization") ? "about:preferences#content"
+                                                                                       : "about:preferences#privacy";
 
 add_task(async function test_settingsOpen_observer() {
   info("Opening a dummy tab so openPreferences=>switchToTabHavingURI doesn't use the blank tab.");
   await BrowserTestUtils.withNewTab({
     gBrowser,
     url: "about:robots"
   }, async function dummyTabTask(aBrowser) {
-    let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "about:preferences#privacy");
+    let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, expectedURL);
     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");
     let tab = await tabPromise;
     ok(tab, "The notification settings tab opened");
     await BrowserTestUtils.removeTab(tab);
   });
@@ -35,17 +37,17 @@ add_task(async function test_settingsOpe
       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, "about:preferences#privacy");
+      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");
 
       await closePromise;