diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /toolkit/modules/tests/marionette | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/modules/tests/marionette')
-rw-r--r-- | toolkit/modules/tests/marionette/manifest.toml | 4 | ||||
-rw-r--r-- | toolkit/modules/tests/marionette/test_first_startup.py | 54 |
2 files changed, 58 insertions, 0 deletions
diff --git a/toolkit/modules/tests/marionette/manifest.toml b/toolkit/modules/tests/marionette/manifest.toml new file mode 100644 index 0000000000..08a103c289 --- /dev/null +++ b/toolkit/modules/tests/marionette/manifest.toml @@ -0,0 +1,4 @@ +[DEFAULT] +run-if = ["buildapp == 'browser'"] + +["test_first_startup.py"] diff --git a/toolkit/modules/tests/marionette/test_first_startup.py b/toolkit/modules/tests/marionette/test_first_startup.py new file mode 100644 index 0000000000..6d8bbce02d --- /dev/null +++ b/toolkit/modules/tests/marionette/test_first_startup.py @@ -0,0 +1,54 @@ +# 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_harness import MarionetteTestCase + + +class TestFirstStartup(MarionetteTestCase): + def setUp(self): + MarionetteTestCase.setUp(self) + self.marionette.quit() + self.marionette.instance.prefs = { + "browser.startup.homepage_override.mstone": "" + } + self.marionette.instance.app_args = ["-first-startup"] + + def test_new_profile(self): + """Test launching with --first-startup when a new profile was created. + + Launches the browser with --first-startup on a freshly created profile + and then ensures that FirstStartup.init ran successfully. + """ + + self.marionette.instance.switch_profile() + self.marionette.start_session() + self.marionette.set_context("chrome") + firstStartupInittedSuccessfully = self.marionette.execute_script( + """ + const { FirstStartup } = ChromeUtils.importESModule("resource://gre/modules/FirstStartup.sys.mjs"); + return FirstStartup.state == FirstStartup.SUCCESS + """ + ) + + self.assertTrue( + firstStartupInittedSuccessfully, "FirstStartup initted successfully" + ) + + def test_existing_profile(self): + """Test launching with --first-startup with a pre-existing profile. + + Launches the browser with --first-startup on a profile that has been + run before. Ensures that FirstStartup.init was never run. + """ + + self.marionette.start_session() + self.marionette.set_context("chrome") + firstStartupSkipped = self.marionette.execute_script( + """ + const { FirstStartup } = ChromeUtils.importESModule("resource://gre/modules/FirstStartup.sys.mjs"); + return FirstStartup.state == FirstStartup.NOT_STARTED + """ + ) + + self.assertTrue(firstStartupSkipped, "FirstStartup init skipped") |