diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /testing/marionette | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/marionette')
11 files changed, 77 insertions, 12 deletions
diff --git a/testing/marionette/client/marionette_driver/geckoinstance.py b/testing/marionette/client/marionette_driver/geckoinstance.py index b0bec22ea0..e613415886 100644 --- a/testing/marionette/client/marionette_driver/geckoinstance.py +++ b/testing/marionette/client/marionette_driver/geckoinstance.py @@ -60,6 +60,8 @@ class GeckoInstance(object): # Do not show datareporting policy notifications which can interfere with tests "datareporting.policy.dataSubmissionEnabled": False, "datareporting.policy.dataSubmissionPolicyBypassNotification": True, + # Disable popup-blocker + "dom.disable_open_during_load": False, # Enabling the support for File object creation in the content process. "dom.file.createInChild": True, # Disable delayed user input event handling @@ -138,6 +140,8 @@ class GeckoInstance(object): "network.manage-offline-status": False, # Make sure SNTP requests don't hit the network "network.sntp.pools": "%(server)s", + # Disabled for causing marionette crashes on OSX. See bug 1882856 + "network.dns.native_https_query": False, # Privacy and Tracking Protection "privacy.trackingprotection.enabled": False, # Disable recommended automation prefs in CI @@ -596,6 +600,8 @@ class DesktopInstance(GeckoInstance): "browser.startup.homepage_override.mstone": "ignore", # Start with a blank page by default "browser.startup.page": 0, + # Unload the previously selected tab immediately + "browser.tabs.remote.unloadDelayMs": 0, # Don't unload tabs when available memory is running low "browser.tabs.unloadOnLowMemory": False, # Do not warn when closing all open tabs diff --git a/testing/marionette/client/marionette_driver/marionette.py b/testing/marionette/client/marionette_driver/marionette.py index 3fbc1b63d7..a4b8c73792 100644 --- a/testing/marionette/client/marionette_driver/marionette.py +++ b/testing/marionette/client/marionette_driver/marionette.py @@ -2181,3 +2181,11 @@ class Marionette(object): :returns: Window rect. """ return self._send_message("WebDriver:FullscreenWindow") + + def set_permission(self, descriptor, state): + """Set the permission for the origin of the current page.""" + body = { + "descriptor": descriptor, + "state": state, + } + return self._send_message("WebDriver:SetPermission", body) diff --git a/testing/marionette/client/setup.py b/testing/marionette/client/setup.py index 676266c704..0f014164bc 100644 --- a/testing/marionette/client/setup.py +++ b/testing/marionette/client/setup.py @@ -17,7 +17,7 @@ def read(*parts): def get_version(): return re.findall( - '__version__ = "([\d\.]+)"', read("marionette_driver", "__init__.py"), re.M + r'__version__ = "([\d\.]+)"', read("marionette_driver", "__init__.py"), re.M )[0] diff --git a/testing/marionette/harness/marionette_harness/runner/base.py b/testing/marionette/harness/marionette_harness/runner/base.py index b5ddc2d788..a042ac01ab 100644 --- a/testing/marionette/harness/marionette_harness/runner/base.py +++ b/testing/marionette/harness/marionette_harness/runner/base.py @@ -730,7 +730,7 @@ class BaseMarionetteTestRunner(object): @property def filename_pattern(self): if self._filename_pattern is None: - self._filename_pattern = re.compile("^test(((_.+?)+?\.((py))))$") + self._filename_pattern = re.compile(r"^test(((_.+?)+?\.((py))))$") return self._filename_pattern diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_addons.py b/testing/marionette/harness/marionette_harness/tests/unit/test_addons.py index 1611739e5f..1552dc8d6f 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_addons.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_addons.py @@ -32,8 +32,8 @@ class TestAddons(MarionetteTestCase): addons = self.marionette.execute_async_script( """ const [resolve] = arguments; - const { AddonManager } = ChromeUtils.import( - "resource://gre/modules/AddonManager.jsm" + const { AddonManager } = ChromeUtils.importESModule( + "resource://gre/modules/AddonManager.sys.mjs" ); async function getAllAddons() { @@ -54,8 +54,8 @@ class TestAddons(MarionetteTestCase): addon_id = self.marionette.execute_async_script( """ const [addonId, resolve] = arguments; - const { AddonManager } = ChromeUtils.import( - "resource://gre/modules/AddonManager.jsm" + const { AddonManager } = ChromeUtils.importESModule( + "resource://gre/modules/AddonManager.sys.mjs" ); async function uninstall() { diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py b/testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py index e3799bc0d6..45ea1ed757 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_pagesource.py @@ -47,6 +47,6 @@ class TestPageSource(MarionetteTestCase): import re self.assertEqual( - re.sub("\s", "", source), "<xml><foo><bar>baz</bar></foo></xml>" + re.sub(r"\s", "", source), "<xml><foo><bar>baz</bar></foo></xml>" ) self.assertEqual(source, from_web_api) diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_set_permission.py b/testing/marionette/harness/marionette_harness/tests/unit/test_set_permission.py new file mode 100644 index 0000000000..476d9c5729 --- /dev/null +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_set_permission.py @@ -0,0 +1,50 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from marionette_driver import errors +from marionette_harness import MarionetteTestCase + + +class TestSetPermission(MarionetteTestCase): + def setUp(self): + super().setUp() + test_empty = self.marionette.absolute_url("empty.html") + self.marionette.set_pref("marionette.setpermission.enabled", True) + self.marionette.navigate(test_empty) + + def query_permission(self, descriptor): + return self.marionette.execute_script( + """ + return navigator.permissions.query(arguments[0]).then(status => status.state) + """, + script_args=(descriptor,), + ) + + def test_granted(self): + self.marionette.set_permission({"name": "midi"}, "granted") + self.assertEqual(self.query_permission({"name": "midi"}), "granted") + + def test_denied(self): + self.marionette.set_permission({"name": "midi"}, "denied") + self.assertEqual(self.query_permission({"name": "midi"}), "denied") + + def test_prompt(self): + self.marionette.set_permission({"name": "midi"}, "prompt") + self.assertEqual(self.query_permission({"name": "midi"}), "prompt") + + def test_invalid_name(self): + with self.assertRaises(errors.InvalidArgumentException): + self.marionette.set_permission({"name": "firefox"}, "granted") + + def test_invalid_state(self): + with self.assertRaises(errors.InvalidArgumentException): + self.marionette.set_permission({"name": "midi"}, "default") + + def test_extra_flags(self): + self.marionette.set_permission({"name": "midi"}, "granted") + self.marionette.set_permission({"name": "midi", "sysex": True}, "prompt") + self.assertEqual(self.query_permission({"name": "midi"}), "granted") + self.assertEqual( + self.query_permission({"name": "midi", "sysex": True}), "prompt" + ) diff --git a/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.toml b/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.toml index e8675e4897..1f39da959e 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.toml +++ b/testing/marionette/harness/marionette_harness/tests/unit/unit-tests.toml @@ -112,8 +112,7 @@ skip-if = ["!manage_instance"] ["test_profile_management.py"] skip-if = [ - "!manage_instance", - "debug && (os == 'mac' || os == 'linux')", # Bug 1450355 + "!manage_instance" ] ["test_proxy.py"] @@ -138,6 +137,8 @@ skip-if = ["os == 'mac'"] # bug 1674411 ["test_session.py"] +["test_set_permission.py"] + ["test_skip_setup.py"] ["test_switch_frame.py"] diff --git a/testing/marionette/harness/marionette_harness/www/dom/indexedDB/basicIDB_PBM.html b/testing/marionette/harness/marionette_harness/www/dom/indexedDB/basicIDB_PBM.html index 90472d64d2..8b0b425b81 100644 --- a/testing/marionette/harness/marionette_harness/www/dom/indexedDB/basicIDB_PBM.html +++ b/testing/marionette/harness/marionette_harness/www/dom/indexedDB/basicIDB_PBM.html @@ -10,7 +10,7 @@ var req = indexedDB.open(name, ver); req.onerror = reject; - req.onsuccess = (event) => { + req.onsuccess = () => { resolve(req.result); }; diff --git a/testing/marionette/harness/marionette_harness/www/html5/geolocation.js b/testing/marionette/harness/marionette_harness/www/html5/geolocation.js index 4fb4a4747b..1c0132a732 100644 --- a/testing/marionette/harness/marionette_harness/www/html5/geolocation.js +++ b/testing/marionette/harness/marionette_harness/www/html5/geolocation.js @@ -17,7 +17,7 @@ function success(position) { message.innerHTML += "<p>Altitude: " + position.coords.altitude + "</p>"; } -function error(msg) { +function error() { let message = document.getElementById("status"); message.innerHTML = "Failed to get geolocation."; } diff --git a/testing/marionette/harness/setup.py b/testing/marionette/harness/setup.py index fd43cdb969..cf3a255009 100644 --- a/testing/marionette/harness/setup.py +++ b/testing/marionette/harness/setup.py @@ -17,7 +17,7 @@ def read(*parts): def get_version(): return re.findall( - '__version__ = "([\d\.]+)"', read("marionette_harness", "__init__.py"), re.M + r'__version__ = "([\d\.]+)"', read("marionette_harness", "__init__.py"), re.M )[0] |