mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1605297 - Wait for balrog migration at test start to prevent intermittent failures in DoH tests. r=JuniorHsu
There was a race between the add-on adding its pref listener and us flipping the enabled pref. By waiting for the balrog migration, we give the add-on time to start listening for the pref before setting it. Differential Revision: https://phabricator.services.mozilla.com/D58422 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
95af7e4a88
commit
15616d95ec
@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function testCleanFlow() {
|
||||
await waitForBalrogMigration();
|
||||
|
||||
// Set up a passing environment and enable DoH.
|
||||
setPassingHeuristics();
|
||||
let promise = waitForDoorhanger();
|
||||
|
@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function testDirtyEnable() {
|
||||
await waitForBalrogMigration();
|
||||
|
||||
// Set up a failing environment, pre-set DoH to enabled, and verify that
|
||||
// when the add-on is enabled, it doesn't do anything - DoH remains turned on.
|
||||
setFailingHeuristics();
|
||||
|
@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function testDoorhangerUserReject() {
|
||||
await waitForBalrogMigration();
|
||||
|
||||
// Set up a passing environment and enable DoH.
|
||||
setPassingHeuristics();
|
||||
let promise = waitForDoorhanger();
|
||||
|
@ -6,6 +6,8 @@ const { EnterprisePolicyTesting } = ChromeUtils.import(
|
||||
);
|
||||
|
||||
add_task(async function testPolicyOverride() {
|
||||
await waitForBalrogMigration();
|
||||
|
||||
// Set up an arbitrary enterprise policy. Its existence should be sufficient
|
||||
// to disable heuristics.
|
||||
await EnterprisePolicyTesting.setupPolicyEngineWithJson({
|
||||
|
@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
add_task(async function testUserInterference() {
|
||||
await waitForBalrogMigration();
|
||||
|
||||
// Set up a passing environment and enable DoH.
|
||||
setPassingHeuristics();
|
||||
let promise = waitForDoorhanger();
|
||||
|
@ -63,6 +63,17 @@ function setFailingHeuristics() {
|
||||
Preferences.set(prefs.MOCK_HEURISTICS_PREF, fakeFailingHeuristics);
|
||||
}
|
||||
|
||||
async function waitForBalrogMigration() {
|
||||
await BrowserTestUtils.waitForCondition(() => {
|
||||
return Preferences.get(prefs.DOH_BALROG_MIGRATION_PREF, false);
|
||||
});
|
||||
is(
|
||||
Preferences.get(prefs.DOH_BALROG_MIGRATION_PREF, false),
|
||||
true,
|
||||
"Balrog migration is complete and pref is set."
|
||||
);
|
||||
}
|
||||
|
||||
async function restartAddon() {
|
||||
let addon = await AddonManager.getAddonByID(ADDON_ID);
|
||||
await addon.reload();
|
||||
|
Loading…
Reference in New Issue
Block a user