зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1435977 - Make policies test begin and end with the police engine inactive. r=Gijs
Some tests do a sanity check for features at the beginning. This works fine for a single test, and also from one test to another which are usually activating different policies. But this fails when the same test runs more than once, because the engine was left at the end in a state where that same policy was active. Note that this does not cover all the clean-up that a test must do to properly run more than once. For example, locked prefs are left locked, because the engine does support reversing all the policy code that ran. We might add more auto-reversal support in the future, but for now it's up to each test. MozReview-Commit-ID: KZ2LeKFTC0A
This commit is contained in:
Родитель
8dd2a49ca4
Коммит
086b4ec6be
|
@ -3,10 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function test_clean_slate() {
|
||||
await startWithCleanSlate();
|
||||
});
|
||||
|
||||
add_task(async function test_broken_json() {
|
||||
await setupPolicyEngineWithJson("config_broken_json.json");
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@ function URI(str) {
|
|||
return Services.io.newURI(str);
|
||||
}
|
||||
|
||||
add_task(async function test_start_with_disabled_engine() {
|
||||
await startWithCleanSlate();
|
||||
});
|
||||
|
||||
add_task(async function test_setup_preexisting_permissions() {
|
||||
// Pre-existing ALLOW permissions that should be overriden
|
||||
// with DENY.
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function test_clean_slate() {
|
||||
await startWithCleanSlate();
|
||||
});
|
||||
|
||||
let { Policies, setAndLockPref } = ChromeUtils.import("resource:///modules/policies/Policies.jsm", {});
|
||||
|
||||
function checkPref(prefName, expectedValue) {
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function test_clean_slate() {
|
||||
await startWithCleanSlate();
|
||||
});
|
||||
|
||||
add_task(async function test_simple_policies() {
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
|
||||
// Initialize the service in the content process, in case it hasn't
|
||||
|
|
|
@ -13,9 +13,6 @@ async function checkScreenshots(shouldBeEnabled) {
|
|||
|
||||
add_task(async function test_disable_firefox_screenshots() {
|
||||
await BrowserTestUtils.withNewTab("data:text/html,Test", async function() {
|
||||
await setupPolicyEngineWithJson("");
|
||||
is(Services.policies.status, Services.policies.INACTIVE, "Start with no policies");
|
||||
|
||||
// Firefox Screenshots are disabled in tests, so make sure we enable
|
||||
// it first to ensure that the test is valid.
|
||||
Services.prefs.setBoolPref(PREF_DISABLE_FX_SCREENSHOTS, false);
|
||||
|
|
|
@ -43,7 +43,16 @@ async function setupPolicyEngineWithJson(json, customSchema) {
|
|||
return promise;
|
||||
}
|
||||
|
||||
async function startWithCleanSlate() {
|
||||
await setupPolicyEngineWithJson("");
|
||||
is(Services.policies.status, Ci.nsIEnterprisePolicies.INACTIVE, "Engine is inactive");
|
||||
}
|
||||
add_task(async function policies_headjs_startWithCleanSlate() {
|
||||
if (Services.policies.status != Ci.nsIEnterprisePolicies.INACTIVE) {
|
||||
await setupPolicyEngineWithJson("");
|
||||
}
|
||||
is(Services.policies.status, Ci.nsIEnterprisePolicies.INACTIVE, "Engine is inactive at the start of the test");
|
||||
});
|
||||
|
||||
registerCleanupFunction(async function policies_headjs_finishWithCleanSlate() {
|
||||
if (Services.policies.status != Ci.nsIEnterprisePolicies.INACTIVE) {
|
||||
await setupPolicyEngineWithJson("");
|
||||
}
|
||||
is(Services.policies.status, Ci.nsIEnterprisePolicies.INACTIVE, "Engine is inactive at the end of the test");
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче