Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Change the mochitest to work with the system-disabled pref rather tha…
Browse files Browse the repository at this point in the history
…n the user facing pref. (#2637)

This makes the test work better due to the fact the extension will be disabled in-tree via the system-disabled pref.
  • Loading branch information
Standard8 authored and jaredhirsch committed Apr 11, 2017
1 parent cfe3848 commit bf62e73
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions test/addon/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ let enabledOnStartup = false;
// ScreenshotsEnabled/Disabled promises return true if it was already
// Enabled/Disabled, and false if it need to Enable/Disable.
function promiseScreenshotsEnabled() {
if (Services.prefs.getPrefType("extensions.screenshots.disabled") == Services.prefs.PREF_INVALID ||
!Services.prefs.getBoolPref("extensions.screenshots.disabled")) {
if (!Services.prefs.getBoolPref("extensions.screenshots.system-disabled", false)) {
info("Screenshots was already enabled, assuming enabled by default for tests");
enabledOnStartup = true;
return Promise.resolve(true);
Expand All @@ -26,13 +25,13 @@ function promiseScreenshotsEnabled() {
}
}
CustomizableUI.addListener(listener);
Services.prefs.setBoolPref("extensions.screenshots.disabled", false);
info("Set Screenshots disabled pref to false.");
Services.prefs.setBoolPref("extensions.screenshots.system-disabled", false);
});
}

function promiseScreenshotsDisabled() {
if (Services.prefs.getPrefType("extensions.screenshots.disabled") != Services.prefs.PREF_INVALID &&
Services.prefs.getBoolPref("extensions.screenshots.disabled")) {
if (Services.prefs.getBoolPref("extensions.screenshots.system-disabled", false)) {
info("Screenshots already disabled");
return Promise.resolve(true);
}
Expand All @@ -47,10 +46,8 @@ function promiseScreenshotsDisabled() {
}
}
CustomizableUI.addListener(listener);
info("Set Screenshots disabled pref");
// testing/profiles/prefs_general.js uses user_pref to disable pocket, set
// back to false.
Services.prefs.setBoolPref("extensions.screenshots.disabled", true);
info("Set Screenshots disabled pref to true.");
Services.prefs.setBoolPref("extensions.screenshots.system-disabled", true);
});
}

Expand Down

0 comments on commit bf62e73

Please sign in to comment.