Bug 1852740: add tests for the `fetchpriority` attribute in Link headers. r=necko...
[gecko.git] / toolkit / profile / xpcshell / test_select_default.js
blobdf4b27df7ea6a19dab7ef1713847527aeeef6939
1 /* Any copyright is dedicated to the Public Domain.
2    http://creativecommons.org/publicdomain/zero/1.0/ */
4 /*
5  * Tests that from a database of profiles the default profile is selected.
6  */
8 add_task(async () => {
9   let hash = xreDirProvider.getInstallHash();
11   let profileData = {
12     options: {
13       startWithLastProfile: true,
14     },
15     profiles: [
16       {
17         name: "Profile1",
18         path: "Path1",
19       },
20       {
21         name: "Profile3",
22         path: "Path3",
23       },
24     ],
25     installs: {
26       [hash]: {
27         default: "Path2",
28       },
29     },
30   };
32   if (AppConstants.MOZ_DEV_EDITION) {
33     profileData.profiles.push(
34       {
35         name: "default",
36         path: "Path2",
37         default: true,
38       },
39       {
40         name: PROFILE_DEFAULT,
41         path: "Path4",
42       }
43     );
44   } else {
45     profileData.profiles.push({
46       name: PROFILE_DEFAULT,
47       path: "Path2",
48       default: true,
49     });
50   }
52   writeProfilesIni(profileData);
54   let { profile, didCreate } = selectStartupProfile();
55   checkStartupReason("default");
57   let service = getProfileService();
58   checkProfileService(profileData);
60   Assert.ok(!didCreate, "Should not have created a new profile.");
61   Assert.equal(
62     profile,
63     service.defaultProfile,
64     "Should have returned the default profile."
65   );
66   Assert.equal(
67     profile.name,
68     "default",
69     "Should have selected the right profile"
70   );
71 });