Bug 1797585 - Port bug 1727820: Update enterprisepolicy tests. r=mkmelin

Port of D159295 & D159308.

Differential Revision: https://phabricator.services.mozilla.com/D160427

--HG--
extra : amend_source : 70933cd3c5f2a9908cf1660f5864942aad9eb093
This commit is contained in:
Rob Lemley 2022-10-28 10:10:46 +11:00
Родитель a52e86e241
Коммит fed28a10a4
3 изменённых файлов: 17 добавлений и 11 удалений

Просмотреть файл

@ -62,6 +62,15 @@ add_task(async function test_update_about_ui() {
"The About Dialog panel Id should equal " + panelId
);
// Make sure that we still remain on the "disabled by policy" panel after
// `AppUpdater.stop()` is called.
aboutDialog.gAppUpdater._appUpdater.stop();
is(
aboutDialog.gAppUpdater.selectedPanel.id,
panelId,
"The About Dialog panel Id should still equal " + panelId
);
aboutDialog.close();
});

Просмотреть файл

@ -3,9 +3,6 @@
"use strict";
const { Checker } = ChromeUtils.import(
"resource://gre/modules/UpdateService.jsm"
);
const { TelemetryTestUtils } = ChromeUtils.import(
"resource://testing-common/TelemetryTestUtils.jsm"
);
@ -40,8 +37,10 @@ async function test_update_pin(pinString, pinIsValid = true) {
"AppUpdatePin policy should only be active if the pin was valid."
);
let checker = new Checker();
let updateURL = await checker.getUpdateURL();
let checker = Cc["@mozilla.org/updates/update-checker;1"].getService(
Ci.nsIUpdateChecker
);
let updateURL = await checker.getUpdateURL(checker.BACKGROUND_CHECK);
let expected = pinIsValid
? `https://www.example.com/update.xml?pin=${pinString}`

Просмотреть файл

@ -3,10 +3,6 @@
"use strict";
let { Checker } = ChromeUtils.import(
"resource://gre/modules/UpdateService.jsm"
);
add_task(async function test_app_update_URL() {
await setupPolicyEngineWithJson({
policies: {
@ -20,8 +16,10 @@ add_task(async function test_app_update_URL() {
"Engine is active"
);
let checker = new Checker();
let expected = await checker.getUpdateURL();
let checker = Cc["@mozilla.org/updates/update-checker;1"].getService(
Ci.nsIUpdateChecker
);
let expected = await checker.getUpdateURL(checker.BACKGROUND_CHECK);
equal("https://www.example.com/", expected, "Correct app update URL");
});