forked from mirrors/gecko-dev
Bug 1839845 - Add a few tests for about:settings behavior. r=Gijs,robwu,settings-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D203052
This commit is contained in:
parent
061e6bc804
commit
4ad24f7ac0
4 changed files with 106 additions and 0 deletions
|
|
@ -11,6 +11,8 @@ support-files = [
|
|||
"addons/set_newtab.xpi",
|
||||
]
|
||||
|
||||
["browser_about_settings.js"]
|
||||
|
||||
["browser_advanced_update.js"]
|
||||
skip-if = ["!updater"]
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(async function test_openPreferences_aboutSettings() {
|
||||
await BrowserTestUtils.withNewTab(
|
||||
{
|
||||
gBrowser,
|
||||
url: "about:settings",
|
||||
},
|
||||
async () => {
|
||||
is(
|
||||
gBrowser.currentURI.spec,
|
||||
"about:settings",
|
||||
"about:settings should open normally"
|
||||
);
|
||||
|
||||
// using `openPreferencesViaOpenPreferencesAPI` would introduce an extra about:blank tab we need to take care of
|
||||
await openPreferences("paneGeneral");
|
||||
|
||||
is(
|
||||
gBrowser.currentURI.spec,
|
||||
"about:settings#general",
|
||||
"openPreferences should keep about:settings"
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
@ -156,6 +156,8 @@ https_first_disabled = true
|
|||
|
||||
["browser_sidebar_hidden_categories.js"]
|
||||
|
||||
["browser_sidebar_preferences_button.js"]
|
||||
|
||||
["browser_sidebar_restore_category.js"]
|
||||
|
||||
["browser_subframe_install.js"]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(async function testNoOtherTabsPresent() {
|
||||
let addonsWin = await loadInitialView("extension");
|
||||
let preferencesButton =
|
||||
addonsWin.document.querySelector("#preferencesButton");
|
||||
|
||||
let preferencesPromise = BrowserTestUtils.waitForNewTab(
|
||||
gBrowser,
|
||||
"about:preferences"
|
||||
);
|
||||
|
||||
preferencesButton.click();
|
||||
|
||||
let preferencesTab = await preferencesPromise;
|
||||
|
||||
is(
|
||||
gBrowser.currentURI.spec,
|
||||
"about:preferences",
|
||||
"about:preferences should open if neither it nor about:settings are present"
|
||||
);
|
||||
|
||||
gBrowser.removeTab(preferencesTab);
|
||||
|
||||
await closeView(addonsWin);
|
||||
});
|
||||
|
||||
async function ensurePreferencesButtonFocusesTab(expectedUri) {
|
||||
let addonsWin = await loadInitialView("extension");
|
||||
let preferencesButton =
|
||||
addonsWin.document.querySelector("#preferencesButton");
|
||||
|
||||
let tabCountBeforeClick = gBrowser.tabCount;
|
||||
preferencesButton.click();
|
||||
let tabCountAfterClick = gBrowser.tabCount;
|
||||
|
||||
is(
|
||||
tabCountAfterClick,
|
||||
tabCountBeforeClick,
|
||||
"preferences button should not open new tabs"
|
||||
);
|
||||
is(
|
||||
gBrowser.currentURI.spec,
|
||||
expectedUri,
|
||||
"the correct tab should be focused"
|
||||
);
|
||||
|
||||
addonsWin.focus();
|
||||
await closeView(addonsWin);
|
||||
}
|
||||
|
||||
add_task(async function testAboutPreferencesPresent() {
|
||||
await BrowserTestUtils.withNewTab("about:preferences", async () => {
|
||||
await ensurePreferencesButtonFocusesTab("about:preferences");
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function testAboutSettingsPresent() {
|
||||
await BrowserTestUtils.withNewTab("about:settings", async () => {
|
||||
await ensurePreferencesButtonFocusesTab("about:settings");
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function testAboutSettingsAndPreferencesPresent() {
|
||||
await BrowserTestUtils.withNewTab("about:settings", async () => {
|
||||
await BrowserTestUtils.withNewTab("about:preferences", async () => {
|
||||
await ensurePreferencesButtonFocusesTab("about:settings");
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue