1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
5 * Tests that calling nsIToolkitProfile.remove on the default profile correctly
10 let hash = xreDirProvider.getInstallHash();
11 let defaultProfile = makeRandomProfileDir("default");
17 path: defaultProfile.leafName,
23 default: defaultProfile.leafName,
27 writeProfilesIni(profilesIni);
29 let service = getProfileService();
30 checkProfileService(profilesIni);
32 let { profile, didCreate } = selectStartupProfile();
33 Assert.ok(!didCreate, "Should have not created a new profile.");
37 "Should have selected the default profile."
41 service.defaultProfile,
42 "Should have selected the default profile."
45 checkProfileService(profilesIni);
47 // In an actual run of Firefox we wouldn't be able to delete the profile in
48 // use because it would be locked. But we don't actually lock the profile in
50 profile.remove(false);
52 Assert.ok(!service.defaultProfile, "Should no longer be a default profile.");
55 service.currentProfile,
56 "Should still be the profile in use."
59 // These are the modifications that should have been made.
60 profilesIni.profiles.pop();
61 profilesIni.installs[hash].default = "";
63 // The data isn't flushed to disk so don't check the backup here.
64 checkProfileService(profilesIni, false);
68 // And that should have flushed to disk correctly.
69 checkProfileService();
71 // checkProfileService doesn't differentiate between a blank default profile
72 // for the install and a missing install.
73 profilesIni = readProfilesIni();
75 profilesIni.installs[hash].default,
77 "Should be a blank default profile."