зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1799332: Update tests due to no longer bundling channel-prefs.js on macOS and locking the app.update.channel pref. r=bytesized
Differential Revision: https://phabricator.services.mozilla.com/D186139
This commit is contained in:
Родитель
e755967a21
Коммит
8fa68f6233
|
@ -189,6 +189,7 @@ const startupPhases = {
|
|||
{
|
||||
// bug 1541601
|
||||
path: "PrfDef:channel-prefs.js",
|
||||
condition: !MAC,
|
||||
stat: 1,
|
||||
read: 1,
|
||||
close: 1,
|
||||
|
|
|
@ -16,6 +16,8 @@ class TestAutoConfig(MarionetteTestCase):
|
|||
os.remove(self.pref_file)
|
||||
if hasattr(self, "autoconfig_file"):
|
||||
os.remove(self.autoconfig_file)
|
||||
if hasattr(self, "pref_file_dir_created"):
|
||||
os.rmdir(self.pref_file_dir)
|
||||
|
||||
super(TestAutoConfig, self).tearDown()
|
||||
|
||||
|
@ -48,7 +50,11 @@ class TestAutoConfig(MarionetteTestCase):
|
|||
self.marionette.quit()
|
||||
|
||||
test_dir = os.path.dirname(__file__)
|
||||
self.pref_file = os.path.join(self.exe_dir, "defaults", "pref", "autoconfig.js")
|
||||
self.pref_file_dir = os.path.join(self.exe_dir, "defaults", "pref")
|
||||
if not os.path.exists(self.pref_file_dir):
|
||||
os.makedirs(self.pref_file_dir, exist_ok=True)
|
||||
self.pref_file_dir_created = True
|
||||
self.pref_file = os.path.join(self.pref_file_dir, "autoconfig.js")
|
||||
shutil.copyfile(os.path.join(test_dir, "autoconfig.js"), self.pref_file)
|
||||
self.autoconfig_file = os.path.join(self.exe_dir, "autoconfig.cfg")
|
||||
shutil.copyfile(os.path.join(test_dir, "autoconfig.cfg"), self.autoconfig_file)
|
||||
|
|
|
@ -199,6 +199,12 @@ add_task(async function test_prefs() {
|
|||
"Accepting the policy again should let us upload data."
|
||||
);
|
||||
|
||||
// macOS has the app.update.channel pref locked. Check if it needs to be
|
||||
// unlocked before proceeding with the test.
|
||||
if (Services.prefs.getDefaultBranch("").prefIsLocked("app.update.channel")) {
|
||||
Services.prefs.getDefaultBranch("").unlockPref("app.update.channel");
|
||||
}
|
||||
|
||||
// Set a new, per channel, minimum policy version. Start by setting a test current channel.
|
||||
Services.prefs
|
||||
.getDefaultBranch("")
|
||||
|
|
|
@ -25,6 +25,7 @@ add_task(async function test_updatechannel() {
|
|||
Assert.equal(UpdateUtils.getUpdateChannel(true), currentChannel);
|
||||
Assert.equal(UpdateUtils.getUpdateChannel(false), currentChannel);
|
||||
|
||||
defaultPrefs.unlock(PREF_APP_UPDATE_CHANNEL);
|
||||
defaultPrefs.set(PREF_APP_UPDATE_CHANNEL, TEST_CHANNEL);
|
||||
Assert.equal(UpdateUtils.UpdateChannel, TEST_CHANNEL);
|
||||
Assert.equal(UpdateUtils.getUpdateChannel(true), TEST_CHANNEL);
|
||||
|
|
|
@ -34,6 +34,7 @@ const gAppInfo = getAppInfo();
|
|||
const gDefaultPrefBranch = Services.prefs.getDefaultBranch(null);
|
||||
|
||||
function setUpdateChannel(aChannel) {
|
||||
gDefaultPrefBranch.unlockPref(PREF_APP_UPDATE_CHANNEL);
|
||||
gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_CHANNEL, aChannel);
|
||||
}
|
||||
|
||||
|
|
|
@ -223,6 +223,7 @@ function setUpdateChannel(aChannel) {
|
|||
debugDump(
|
||||
"setting default pref " + PREF_APP_UPDATE_CHANNEL + " to " + gChannel
|
||||
);
|
||||
gDefaultPrefBranch.unlockPref(PREF_APP_UPDATE_CHANNEL);
|
||||
gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_CHANNEL, gChannel);
|
||||
gPrefRoot.addObserver(PREF_APP_UPDATE_CHANNEL, observer);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче