diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /browser/components/preferences/tests | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/preferences/tests')
6 files changed, 92 insertions, 27 deletions
diff --git a/browser/components/preferences/tests/browser.toml b/browser/components/preferences/tests/browser.toml index 523110dbc9..07d9cc2880 100644 --- a/browser/components/preferences/tests/browser.toml +++ b/browser/components/preferences/tests/browser.toml @@ -72,6 +72,9 @@ skip-if = [ "verify && debug && os == 'mac'", ] +["browser_connection_system_wpad.js"] +run-if = ["os == 'win'"] + ["browser_connection_valid_hostname.js"] ["browser_containers_name_input.js"] @@ -293,4 +296,4 @@ support-files = [ ["browser_warning_permanent_private_browsing.js"] ["browser_windows_launch_on_login.js"] -run-if = ["os == 'win'"] +run-if = ["(os == 'win' && !msix)"] # Disabled for MSIX due to https://bugzilla.mozilla.org/show_bug.cgi?id=1888263 diff --git a/browser/components/preferences/tests/browser_bug731866.js b/browser/components/preferences/tests/browser_bug731866.js index b090535a49..e9ecd08a81 100644 --- a/browser/components/preferences/tests/browser_bug731866.js +++ b/browser/components/preferences/tests/browser_bug731866.js @@ -7,6 +7,9 @@ const browserContainersGroupDisabled = !SpecialPowers.getBoolPref( const cookieBannerHandlingDisabled = !SpecialPowers.getBoolPref( "cookiebanners.ui.desktop.enabled" ); +const backupGroupDisabled = !SpecialPowers.getBoolPref( + "browser.backup.preferences.ui.enabled" +); const updatePrefContainers = ["updatesCategory", "updateApp"]; const updateContainersGroupDisabled = AppConstants.platform === "win" && @@ -60,6 +63,12 @@ function checkElements(expectedPane) { continue; } + // Backup is currently disabled by default. (bug 1895791) + if (element.id == "dataBackupGroup" && backupGroupDisabled) { + is_element_hidden(element, "Disabled dataBackupGroup should be hidden"); + continue; + } + let attributeValue = element.getAttribute("data-category"); let suffix = " (id=" + element.id + ")"; if (attributeValue == "pane" + expectedPane) { diff --git a/browser/components/preferences/tests/browser_connection_system_wpad.js b/browser/components/preferences/tests/browser_connection_system_wpad.js new file mode 100644 index 0000000000..87a3dbebae --- /dev/null +++ b/browser/components/preferences/tests/browser_connection_system_wpad.js @@ -0,0 +1,40 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function test_system_wpad() { + await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true }); + const connectionURL = + "chrome://browser/content/preferences/dialogs/connection.xhtml"; + + registerCleanupFunction(function () { + Services.prefs.clearUserPref("network.proxy.system_wpad.allowed"); + }); + + Services.prefs.setBoolPref("network.proxy.system_wpad.allowed", true); + let dialog = await openAndLoadSubDialog(connectionURL); + let dialogElement = dialog.document.getElementById("ConnectionsDialog"); + let systemWpad = dialog.document.getElementById("systemWpad"); + Assert.ok(!systemWpad.hidden, "Use system WPAD checkbox should be visible"); + let dialogClosingPromise = BrowserTestUtils.waitForEvent( + dialogElement, + "dialogclosing" + ); + dialogElement.cancelDialog(); + await dialogClosingPromise; + + Services.prefs.setBoolPref("network.proxy.system_wpad.allowed", false); + dialog = await openAndLoadSubDialog(connectionURL); + dialogElement = dialog.document.getElementById("ConnectionsDialog"); + systemWpad = dialog.document.getElementById("systemWpad"); + Assert.ok(systemWpad.hidden, "Use system WPAD checkbox should be hidden"); + dialogClosingPromise = BrowserTestUtils.waitForEvent( + dialogElement, + "dialogclosing" + ); + dialogElement.cancelDialog(); + await dialogClosingPromise; + + gBrowser.removeCurrentTab(); +}); diff --git a/browser/components/preferences/tests/browser_keyboardfocus.js b/browser/components/preferences/tests/browser_keyboardfocus.js index bed452b679..89576b926a 100644 --- a/browser/components/preferences/tests/browser_keyboardfocus.js +++ b/browser/components/preferences/tests/browser_keyboardfocus.js @@ -13,40 +13,42 @@ add_task(async function () { let checkbox = gBrowser.contentDocument.querySelector( "#useFullKeyboardNavigation" ); - Assert.ok( - !Services.prefs.getIntPref("accessibility.tabfocus", undefined), - "no pref value should exist" + Assert.equal( + Services.prefs.getIntPref("accessibility.tabfocus"), + 7, + "default should be full keyboard access" ); Assert.ok( - !checkbox.checked, - "checkbox should be unchecked before clicking on checkbox" + checkbox.checked, + "checkbox should be checked before clicking on checkbox" ); checkbox.click(); Assert.equal( Services.prefs.getIntPref("accessibility.tabfocus"), - 7, + 1, "Prefstore should reflect checkbox's associated numeric value" ); Assert.ok( - checkbox.checked, - "checkbox should be checked after clicking on checkbox" + !checkbox.checked, + "checkbox should be unchecked after clicking on checkbox" ); checkbox.click(); Assert.ok( - !checkbox.checked, - "checkbox should be unchecked after clicking on checkbox" + checkbox.checked, + "checkbox should be checked after clicking on checkbox" ); - Assert.ok( - !Services.prefs.getIntPref("accessibility.tabfocus", undefined), - "No pref value should exist" + Assert.equal( + Services.prefs.getIntPref("accessibility.tabfocus"), + 7, + "Should restore default value" ); BrowserTestUtils.removeTab(gBrowser.selectedTab); - SpecialPowers.pushPrefEnv({ set: [["accessibility.tabfocus", 4]] }); + await SpecialPowers.pushPrefEnv({ set: [["accessibility.tabfocus", 4]] }); await launchPreferences(); checkbox = gBrowser.contentDocument.querySelector( "#useFullKeyboardNavigation" @@ -57,20 +59,20 @@ add_task(async function () { "checkbox should stay unchecked after setting non-7 pref value" ); Assert.equal( - Services.prefs.getIntPref("accessibility.tabfocus", 0), + Services.prefs.getIntPref("accessibility.tabfocus"), 4, "pref should have value in store" ); BrowserTestUtils.removeTab(gBrowser.selectedTab); - SpecialPowers.pushPrefEnv({ set: [["accessibility.tabfocus", 7]] }); + await SpecialPowers.pushPrefEnv({ set: [["accessibility.tabfocus", 7]] }); await launchPreferences(); checkbox = gBrowser.contentDocument.querySelector( "#useFullKeyboardNavigation" ); Assert.equal( - Services.prefs.getIntPref("accessibility.tabfocus", 0), + Services.prefs.getIntPref("accessibility.tabfocus"), 7, "Pref value should update after modification" ); diff --git a/browser/components/preferences/tests/browser_primaryPassword.js b/browser/components/preferences/tests/browser_primaryPassword.js index 1162ca1290..2c42bd8d91 100644 --- a/browser/components/preferences/tests/browser_primaryPassword.js +++ b/browser/components/preferences/tests/browser_primaryPassword.js @@ -30,6 +30,9 @@ add_task(async function () { isPrimaryPasswordSet() { return primaryPasswordSet; }, + getOSAuthEnabled() { + return true; // Since enabled by default. + }, }; let checkbox = doc.querySelector("#useMasterPassword"); diff --git a/browser/components/preferences/tests/browser_search_quickactions.js b/browser/components/preferences/tests/browser_search_quickactions.js index db938035ae..70799b5002 100644 --- a/browser/components/preferences/tests/browser_search_quickactions.js +++ b/browser/components/preferences/tests/browser_search_quickactions.js @@ -6,26 +6,26 @@ "use strict"; ChromeUtils.defineESModuleGetters(this, { - UrlbarProviderQuickActions: - "resource:///modules/UrlbarProviderQuickActions.sys.mjs", + ActionsProviderQuickActions: + "resource:///modules/ActionsProviderQuickActions.sys.mjs", UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.sys.mjs", }); add_setup(async function setup() { await SpecialPowers.pushPrefEnv({ set: [ - ["browser.urlbar.suggest.quickactions", true], + ["browser.urlbar.secondaryActions.featureGate", true], ["browser.urlbar.quickactions.enabled", true], ], }); - UrlbarProviderQuickActions.addAction("testaction", { + ActionsProviderQuickActions.addAction("testaction", { commands: ["testaction"], label: "quickactions-downloads2", }); registerCleanupFunction(() => { - UrlbarProviderQuickActions.removeAction("testaction"); + ActionsProviderQuickActions.removeAction("testaction"); }); }); @@ -61,15 +61,23 @@ add_task(async function test_show_prefs() { await BrowserTestUtils.removeTab(tab); }); -async function testActionIsShown(window) { +async function testActionIsShown(window, name) { await UrlbarTestUtils.promiseAutocompleteResultPopup({ window, value: "testact", waitForFocus: SimpleTest.waitForFocus, }); try { - let { result } = await UrlbarTestUtils.getDetailsOfResultAt(window, 1); - return result.providerName == "quickactions"; + await BrowserTestUtils.waitForMutationCondition( + window.document, + {}, + () => + !!window.document.querySelector( + `.urlbarView-action-btn[data-action=${name}]` + ) + ); + Assert.ok(true, `We found action "${name}"`); + return true; } catch (e) { return false; } @@ -100,7 +108,7 @@ add_task(async function test_prefs() { }); Assert.ok( - await testActionIsShown(window), + await testActionIsShown(window, "testaction"), "Actions are shown after user clicks checkbox" ); |