Bug 1885565 - Part 2: Fix up parameter ordering and kDoc descriptions in NavigationBa...
[gecko.git] / toolkit / profile / xpcshell / test_missing_profilesini.js
blob74ab7584fa3a367ff902e7ae707181eb1ad29cfa
1 /* Any copyright is dedicated to the Public Domain.
2    http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5  * When profiles.ini is missing there isn't any point in restoring from any
6  * installs.ini, the profiles it refers to are gone anyway.
7  */
9 add_task(async () => {
10   let hash = xreDirProvider.getInstallHash();
12   let installs = {
13     [hash]: {
14       default: "Path2",
15     },
16     otherhash: {
17       default: "foo",
18     },
19     anotherhash: {
20       default: "bar",
21     },
22   };
24   writeInstallsIni({ installs });
26   let { profile, didCreate } = selectStartupProfile();
27   checkStartupReason("firstrun-created-default");
29   Assert.ok(didCreate, "Should have created a new profile.");
30   Assert.equal(
31     profile.name,
32     DEDICATED_NAME,
33     "Should have created the right profile"
34   );
36   let profilesData = readProfilesIni();
37   Assert.equal(
38     Object.keys(profilesData.installs).length,
39     1,
40     "Should be only one known install"
41   );
42   Assert.ok(hash in profilesData.installs, "Should be the expected install.");
43   Assert.notEqual(
44     profilesData.installs[hash].default,
45     "Path2",
46     "Didn't import the previous data."
47   );
48   Assert.equal(
49     profilesData.profiles.length,
50     2,
51     "Should be two profiles (old-style default and dedicated default)."
52   );
54   let { databaseVersion, profileCount } = getTelemetryScalars();
55   Assert.equal(
56     databaseVersion,
57     "0",
58     "Database file was not present at startup."
59   );
60   Assert.equal(
61     profileCount,
62     2,
63     "Should be two profiles (old-style default and dedicated default)."
64   );
66   checkProfileService(profilesData);
67 });