1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
5 * Tests the case where the user has an default profile set for the legacy
6 * install hash. This should be switched to the new hash and correctly used as
10 add_task(async () => {
11 let currentHash = xreDirProvider.getInstallHash();
12 let legacyHash = "F87E39E944FE466E";
14 let defaultProfile = makeRandomProfileDir("default");
15 let dedicatedProfile = makeRandomProfileDir("dedicated");
16 let devProfile = makeRandomProfileDir("devedition");
18 // Make sure we don't steal the old-style default.
19 writeCompatibilityIni(defaultProfile);
25 path: defaultProfile.leafName,
30 path: dedicatedProfile.leafName,
33 name: "dev-edition-default",
34 path: devProfile.leafName,
39 default: dedicatedProfile.leafName,
47 let { profile: selectedProfile, didCreate } = selectStartupProfile(
52 checkStartupReason("default");
54 let profileData = readProfilesIni();
57 profileData.options.startWithLastProfile,
58 "Should be set to start with the last profile."
61 profileData.profiles.length,
63 "Should have the right number of profiles."
66 let profile = profileData.profiles[0];
67 Assert.equal(profile.name, `dedicated`, "Should have the right name.");
70 dedicatedProfile.leafName,
71 "Should be the expected dedicated profile."
73 Assert.ok(!profile.default, "Should not be marked as the old-style default.");
75 profile = profileData.profiles[1];
76 Assert.equal(profile.name, "default", "Should have the right name.");
79 defaultProfile.leafName,
80 "Should be the original default profile."
82 Assert.ok(profile.default, "Should be marked as the old-style default.");
85 Object.keys(profileData.installs).length,
87 "Should be three known installs."
90 profileData.installs[currentHash].default,
91 dedicatedProfile.leafName,
92 "Should have switched to the new install hash."
95 profileData.installs[legacyHash].default,
96 dedicatedProfile.leafName,
97 "Should have kept the old install hash."
100 profileData.installs.otherhash.default,
102 "Should have kept the default for the other install."
105 checkProfileService(profileData);
107 Assert.ok(!didCreate, "Should not have created a new profile.");
109 selectedProfile.rootDir.equals(dedicatedProfile),
110 "Should be using the right directory."
112 Assert.equal(selectedProfile.name, "dedicated");