diff options
Diffstat (limited to 'toolkit/profile/xpcshell/test_claim_locked.js')
-rw-r--r-- | toolkit/profile/xpcshell/test_claim_locked.js | 68 |
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); +}); |