Bug 1885565 - Part 2: Fix up parameter ordering and kDoc descriptions in NavigationBa...
[gecko.git] / toolkit / profile / xpcshell / test_single_profile_unselected.js
blob3ad36de38760232225ef61bbb906468deefd5c5b
1 /* Any copyright is dedicated to the Public Domain.
2    http://creativecommons.org/publicdomain/zero/1.0/ */
4 /*
5  * Previous versions of Firefox automatically used a single profile even if it
6  * wasn't marked as the default. So we should try to upgrade that one if it was
7  * last used by this build. This test checks the case where it wasn't.
8  */
10 add_task(async () => {
11   let defaultProfile = makeRandomProfileDir("default");
13   // Just pretend this profile was last used by something in the profile dir.
14   let greDir = gProfD.clone();
15   greDir.append("app");
16   writeCompatibilityIni(defaultProfile, greDir, greDir);
18   writeProfilesIni({
19     profiles: [
20       {
21         name: "default",
22         path: defaultProfile.leafName,
23         default: false,
24       },
25     ],
26   });
28   let profileData = readProfilesIni();
30   Assert.ok(
31     profileData.options.startWithLastProfile,
32     "Should be set to start with the last profile."
33   );
34   Assert.equal(
35     profileData.profiles.length,
36     1,
37     "Should have the right number of profiles."
38   );
40   let profile = profileData.profiles[0];
41   Assert.equal(profile.name, "default", "Should have the right name.");
42   Assert.equal(
43     profile.path,
44     defaultProfile.leafName,
45     "Should be the original default profile."
46   );
47   Assert.ok(!profile.default, "Should not be marked as the old-style default.");
49   Assert.ok(!profileData.installs, "Should be no defaults for installs yet.");
51   checkProfileService(profileData);
53   let { profile: selectedProfile, didCreate } = selectStartupProfile();
54   checkStartupReason("firstrun-skipped-default");
55   Assert.ok(didCreate, "Should have created a new profile.");
56   Assert.ok(
57     !selectedProfile.rootDir.equals(defaultProfile),
58     "Should be using the right directory."
59   );
60   Assert.equal(selectedProfile.name, DEDICATED_NAME);
62   profileData = readProfilesIni();
64   profile = profileData.profiles[0];
65   Assert.equal(profile.name, "default", "Should have the right name.");
66   Assert.equal(
67     profile.path,
68     defaultProfile.leafName,
69     "Should be the original default profile."
70   );
71   Assert.ok(profile.default, "Should now be marked as the old-style default.");
73   checkProfileService(profileData);
74 });