summaryrefslogtreecommitdiffstats
path: root/toolkit/profile/xpcshell/test_claim_locked.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /toolkit/profile/xpcshell/test_claim_locked.js
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/profile/xpcshell/test_claim_locked.js')
-rw-r--r--toolkit/profile/xpcshell/test_claim_locked.js68
1 files changed, 68 insertions, 0 deletions
diff --git a/toolkit/profile/xpcshell/test_claim_locked.js b/toolkit/profile/xpcshell/test_claim_locked.js
new file mode 100644
index 0000000000..bffdea39dc
--- /dev/null
+++ b/toolkit/profile/xpcshell/test_claim_locked.js
@@ -0,0 +1,68 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/*
+ * Tests that an old-style default profile already locked to a different install
+ * isn't claimed by this install.
+ */
+
+add_task(async () => {
+ let defaultProfile = makeRandomProfileDir("default");
+
+ writeCompatibilityIni(defaultProfile);
+
+ writeProfilesIni({
+ profiles: [
+ {
+ name: "Foo",
+ path: defaultProfile.leafName,
+ default: true,
+ },
+ ],
+ installs: {
+ other: {
+ default: defaultProfile.leafName,
+ locked: true,
+ },
+ },
+ });
+
+ let { profile: selectedProfile, didCreate } = selectStartupProfile();
+
+ let profileData = readProfilesIni();
+
+ Assert.ok(
+ profileData.options.startWithLastProfile,
+ "Should be set to start with the last profile."
+ );
+ Assert.equal(
+ profileData.profiles.length,
+ 2,
+ "Should have the right number of profiles."
+ );
+
+ let hash = xreDirProvider.getInstallHash();
+ Assert.equal(
+ Object.keys(profileData.installs).length,
+ 2,
+ "Should be two known installs."
+ );
+ Assert.notEqual(
+ profileData.installs[hash].default,
+ defaultProfile.leafName,
+ "Should not have marked the original default profile as the default for this install."
+ );
+ Assert.ok(
+ profileData.installs[hash].locked,
+ "Should have locked as we created this profile for this install."
+ );
+
+ checkProfileService(profileData);
+
+ Assert.ok(didCreate, "Should have created a new profile.");
+ Assert.ok(
+ !selectedProfile.rootDir.equals(defaultProfile),
+ "Should be using a different directory."
+ );
+ Assert.equal(selectedProfile.name, DEDICATED_NAME);
+});