summaryrefslogtreecommitdiffstats
path: root/toolkit/profile/xpcshell/test_invalid_descriptor.js
blob: 87638d301df8691d85fcc8c2769e0a70af4ab2ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

/**
 * If a user has modified a relative profile path then there may be issues where
 * the profile default setting doesn't match.
 */

add_task(async () => {
  let hash = xreDirProvider.getInstallHash();

  let profileData = {
    options: {
      startWithLastProfile: true,
    },
    profiles: [
      {
        name: "Profile1",
        path: "../data/test",
      },
      {
        name: "Profile2",
        path: "Path2",
      },
    ],
    installs: {
      [hash]: {
        default: "test",
      },
    },
  };

  writeProfilesIni(profileData);

  let { profile, didCreate } = selectStartupProfile();
  checkStartupReason("default");

  let service = getProfileService();

  Assert.ok(!didCreate, "Should not have created a new profile.");
  Assert.equal(
    profile.name,
    "Profile1",
    "Should have selected the expected profile"
  );

  Assert.equal(
    profile.name,
    service.defaultProfile.name,
    "Should have selected the right default."
  );

  service.flush();
  checkProfileService();
});