Bug 1487396 - Part 6: Turn the FastBlock pref off during the test runs where we were previously relying on it being off by default; r=johannh
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 04 Sep 2018 11:55:16 -0400
changeset 492371 73fc28dd555bb87d1a51ac76d86b2499d9fcc83b
parent 492370 11ce9542f2cb958f00cd5413f2f4a4be80c96d2f
child 492372 8d1e1d1ccc2ed4995c64ec3d6e0b2acc57a4108d
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1487396
milestone63.0
Bug 1487396 - Part 6: Turn the FastBlock pref off during the test runs where we were previously relying on it being off by default; r=johannh Differential Revision: https://phabricator.services.mozilla.com/D4948
browser/base/content/test/trackingUI/browser_trackingUI_state.js
--- a/browser/base/content/test/trackingUI/browser_trackingUI_state.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_state.js
@@ -319,16 +319,18 @@ add_task(async function testNormalBrowsi
 
   ContentBlocking = gBrowser.ownerGlobal.ContentBlocking;
   ok(ContentBlocking, "CB is attached to the browser window");
   TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
   ok(TrackingProtection, "TP is attached to the browser window");
   is(TrackingProtection.enabled, Services.prefs.getBoolPref(TP_PREF),
      "TP.enabled is based on the original pref value");
 
+  Services.prefs.setBoolPref(FB_PREF, false);
+
   await testContentBlockingEnabled(tab);
 
   if (Services.prefs.getBoolPref(CB_UI_PREF)) {
     Services.prefs.setBoolPref(CB_PREF, false);
     ok(!ContentBlocking.enabled, "CB is disabled after setting the pref");
   } else {
     Services.prefs.setBoolPref(TP_PREF, false);
     ok(!TrackingProtection.enabled, "TP is disabled after setting the pref");
@@ -349,26 +351,30 @@ add_task(async function testNormalBrowsi
   } else {
     Services.prefs.setBoolPref(TP_PREF, false);
     ok(!TrackingProtection.enabled, "TP is disabled after setting the pref");
   }
 
   await testContentBlockingDisabled(tab);
 
   gBrowser.removeCurrentTab();
+
+  Services.prefs.clearUserPref(FB_PREF);
 });
 
 add_task(async function testPrivateBrowsing() {
   let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
   tabbrowser = privateWin.gBrowser;
   let tab = tabbrowser.selectedTab = BrowserTestUtils.addTab(tabbrowser);
 
   // Set the normal mode pref to false to check the pbmode pref.
   Services.prefs.setBoolPref(TP_PREF, false);
 
+  Services.prefs.setBoolPref(FB_PREF, false);
+
   ContentBlocking = tabbrowser.ownerGlobal.ContentBlocking;
   ok(ContentBlocking, "CB is attached to the private window");
   TrackingProtection = tabbrowser.ownerGlobal.TrackingProtection;
   ok(TrackingProtection, "TP is attached to the private window");
   is(TrackingProtection.enabled, Services.prefs.getBoolPref(TP_PB_PREF),
      "TP.enabled is based on the pb pref value");
 
   await testContentBlockingEnabled(tab);
@@ -396,29 +402,33 @@ add_task(async function testPrivateBrows
   } else {
     Services.prefs.setBoolPref(TP_PB_PREF, false);
     ok(!TrackingProtection.enabled, "TP is disabled after setting the pref");
   }
 
   await testContentBlockingDisabled(tab);
 
   privateWin.close();
+
+  Services.prefs.clearUserPref(FB_PREF);
 });
 
 add_task(async function testFastBlock() {
   if (!SpecialPowers.getBoolPref(CB_UI_PREF)) {
     info("The FastBlock test is disabled when the Content Blocking UI is disabled");
     return;
   }
 
   await UrlClassifierTestUtils.addTestTrackers();
 
   tabbrowser = gBrowser;
   let tab = tabbrowser.selectedTab = BrowserTestUtils.addTab(tabbrowser);
 
+  Services.prefs.setBoolPref(FB_PREF, false);
+
   ContentBlocking = gBrowser.ownerGlobal.ContentBlocking;
   ok(ContentBlocking, "CB is attached to the browser window");
   FastBlock = gBrowser.ownerGlobal.FastBlock;
   ok(FastBlock, "TP is attached to the browser window");
   is(FastBlock.enabled, Services.prefs.getBoolPref(FB_PREF),
      "FB.enabled is based on the original pref value");
   Services.prefs.setBoolPref(CB_PREF, true);
   ok(ContentBlocking.enabled, "CB is enabled after setting the pref");
@@ -440,30 +450,32 @@ add_task(async function testFastBlock() 
   await testContentBlockingEnabled(tab);
 
   ok(Services.prefs.getBoolPref(CB_UI_PREF), "CB UI must be enabled here");
   Services.prefs.setBoolPref(CB_PREF, false);
   ok(!ContentBlocking.enabled, "CB is disabled after setting the pref");
 
   await testContentBlockingDisabled(tab);
 
-  Services.prefs.setBoolPref(FB_PREF, false);
+  Services.prefs.clearUserPref(FB_PREF);
   Services.prefs.clearUserPref(FB_TIMEOUT_PREF);
   gBrowser.removeCurrentTab();
 });
 
 add_task(async function testThirdPartyCookies() {
   if (!SpecialPowers.getBoolPref(CB_UI_PREF)) {
     info("The ThirdPartyCookies test is disabled when the Content Blocking UI is disabled");
     return;
   }
 
   await UrlClassifierTestUtils.addTestTrackers();
   gTrackingPageURL = COOKIE_PAGE;
 
+  Services.prefs.setBoolPref(FB_PREF, false);
+
   tabbrowser = gBrowser;
   let tab = tabbrowser.selectedTab = BrowserTestUtils.addTab(tabbrowser);
 
   ContentBlocking = gBrowser.ownerGlobal.ContentBlocking;
   ok(ContentBlocking, "CB is attached to the browser window");
   ThirdPartyCookies = gBrowser.ownerGlobal.ThirdPartyCookies;
   ok(ThirdPartyCookies, "TP is attached to the browser window");
   is(ThirdPartyCookies.enabled,
@@ -488,11 +500,12 @@ add_task(async function testThirdPartyCo
   await testContentBlockingEnabled(tab);
 
   ok(Services.prefs.getBoolPref(CB_UI_PREF), "CB UI must be enabled here");
   Services.prefs.setBoolPref(CB_PREF, false);
   ok(!ContentBlocking.enabled, "CB is disabled after setting the pref");
 
   await testContentBlockingDisabled(tab);
 
+  Services.prefs.clearUserPref(FB_PREF);
   Services.prefs.clearUserPref(TPC_PREF);
   gBrowser.removeCurrentTab();
 });