Bug 1383709 - Don't wait for the sync-pane-loaded notification in old prefs since it won't be fired when only viewing the Content pane. r=mconley

Waiting for this notification is only necessary in the 'new prefs', as detailed by the comment that I added in this patch.

MozReview-Commit-ID: LpFwHrqNc0g

--HG--
extra : rebase_source : d8882492575e088a53cf644e00e4965e9223c7b5
This commit is contained in:
Jared Wein 2017-07-24 18:40:46 -04:00
Родитель 35296b8931
Коммит 86387ff54d
1 изменённых файлов: 16 добавлений и 6 удалений

Просмотреть файл

@ -1,8 +1,10 @@
"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";
var useOldPrefs = Services.prefs.getBoolPref("browser.preferences.useOldOrganization");
var expectedURL = useOldPrefs ? "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.");
@ -10,8 +12,12 @@ add_task(async function test_settingsOpen_observer() {
gBrowser,
url: "about:robots"
}, async function dummyTabTask(aBrowser) {
// Ensure preferences is loaded before removing the tab.
let syncPaneLoadedPromise = TestUtils.topicObserved("sync-pane-loaded", () => true);
// Ensure preferences is loaded before removing the tab. In the "new prefs", all categories
// get initialized on page load since we need to be able to search them. Sync is *very*
// slow to load and therefore we need to wait for it to load when testing the "new prefs".
// For "old prefs" we only load the actual visited categories so we don't have this problem,
// as well, the "sync-pane-loaded" notification is not sent on "old prefs".
let syncPaneLoadedPromise = useOldPrefs || TestUtils.topicObserved("sync-pane-loaded", () => true);
let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, expectedURL);
info("simulate a notifications-open-settings notification");
@ -35,8 +41,12 @@ add_task(async function test_settingsOpen_button() {
gBrowser,
url: notificationURL
}, async function tabTask(aBrowser) {
// Ensure preferences is loaded before removing the tab.
let syncPaneLoadedPromise = TestUtils.topicObserved("sync-pane-loaded", () => true);
// Ensure preferences is loaded before removing the tab. In the "new prefs", all categories
// get initialized on page load since we need to be able to search them. Sync is *very*
// slow to load and therefore we need to wait for it to load when testing the "new prefs".
// For "old prefs" we only load the actual visited categories so we don't have this problem,
// as well, the "sync-pane-loaded" notification is not sent on "old prefs".
let syncPaneLoadedPromise = useOldPrefs || TestUtils.topicObserved("sync-pane-loaded", () => true);
info("Waiting for notification");
await openNotification(aBrowser, "showNotification2");