Bug 1532052 - Fix test that will fail when default values change. r=johannh
authorErica Wright <ewright@mozilla.com>
Tue, 05 Mar 2019 15:01:23 +0000
changeset 520289 ef5481e83972a6844beb356e488283b9cf69f3f8
parent 520288 9286348b9c33218e956417ce8675851ddbccaeaa
child 520290 a649b71a797e6320c0134aabec0f2a8eaa054e3a
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1532052, 1524862
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1532052 - Fix test that will fail when default values change. r=johannh in bug 1524862, the test checked against a pref value that was different between Nightly and Beta. it now checks for default values. Differential Revision: https://phabricator.services.mozilla.com/D21938
browser/components/preferences/in-content/tests/browser_contentblocking.js
--- a/browser/components/preferences/in-content/tests/browser_contentblocking.js
+++ b/browser/components/preferences/in-content/tests/browser_contentblocking.js
@@ -371,44 +371,44 @@ add_task(async function testCustomOption
   Services.prefs.clearUserPref("browser.contentblocking.fingerprinting.preferences.ui.enabled");
 });
 
 // Checks that adding a custom enterprise policy will put the user in the custom category.
 // Other categories will be disabled.
 add_task(async function testPolicyCategorization() {
   Services.prefs.setStringPref(CAT_PREF, "standard");
   is(Services.prefs.getStringPref(CAT_PREF), "standard", `${CAT_PREF} starts on standard`);
-  is(Services.prefs.getBoolPref(TP_PREF), false, `${TP_PREF} starts on false`);
+  ok(!Services.prefs.prefHasUserValue(TP_PREF), `${TP_PREF} starts with the default value`);
   PoliciesPrefTracker.start();
 
   await EnterprisePolicyTesting.setupPolicyEngineWithJson({
     policies: {"EnableTrackingProtection": {
         "Value": true,
       },
     },
   });
   EnterprisePolicyTesting.checkPolicyPref(TP_PREF, true, false);
   is(Services.prefs.getStringPref(CAT_PREF), "custom", `${CAT_PREF} has been set to custom`);
 
   Services.prefs.setStringPref(CAT_PREF, "standard");
   is(Services.prefs.getStringPref(CAT_PREF), "standard", `${CAT_PREF} starts on standard`);
-  is(Services.prefs.getIntPref(NCB_PREF), 4, `${NCB_PREF} starts on 4`);
+  ok(!Services.prefs.prefHasUserValue(NCB_PREF), `${NCB_PREF} starts with the default value`);
 
   let uiUpdatedPromise = TestUtils.topicObserved("privacy-pane-tp-ui-updated");
   await EnterprisePolicyTesting.setupPolicyEngineWithJson({
     policies: {"Cookies": {
         "AcceptThirdParty": "never",
         "Locked": true,
       },
     },
   });
   await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
   await uiUpdatedPromise;
 
-  EnterprisePolicyTesting.checkPolicyPref(NCB_PREF, 1, true);
+  EnterprisePolicyTesting.checkPolicyPref(NCB_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN, true);
   is(Services.prefs.getStringPref(CAT_PREF), "custom", `${CAT_PREF} has been set to custom`);
 
   let doc = gBrowser.contentDocument;
   let strictRadioOption = doc.getElementById("strictRadio");
   let standardRadioOption = doc.getElementById("standardRadio");
   is(strictRadioOption.disabled, true, "the strict option is disabled");
   is(standardRadioOption.disabled, true, "the standard option is disabled");