Bug 1476218 - Part 3 - Update Tracking Protection tests to reflect Content Blocking changes. r=nhnt11
authorJohann Hofmann <jhofmann@mozilla.com>
Wed, 08 Aug 2018 14:31:34 +0200
changeset 486120 3ff2f60011af3b786eb297f7e1c5e3b7cb8a749f
parent 486119 d2d9e5e7112cf228f8d4537113950940ce228af4
child 486121 d7e288a6599d1f8e7bec7e4f9f764e73812371fb
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnhnt11
bugs1476218
milestone63.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 1476218 - Part 3 - Update Tracking Protection tests to reflect Content Blocking changes. r=nhnt11 This commit also moves the remaining trackingUI_* tests out of b/b/c/test/general, since I needed to touch them anyway Differential Revision: https://phabricator.services.mozilla.com/D2935
browser/base/content/test/general/benignPage.html
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_trackingUI_3.js
browser/base/content/test/general/browser_trackingUI_4.js
browser/base/content/test/general/browser_trackingUI_5.js
browser/base/content/test/general/browser_trackingUI_6.js
browser/base/content/test/general/browser_trackingUI_telemetry.js
browser/base/content/test/general/file_trackingUI_6.html
browser/base/content/test/general/file_trackingUI_6.js
browser/base/content/test/general/file_trackingUI_6.js^headers^
browser/base/content/test/general/trackingPage.html
browser/base/content/test/trackingUI/benignPage.html
browser/base/content/test/trackingUI/browser.ini
browser/base/content/test/trackingUI/browser_trackingUI_3.js
browser/base/content/test/trackingUI/browser_trackingUI_animation_2.js
browser/base/content/test/trackingUI/browser_trackingUI_fetch.js
browser/base/content/test/trackingUI/browser_trackingUI_open_preferences.js
browser/base/content/test/trackingUI/browser_trackingUI_pbmode_exceptions.js
browser/base/content/test/trackingUI/browser_trackingUI_reload_hint.js
browser/base/content/test/trackingUI/browser_trackingUI_state.js
browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js
browser/base/content/test/trackingUI/file_trackingUI_fetch.html
browser/base/content/test/trackingUI/file_trackingUI_fetch.js
browser/base/content/test/trackingUI/file_trackingUI_fetch.js^headers^
browser/base/content/test/trackingUI/trackingPage.html
browser/components/uitour/test/browser.ini
browser/components/uitour/test/browser_trackingProtection.js
browser/components/uitour/test/browser_trackingProtection_tour.js
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -435,42 +435,16 @@ support-files =
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_tabs_isActive.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_tabs_owner.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_testOpenNewRemoteTabsFromNonRemoteBrowsers.js]
 run-if = e10s
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
-[browser_trackingUI_3.js]
-tags = trackingprotection
-# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
-[browser_trackingUI_4.js]
-tags = trackingprotection
-support-files =
-  trackingPage.html
-  benignPage.html
-# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
-[browser_trackingUI_5.js]
-tags = trackingprotection
-support-files =
-  trackingPage.html
-# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
-[browser_trackingUI_6.js]
-tags = trackingprotection
-support-files =
-  file_trackingUI_6.html
-  file_trackingUI_6.js
-  file_trackingUI_6.js^headers^
-# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
-[browser_trackingUI_telemetry.js]
-tags = trackingprotection
-support-files =
-  trackingPage.html
-# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_typeAheadFind.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_unknownContentType_title.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_unloaddialogs.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
 [browser_viewSourceInTabOnViewSource.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
rename from browser/base/content/test/general/benignPage.html
rename to browser/base/content/test/trackingUI/benignPage.html
--- a/browser/base/content/test/trackingUI/browser.ini
+++ b/browser/base/content/test/trackingUI/browser.ini
@@ -1,13 +1,21 @@
 [DEFAULT]
 tags = trackingprotection
 support-files =
   head.js
-  ../general/benignPage.html
-  ../general/trackingPage.html
+  benignPage.html
+  trackingPage.html
 
+[browser_trackingUI_3.js]
 [browser_trackingUI_animation.js]
+[browser_trackingUI_animation_2.js]
 [browser_trackingUI_appMenu.js]
 [browser_trackingUI_appMenu_toggle.js]
+[browser_trackingUI_fetch.js]
+support-files =
+  file_trackingUI_fetch.html
+  file_trackingUI_fetch.js
+  file_trackingUI_fetch.js^headers^
 [browser_trackingUI_open_preferences.js]
-[browser_trackingUI_reload_hint.js]
+[browser_trackingUI_pbmode_exceptions.js]
 [browser_trackingUI_state.js]
+[browser_trackingUI_telemetry.js]
rename from browser/base/content/test/general/browser_trackingUI_3.js
rename to browser/base/content/test/trackingUI/browser_trackingUI_3.js
--- a/browser/base/content/test/general/browser_trackingUI_3.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_3.js
@@ -27,17 +27,17 @@ add_task(async function testNormalBrowsi
   Services.prefs.setBoolPref(PREF, false);
   Services.prefs.setBoolPref(PB_PREF, false);
   ok(!TrackingProtection.enabled, "TP is disabled (ENABLED=false,PB=false)");
   Services.prefs.setBoolPref(PB_PREF, true);
   ok(!TrackingProtection.enabled, "TP is disabled (ENABLED=false,PB=true)");
 });
 
 add_task(async function testPrivateBrowsing() {
-  let privateWin = await promiseOpenAndLoadWindow({private: true}, true);
+  let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
   let TrackingProtection = privateWin.gBrowser.ownerGlobal.TrackingProtection;
   ok(TrackingProtection, "TP is attached to the browser window");
 
   Services.prefs.setBoolPref(PREF, true);
   Services.prefs.setBoolPref(PB_PREF, false);
   ok(TrackingProtection.enabled, "TP is enabled (ENABLED=true,PB=false)");
   Services.prefs.setBoolPref(PB_PREF, true);
   ok(TrackingProtection.enabled, "TP is enabled (ENABLED=true,PB=true)");
rename from browser/base/content/test/general/browser_trackingUI_4.js
rename to browser/base/content/test/trackingUI/browser_trackingUI_animation_2.js
--- a/browser/base/content/test/general/browser_trackingUI_4.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_animation_2.js
@@ -1,108 +1,113 @@
 /*
- * Test that the Tracking Protection icon is properly animated in the identity
+ * Test that the Content Blocking icon is properly animated in the identity
  * block when loading tabs and switching between tabs.
  * See also Bug 1175858.
  */
 
-const PREF = "privacy.trackingprotection.enabled";
-const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
-const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
-const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
-var TrackingProtection = null;
-var tabbrowser = null;
-
-var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
+const CB_PREF = "browser.contentblocking.enabled";
+const TP_PREF = "privacy.trackingprotection.enabled";
+const TP_PB_PREF = "privacy.trackingprotection.enabled";
+const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
+const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
 
 registerCleanupFunction(function() {
-  TrackingProtection = tabbrowser = null;
   UrlClassifierTestUtils.cleanupTestTrackers();
-  Services.prefs.clearUserPref(PREF);
-  Services.prefs.clearUserPref(PB_PREF);
-  while (gBrowser.tabs.length > 1) {
-    gBrowser.removeCurrentTab();
-  }
+  Services.prefs.clearUserPref(TP_PREF);
+  Services.prefs.clearUserPref(TP_PB_PREF);
+  Services.prefs.clearUserPref(CB_PREF);
 });
 
-function waitForSecurityChange(numChanges = 1) {
+function waitForSecurityChange(tabbrowser, numChanges = 1) {
   return new Promise(resolve => {
     let n = 0;
     let listener = {
       onSecurityChange() {
         n = n + 1;
         info("Received onSecurityChange event " + n + " of " + numChanges);
         if (n >= numChanges) {
           tabbrowser.removeProgressListener(listener);
           resolve();
         }
       }
     };
     tabbrowser.addProgressListener(listener);
   });
 }
 
-async function testTrackingProtectionAnimation() {
+async function testTrackingProtectionAnimation(tabbrowser) {
   info("Load a test page not containing tracking elements");
   let benignTab = await BrowserTestUtils.openNewForegroundTab(tabbrowser, BENIGN_PAGE);
+  let ContentBlocking = tabbrowser.ownerGlobal.ContentBlocking;
 
-  ok(!TrackingProtection.iconBox.hasAttribute("state"), "iconBox: no state");
-  ok(!TrackingProtection.iconBox.hasAttribute("animate"), "iconBox: no animate");
+  ok(!ContentBlocking.iconBox.hasAttribute("active"), "iconBox not active");
+  ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
 
   info("Load a test page containing tracking elements");
   let trackingTab = await BrowserTestUtils.openNewForegroundTab(tabbrowser, TRACKING_PAGE);
 
-  ok(TrackingProtection.iconBox.hasAttribute("state"), "iconBox: state");
-  ok(TrackingProtection.iconBox.hasAttribute("animate"), "iconBox: animate");
+  ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
+  ok(ContentBlocking.iconBox.hasAttribute("animate"), "iconBox animating");
 
   info("Switch from tracking -> benign tab");
-  let securityChanged = waitForSecurityChange();
+  let securityChanged = waitForSecurityChange(tabbrowser);
   tabbrowser.selectedTab = benignTab;
   await securityChanged;
 
-  ok(!TrackingProtection.iconBox.hasAttribute("state"), "iconBox: no state");
-  ok(!TrackingProtection.iconBox.hasAttribute("animate"), "iconBox: no animate");
+  ok(!ContentBlocking.iconBox.hasAttribute("active"), "iconBox not active");
+  ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
 
   info("Switch from benign -> tracking tab");
-  securityChanged = waitForSecurityChange();
+  securityChanged = waitForSecurityChange(tabbrowser);
   tabbrowser.selectedTab = trackingTab;
   await securityChanged;
 
-  ok(TrackingProtection.iconBox.hasAttribute("state"), "iconBox: state");
-  ok(!TrackingProtection.iconBox.hasAttribute("animate"), "iconBox: no animate");
+  ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
+  ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
 
   info("Reload tracking tab");
-  securityChanged = waitForSecurityChange(2);
+  securityChanged = waitForSecurityChange(tabbrowser, 2);
   tabbrowser.reload();
   await securityChanged;
 
-  ok(TrackingProtection.iconBox.hasAttribute("state"), "iconBox: state");
-  ok(TrackingProtection.iconBox.hasAttribute("animate"), "iconBox: animate");
+  ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
+  ok(ContentBlocking.iconBox.hasAttribute("animate"), "iconBox animating");
+
+  while (tabbrowser.tabs.length > 1) {
+    tabbrowser.removeCurrentTab();
+  }
 }
 
 add_task(async function testNormalBrowsing() {
   await UrlClassifierTestUtils.addTestTrackers();
 
-  tabbrowser = gBrowser;
-
-  TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
+  let ContentBlocking = gBrowser.ownerGlobal.ContentBlocking;
+  ok(ContentBlocking, "CB is attached to the browser window");
+  let TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
   ok(TrackingProtection, "TP is attached to the browser window");
 
-  Services.prefs.setBoolPref(PREF, true);
+  Services.prefs.setBoolPref(TP_PREF, true);
   ok(TrackingProtection.enabled, "TP is enabled after setting the pref");
+  Services.prefs.setBoolPref(CB_PREF, true);
+  ok(ContentBlocking.enabled, "CB is enabled after setting the pref");
 
-  await testTrackingProtectionAnimation();
+  await testTrackingProtectionAnimation(gBrowser);
 });
 
 add_task(async function testPrivateBrowsing() {
-  let privateWin = await promiseOpenAndLoadWindow({private: true}, true);
-  tabbrowser = privateWin.gBrowser;
+  let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
+  let tabbrowser = privateWin.gBrowser;
 
-  TrackingProtection = tabbrowser.ownerGlobal.TrackingProtection;
+  let ContentBlocking = tabbrowser.ownerGlobal.ContentBlocking;
+  ok(ContentBlocking, "CB is attached to the private window");
+  let TrackingProtection = tabbrowser.ownerGlobal.TrackingProtection;
   ok(TrackingProtection, "TP is attached to the private window");
 
-  Services.prefs.setBoolPref(PB_PREF, true);
+  Services.prefs.setBoolPref(TP_PB_PREF, true);
   ok(TrackingProtection.enabled, "TP is enabled after setting the pref");
+  Services.prefs.setBoolPref(CB_PREF, true);
+  ok(TrackingProtection.enabled, "CB is enabled after setting the pref");
 
-  await testTrackingProtectionAnimation();
+  await testTrackingProtectionAnimation(tabbrowser);
 
   privateWin.close();
 });
rename from browser/base/content/test/general/browser_trackingUI_6.js
rename to browser/base/content/test/trackingUI/browser_trackingUI_fetch.js
--- a/browser/base/content/test/general/browser_trackingUI_6.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_fetch.js
@@ -1,9 +1,9 @@
-const URL = "http://mochi.test:8888/browser/browser/base/content/test/general/file_trackingUI_6.html";
+const URL = "http://mochi.test:8888/browser/browser/base/content/test/trackingUI/file_trackingUI_fetch.html";
 
 function waitForSecurityChange(numChanges = 1) {
   return new Promise(resolve => {
     let n = 0;
     let listener = {
       onSecurityChange() {
         n = n + 1;
         info("Received onSecurityChange event " + n + " of " + numChanges);
@@ -13,31 +13,32 @@ function waitForSecurityChange(numChange
         }
       }
     };
     gBrowser.addProgressListener(listener);
   });
 }
 
 add_task(async function test_fetch() {
-  await SpecialPowers.pushPrefEnv({ set: [["privacy.trackingprotection.enabled", true]] });
+  await SpecialPowers.pushPrefEnv({ set: [
+    ["privacy.trackingprotection.enabled", true],
+    ["browser.contentblocking.enabled", true],
+  ]});
 
   await BrowserTestUtils.withNewTab({ gBrowser, url: URL }, async function(newTabBrowser) {
     let securityChange = waitForSecurityChange();
     await ContentTask.spawn(newTabBrowser, null, async function() {
       await content.wrappedJSObject.test_fetch()
                    .then(response => Assert.ok(false, "should have denied the request"))
                    .catch(e => Assert.ok(true, `Caught exception: ${e}`));
     });
     await securityChange;
 
-    var TrackingProtection = newTabBrowser.ownerGlobal.TrackingProtection;
-    ok(TrackingProtection, "got TP object");
-    ok(TrackingProtection.enabled, "TP is enabled");
+    let ContentBlocking = newTabBrowser.ownerGlobal.ContentBlocking;
+    ok(ContentBlocking, "got CB object");
+    ok(ContentBlocking.enabled, "CB is enabled");
 
-    is(TrackingProtection.content.getAttribute("state"), "blocked-tracking-content",
-        'content: state="blocked-tracking-content"');
-    is(TrackingProtection.iconBox.getAttribute("state"), "blocked-tracking-content",
-        'iconBox: state="blocked-tracking-content"');
-    is(TrackingProtection.iconBox.getAttribute("tooltiptext"),
+    ok(ContentBlocking.content.hasAttribute("detected"), "has detected content blocking");
+    ok(ContentBlocking.iconBox.hasAttribute("active"), "icon box is active");
+    is(ContentBlocking.iconBox.getAttribute("tooltiptext"),
        gNavigatorBundle.getString("trackingProtection.icon.activeTooltip"), "correct tooltip");
   });
 });
--- a/browser/base/content/test/trackingUI/browser_trackingUI_open_preferences.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_open_preferences.js
@@ -1,14 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-const PREF = "privacy.trackingprotection.enabled";
+const CB_PREF = "browser.contentblocking.enabled";
+const CB_UI_PREF = "browser.contentblocking.ui.enabled";
+const TP_PREF = "privacy.trackingprotection.enabled";
+const FB_PREF = "browser.fastblock.enabled";
 const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
 
 async function waitAndAssertPreferencesShown() {
   await BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popuphidden");
   await TestUtils.waitForCondition(() => gBrowser.currentURI.spec == "about:preferences#privacy",
     "Should open about:preferences.");
 
   await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() {
@@ -39,11 +42,37 @@ add_task(async function testOpenPreferen
     ok(!BrowserTestUtils.is_hidden(preferencesButton), "The enable tracking protection button is shown.");
 
     let shown = waitAndAssertPreferencesShown();
     preferencesButton.click();
     await shown;
   });
 });
 
+// Tests that clicking the contentblocking category items "add blocking" labels
+// links to about:preferences
+add_task(async function testOpenPreferencesFromAddBlockingButtons() {
+  SpecialPowers.pushPrefEnv({set: [
+    [CB_PREF, true],
+    [CB_UI_PREF, true],
+    [FB_PREF, false],
+    [TP_PREF, false],
+  ]});
+
+  await BrowserTestUtils.withNewTab(TRACKING_PAGE, async function() {
+    let addBlockingButtons = document.querySelectorAll(".identity-popup-content-blocking-category-add-blocking");
+    for (let button of addBlockingButtons) {
+      let promisePanelOpen = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
+      gIdentityHandler._identityBox.click();
+      await promisePanelOpen;
+
+      ok(BrowserTestUtils.is_visible(button), "Button is shown.");
+      let shown = waitAndAssertPreferencesShown();
+      button.click();
+      await shown;
+    }
+  });
+});
+
+
 add_task(async function cleanup() {
   UrlClassifierTestUtils.cleanupTestTrackers();
 });
rename from browser/base/content/test/general/browser_trackingUI_5.js
rename to browser/base/content/test/trackingUI/browser_trackingUI_pbmode_exceptions.js
--- a/browser/base/content/test/general/browser_trackingUI_5.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_pbmode_exceptions.js
@@ -1,22 +1,25 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that sites added to the Tracking Protection whitelist in private
 // browsing mode don't persist once the private browsing window closes.
 
-const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
-const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
+const CB_PREF = "browser.contentblocking.enabled";
+const TP_PB_PREF = "privacy.trackingprotection.enabled";
+const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
 var TrackingProtection = null;
+var ContentBlocking = null;
 var browser = null;
-var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
 
 registerCleanupFunction(function() {
-  TrackingProtection = browser = null;
+  Services.prefs.clearUserPref(TP_PB_PREF);
+  Services.prefs.clearUserPref(CB_PREF);
+  ContentBlocking = TrackingProtection = browser = null;
   UrlClassifierTestUtils.cleanupTestTrackers();
 });
 
 function hidden(sel) {
   let win = browser.ownerGlobal;
   let el = win.document.querySelector(sel);
   let display = win.getComputedStyle(el).getPropertyValue("display", null);
   return display === "none";
@@ -30,103 +33,130 @@ function identityPopupState() {
 function clickButton(sel) {
   let win = browser.ownerGlobal;
   let el = win.document.querySelector(sel);
   el.doCommand();
 }
 
 function testTrackingPage(window) {
   info("Tracking content must be blocked");
-  ok(!TrackingProtection.container.hidden, "The container is visible");
-  is(TrackingProtection.content.getAttribute("state"), "blocked-tracking-content",
-     'content: state="blocked-tracking-content"');
-  is(TrackingProtection.iconBox.getAttribute("state"), "blocked-tracking-content",
-     'iconBox: state="blocked-tracking-content"');
+  ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected");
+  ok(!ContentBlocking.content.hasAttribute("hasException"), "content shows no exception");
 
-  ok(!hidden("#tracking-protection-icon-box"), "icon box is visible");
+  ok(BrowserTestUtils.is_visible(ContentBlocking.iconBox), "icon box is visible");
+  ok(ContentBlocking.iconBox.hasAttribute("active"), "shield is active");
+  ok(!ContentBlocking.iconBox.hasAttribute("hasException"), "icon box shows no exception");
+  is(ContentBlocking.iconBox.getAttribute("tooltiptext"),
+     gNavigatorBundle.getString("trackingProtection.icon.activeTooltip"), "correct tooltip");
+
   ok(hidden("#tracking-action-block"), "blockButton is hidden");
 
-  ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
-  ok(!hidden("#tracking-action-unblock-private"), "unblockButtonPrivate is visible");
+  if (PrivateBrowsingUtils.isWindowPrivate(window)) {
+    ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
+    ok(!hidden("#tracking-action-unblock-private"), "unblockButtonPrivate is visible");
+  } else {
+    ok(!hidden("#tracking-action-unblock"), "unblockButton is visible");
+    ok(hidden("#tracking-action-unblock-private"), "unblockButtonPrivate is hidden");
+  }
 
-  // Make sure that the blocked tracking elements message appears
-  ok(hidden("#tracking-not-detected"), "labelNoTracking is hidden");
-  ok(hidden("#tracking-loaded"), "labelTrackingLoaded is hidden");
-  ok(hidden("#tracking-loaded-exception"), "labelTrackingLoadedException is hidden");
-  ok(!hidden("#tracking-blocked"), "labelTrackingBlocked is visible");
+  ok(hidden("#identity-popup-content-blocking-not-detected"), "blocking not detected label is hidden");
+  ok(!hidden("#identity-popup-content-blocking-detected"), "blocking detected label is visible");
+
+  ok(!hidden("#identity-popup-content-blocking-category-list"), "category list is visible");
+  ok(hidden("#identity-popup-content-blocking-category-tracking-protection > .identity-popup-content-blocking-category-add-blocking"),
+    "TP category item is not showing add blocking");
+  ok(!hidden("#identity-popup-content-blocking-category-tracking-protection > .identity-popup-content-blocking-category-state-label"),
+    "TP category item is set to blocked");
 }
 
 function testTrackingPageUnblocked() {
   info("Tracking content must be white-listed and not blocked");
-  ok(!TrackingProtection.container.hidden, "The container is visible");
-  is(TrackingProtection.content.getAttribute("state"), "loaded-tracking-content",
-     'content: state="loaded-tracking-content"');
-  is(TrackingProtection.iconBox.getAttribute("state"), "loaded-tracking-content",
-     'iconBox: state="loaded-tracking-content"');
+  ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected");
+  ok(ContentBlocking.content.hasAttribute("hasException"), "content shows exception");
 
-  ok(!hidden("#tracking-protection-icon-box"), "icon box is visible");
+  ok(ContentBlocking.iconBox.hasAttribute("active"), "shield is active");
+  ok(ContentBlocking.iconBox.hasAttribute("hasException"), "shield shows exception");
+  is(ContentBlocking.iconBox.getAttribute("tooltiptext"),
+     gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip"), "correct tooltip");
+
+  ok(BrowserTestUtils.is_visible(ContentBlocking.iconBox), "icon box is visible");
   ok(!hidden("#tracking-action-block"), "blockButton is visible");
   ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
+  ok(!hidden("#identity-popup-content-blocking-disabled-label"), "disabled label is visible");
 
-  // Make sure that the blocked tracking elements message appears
-  ok(hidden("#tracking-not-detected"), "labelNoTracking is hidden");
-  ok(!hidden("#tracking-loaded-exception"), "labelTrackingLoadedException is visible");
-  ok(hidden("#tracking-blocked"), "labelTrackingBlocked is hidden");
+  ok(hidden("#identity-popup-content-blocking-not-detected"), "blocking not detected label is hidden");
+  ok(!hidden("#identity-popup-content-blocking-detected"), "blocking detected label is visible");
+
+  ok(!hidden("#identity-popup-content-blocking-category-list"), "category list is visible");
+  ok(hidden("#identity-popup-content-blocking-category-tracking-protection > .identity-popup-content-blocking-category-add-blocking"),
+    "TP category item is not showing add blocking");
+  ok(hidden("#identity-popup-content-blocking-category-tracking-protection > .identity-popup-content-blocking-category-state-label"),
+    "TP category item is not set to blocked");
 }
 
 add_task(async function testExceptionAddition() {
   await UrlClassifierTestUtils.addTestTrackers();
-  let privateWin = await promiseOpenAndLoadWindow({private: true}, true);
+  let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
   browser = privateWin.gBrowser;
   let tab = await BrowserTestUtils.openNewForegroundTab({ gBrowser: browser, waitForLoad: true, waitForStateStop: true });
 
+  ContentBlocking = browser.ownerGlobal.ContentBlocking;
+  ok(ContentBlocking, "CB is attached to the private window");
   TrackingProtection = browser.ownerGlobal.TrackingProtection;
-  await pushPrefs([PB_PREF, true]);
+  ok(TrackingProtection, "TP is attached to the private window");
 
+  Services.prefs.setBoolPref(TP_PB_PREF, true);
   ok(TrackingProtection.enabled, "TP is enabled after setting the pref");
+  Services.prefs.setBoolPref(CB_PREF, true);
+  ok(TrackingProtection.enabled, "CB is enabled after setting the pref");
 
   info("Load a test page containing tracking elements");
   await promiseTabLoadEvent(tab, TRACKING_PAGE);
 
   testTrackingPage(tab.ownerGlobal);
 
   info("Disable TP for the page (which reloads the page)");
   let tabReloadPromise = promiseTabLoadEvent(tab);
   clickButton("#tracking-action-unblock");
-  is(identityPopupState(), "closed", "foobar");
+  is(identityPopupState(), "closed", "Identity popup is closed");
 
   await tabReloadPromise;
   testTrackingPageUnblocked();
 
   info("Test that the exception is remembered across tabs in the same private window");
   tab = browser.selectedTab = BrowserTestUtils.addTab(browser);
 
   info("Load a test page containing tracking elements");
   await promiseTabLoadEvent(tab, TRACKING_PAGE);
   testTrackingPageUnblocked();
 
-  await promiseWindowClosed(privateWin);
+  privateWin.close();
 });
 
 add_task(async function testExceptionPersistence() {
   info("Open another private browsing window");
-  let privateWin = await promiseOpenAndLoadWindow({private: true}, true);
+  let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
   browser = privateWin.gBrowser;
   let tab = await BrowserTestUtils.openNewForegroundTab({ gBrowser: browser, waitForLoad: true, waitForStateStop: true });
 
+  ContentBlocking = browser.ownerGlobal.ContentBlocking;
+  ok(ContentBlocking, "CB is attached to the private window");
   TrackingProtection = browser.ownerGlobal.TrackingProtection;
+  ok(TrackingProtection, "TP is attached to the private window");
+
+  ok(ContentBlocking.enabled, "CB is still enabled");
   ok(TrackingProtection.enabled, "TP is still enabled");
 
   info("Load a test page containing tracking elements");
   await promiseTabLoadEvent(tab, TRACKING_PAGE);
 
   testTrackingPage(tab.ownerGlobal);
 
   info("Disable TP for the page (which reloads the page)");
   let tabReloadPromise = promiseTabLoadEvent(tab);
   clickButton("#tracking-action-unblock");
-  is(identityPopupState(), "closed", "foobar");
+  is(identityPopupState(), "closed", "Identity popup is closed");
 
   await tabReloadPromise;
   testTrackingPageUnblocked();
 
   privateWin.close();
 });
deleted file mode 100644
--- a/browser/base/content/test/trackingUI/browser_trackingUI_reload_hint.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-const PREF = "privacy.trackingprotection.enabled";
-const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
-
-// TODO: replace this once bug 1428847 is done.
-function hidden(el) {
-  let win = el.ownerGlobal;
-  let display = win.getComputedStyle(el).getPropertyValue("display", null);
-  let opacity = win.getComputedStyle(el).getPropertyValue("opacity", null);
-  return display === "none" || opacity === "0";
-}
-
-add_task(async function setup() {
-  await UrlClassifierTestUtils.addTestTrackers();
-});
-
-// Tests that we show the reload hint if the user enables TP on
-// a site that has already loaded trackers before and that pressing
-// the reload button reloads the page.
-add_task(async function testReloadHint() {
-  Services.prefs.setBoolPref(PREF, false);
-
-  await BrowserTestUtils.withNewTab(TRACKING_PAGE, async function() {
-    let promisePanelOpen = BrowserTestUtils.waitForEvent(window.gIdentityHandler._identityPopup, "popupshown");
-    window.gIdentityHandler._identityBox.click();
-    await promisePanelOpen;
-
-    let blockButton = document.getElementById("tracking-action-block");
-    let reloadButton = document.getElementById("tracking-action-reload");
-    let trackingLoaded = document.getElementById("tracking-loaded");
-    let reloadHint = document.getElementById("tracking-reload-required");
-    ok(!hidden(trackingLoaded), "The tracking loaded info is shown.");
-    ok(hidden(blockButton), "The enable tracking protection button is not shown.");
-    ok(hidden(reloadButton), "The reload button is not shown.");
-    ok(hidden(reloadHint), "The reload hint is not shown.");
-
-    Services.prefs.setBoolPref(PREF, true);
-
-    ok(hidden(blockButton), "The enable tracking protection button is not shown.");
-    ok(hidden(trackingLoaded), "The tracking loaded info is not shown.");
-    ok(!hidden(reloadButton), "The reload button is shown.");
-    ok(!hidden(reloadHint), "The reload hint is shown.");
-
-    let reloaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, TRACKING_PAGE);
-    reloadButton.click();
-    await reloaded;
-  });
-
-  Services.prefs.clearUserPref(PREF);
-});
-
-// Tests that the reload hint does not appear on a non-tracking page.
-add_task(async function testReloadHint() {
-  Services.prefs.setBoolPref(PREF, false);
-
-  await BrowserTestUtils.withNewTab("https://example.com", async function() {
-    let promisePanelOpen = BrowserTestUtils.waitForEvent(window.gIdentityHandler._identityPopup, "popupshown");
-    window.gIdentityHandler._identityBox.click();
-    await promisePanelOpen;
-
-    let trackingNotDetected = document.getElementById("tracking-not-detected");
-    let reloadButton = document.getElementById("tracking-action-reload");
-    let reloadHint = document.getElementById("tracking-reload-required");
-    ok(!hidden(trackingNotDetected), "The tracking not detected info is shown.");
-    ok(hidden(reloadButton), "The reload button is not shown.");
-    ok(hidden(reloadHint), "The reload hint is not shown.");
-
-    Services.prefs.setBoolPref(PREF, true);
-
-    ok(!hidden(trackingNotDetected), "The tracking not detected info is shown.");
-    ok(hidden(reloadButton), "The reload button is not shown.");
-    ok(hidden(reloadHint), "The reload hint is not shown.");
-  });
-
-  Services.prefs.clearUserPref(PREF);
-});
-
-add_task(async function cleanup() {
-  UrlClassifierTestUtils.cleanupTestTrackers();
-});
--- a/browser/base/content/test/trackingUI/browser_trackingUI_state.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_state.js
@@ -9,31 +9,31 @@
  *     3) A page with tracking elements is loaded and they are not blocked.
  *   With TP disabled
  *     1) A page with no tracking elements is loaded.
  *     2) A page with tracking elements is loaded.
  *
  * See also Bugs 1175327, 1043801, 1178985
  */
 
-const PREF = "privacy.trackingprotection.enabled";
-const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
+const CB_PREF = "browser.contentblocking.enabled";
+const TP_PREF = "privacy.trackingprotection.enabled";
+const TP_PB_PREF = "privacy.trackingprotection.enabled";
 const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
 const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
+var ContentBlocking = null;
 var TrackingProtection = null;
 var tabbrowser = null;
 
 registerCleanupFunction(function() {
-  TrackingProtection = tabbrowser = null;
+  TrackingProtection = ContentBlocking = tabbrowser = null;
   UrlClassifierTestUtils.cleanupTestTrackers();
-  Services.prefs.clearUserPref(PREF);
-  Services.prefs.clearUserPref(PB_PREF);
-  while (gBrowser.tabs.length > 1) {
-    gBrowser.removeCurrentTab();
-  }
+  Services.prefs.clearUserPref(TP_PREF);
+  Services.prefs.clearUserPref(TP_PB_PREF);
+  Services.prefs.clearUserPref(CB_PREF);
 });
 
 // This is a special version of "hidden" that doesn't check for item
 // visibility and just asserts the display and opacity attributes.
 // That way we can test elements even when their panel is hidden...
 function hidden(sel) {
   let win = tabbrowser.ownerGlobal;
   let el = win.document.querySelector(sel);
@@ -45,122 +45,140 @@ function hidden(sel) {
 function clickButton(sel) {
   let win = tabbrowser.ownerGlobal;
   let el = win.document.querySelector(sel);
   el.doCommand();
 }
 
 function testBenignPage() {
   info("Non-tracking content must not be blocked");
-  ok(!TrackingProtection.container.hidden, "The container is visible");
-  ok(!TrackingProtection.content.hasAttribute("state"), "content: no state");
-  ok(!TrackingProtection.iconBox.hasAttribute("state"), "icon box: no state");
-  ok(!TrackingProtection.iconBox.hasAttribute("tooltiptext"), "icon box: no tooltip");
+  ok(!ContentBlocking.content.hasAttribute("detected"), "no trackers are detected");
+  ok(!ContentBlocking.content.hasAttribute("hasException"), "content shows no exception");
 
-  let doc = tabbrowser.ownerGlobal.document;
-  ok(BrowserTestUtils.is_hidden(doc.getElementById("tracking-protection-icon-box")), "icon box is hidden");
+  ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
+  ok(!ContentBlocking.iconBox.hasAttribute("hasException"), "icon box shows no exception");
+  ok(!ContentBlocking.iconBox.hasAttribute("tooltiptext"), "icon box has no tooltip");
+
+  ok(BrowserTestUtils.is_hidden(ContentBlocking.iconBox), "icon box is hidden");
   ok(hidden("#tracking-action-block"), "blockButton is hidden");
   ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
-  ok(!hidden("#tracking-protection-preferences-button"), "preferences button is visible");
+  is(!hidden("#identity-popup-content-blocking-disabled-label"), !ContentBlocking.enabled,
+    "disabled label is visible if CB is off");
 
-  // Make sure that the no tracking elements message appears
-  ok(!hidden("#tracking-not-detected"), "labelNoTracking is visible");
-  ok(hidden("#tracking-loaded"), "labelTrackingLoaded is hidden");
-  ok(hidden("#tracking-blocked"), "labelTrackingBlocked is hidden");
+  ok(!hidden("#identity-popup-content-blocking-not-detected"), "blocking not detected label is visible");
+  ok(hidden("#identity-popup-content-blocking-detected"), "blocking detected label is hidden");
+
+  ok(hidden("#identity-popup-content-blocking-category-list"), "category list is hidden");
 }
 
 function testBenignPageWithException() {
   info("Non-tracking content must not be blocked");
-  ok(!TrackingProtection.container.hidden, "The container is visible");
-  ok(!TrackingProtection.content.hasAttribute("state"), "content: no state");
-  ok(TrackingProtection.content.hasAttribute("hasException"), "content has exception attribute");
-  ok(TrackingProtection.iconBox.hasAttribute("hasException"), "icon box has exception attribute");
-  ok(!TrackingProtection.iconBox.hasAttribute("state"), "icon box: no state");
-  ok(!TrackingProtection.iconBox.hasAttribute("tooltiptext"), "icon box: no tooltip");
+  ok(!ContentBlocking.content.hasAttribute("detected"), "no trackers are detected");
+  ok(ContentBlocking.content.hasAttribute("hasException"), "content shows exception");
+
+  ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
+  is(ContentBlocking.iconBox.hasAttribute("hasException"), ContentBlocking.enabled,
+    "shield shows exception if CB is on");
+  is(ContentBlocking.iconBox.getAttribute("tooltiptext"),
+     gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip"), "correct tooltip");
 
-  let doc = tabbrowser.ownerGlobal.document;
-  ok(BrowserTestUtils.is_hidden(doc.getElementById("tracking-protection-icon-box")), "icon box is hidden");
-  is(!hidden("#tracking-action-block"), TrackingProtection.enabled,
-     "blockButton is visible if TP is on");
+  is(!BrowserTestUtils.is_hidden(ContentBlocking.iconBox), ContentBlocking.enabled,
+    "icon box is not hidden if CB is on");
+  is(!hidden("#tracking-action-block"), ContentBlocking.enabled,
+     "blockButton is visible if CB is on");
   ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
-  ok(!hidden("#tracking-protection-preferences-button"), "preferences button is visible");
+  ok(!hidden("#identity-popup-content-blocking-disabled-label"), "disabled label is visible");
 
-  is(!hidden("#tracking-not-detected-exception"), TrackingProtection.enabled,
-     "labelNoTrackingException is visible if TP is on");
-  is(hidden("#tracking-not-detected"), TrackingProtection.enabled,
-     "labelNoTracking is visible if TP is off");
-  ok(hidden("#tracking-loaded"), "labelTrackingLoaded is hidden");
-  ok(hidden("#tracking-blocked"), "labelTrackingBlocked is hidden");
+  ok(!hidden("#identity-popup-content-blocking-not-detected"), "blocking not detected label is visible");
+  ok(hidden("#identity-popup-content-blocking-detected"), "blocking detected label is hidden");
+
+  ok(hidden("#identity-popup-content-blocking-category-list"), "category list is hidden");
 }
 
 function testTrackingPage(window) {
   info("Tracking content must be blocked");
-  ok(!TrackingProtection.container.hidden, "The container is visible");
-  is(TrackingProtection.content.getAttribute("state"), "blocked-tracking-content",
-      'content: state="blocked-tracking-content"');
-  is(TrackingProtection.iconBox.getAttribute("state"), "blocked-tracking-content",
-      'icon box: state="blocked-tracking-content"');
-  is(TrackingProtection.iconBox.getAttribute("tooltiptext"),
+  ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected");
+  ok(!ContentBlocking.content.hasAttribute("hasException"), "content shows no exception");
+
+  ok(BrowserTestUtils.is_visible(ContentBlocking.iconBox), "icon box is visible");
+  ok(ContentBlocking.iconBox.hasAttribute("active"), "shield is active");
+  ok(!ContentBlocking.iconBox.hasAttribute("hasException"), "icon box shows no exception");
+  is(ContentBlocking.iconBox.getAttribute("tooltiptext"),
      gNavigatorBundle.getString("trackingProtection.icon.activeTooltip"), "correct tooltip");
-  ok(!TrackingProtection.content.hasAttribute("hasException"), "content has no exception attribute");
-  ok(!TrackingProtection.iconBox.hasAttribute("hasException"), "icon box has no exception attribute");
 
-  let doc = tabbrowser.ownerGlobal.document;
-  ok(BrowserTestUtils.is_visible(doc.getElementById("tracking-protection-icon-box")), "icon box is visible");
   ok(hidden("#tracking-action-block"), "blockButton is hidden");
-  ok(!hidden("#tracking-protection-preferences-button"), "preferences button is visible");
-
 
   if (PrivateBrowsingUtils.isWindowPrivate(window)) {
     ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
     ok(!hidden("#tracking-action-unblock-private"), "unblockButtonPrivate is visible");
   } else {
     ok(!hidden("#tracking-action-unblock"), "unblockButton is visible");
     ok(hidden("#tracking-action-unblock-private"), "unblockButtonPrivate is hidden");
   }
 
-  // Make sure that the blocked tracking elements message appears
-  ok(hidden("#tracking-not-detected"), "labelNoTracking is hidden");
-  ok(hidden("#tracking-loaded"), "labelTrackingLoaded is hidden");
-  ok(hidden("#tracking-loaded-exception"), "labelTrackingLoadedException is hidden");
-  ok(!hidden("#tracking-blocked"), "labelTrackingBlocked is visible");
+  ok(hidden("#identity-popup-content-blocking-not-detected"), "blocking not detected label is hidden");
+  ok(!hidden("#identity-popup-content-blocking-detected"), "blocking detected label is visible");
+
+  ok(!hidden("#identity-popup-content-blocking-category-list"), "category list is visible");
+  ok(hidden("#identity-popup-content-blocking-category-tracking-protection > .identity-popup-content-blocking-category-add-blocking"),
+    "TP category item is not showing add blocking");
+  ok(!hidden("#identity-popup-content-blocking-category-tracking-protection > .identity-popup-content-blocking-category-state-label"),
+    "TP category item is set to blocked");
 }
 
 function testTrackingPageUnblocked() {
   info("Tracking content must be white-listed and not blocked");
-  is(TrackingProtection.content.hasAttribute("hasException"), TrackingProtection.enabled,
-    "content has exception attribute if TP is on");
-  is(TrackingProtection.iconBox.hasAttribute("hasException"), TrackingProtection.enabled,
-    "icon box has exception attribute if TP is on");
-  ok(!TrackingProtection.container.hidden, "The container is visible");
-  is(TrackingProtection.content.getAttribute("state"), "loaded-tracking-content",
-      'content: state="loaded-tracking-content"');
-  if (TrackingProtection.enabled) {
-    is(TrackingProtection.iconBox.getAttribute("state"), "loaded-tracking-content",
-        'icon box: state="loaded-tracking-content"');
-    is(TrackingProtection.iconBox.getAttribute("tooltiptext"),
-       gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip"), "correct tooltip");
-  }
+  ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected");
+  ok(ContentBlocking.content.hasAttribute("hasException"), "content shows exception");
+
+  ok(ContentBlocking.iconBox.hasAttribute("active"), "shield is active");
+  ok(ContentBlocking.iconBox.hasAttribute("hasException"), "shield shows exception");
+  is(ContentBlocking.iconBox.getAttribute("tooltiptext"),
+     gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip"), "correct tooltip");
 
-  let doc = tabbrowser.ownerGlobal.document;
-  is(BrowserTestUtils.is_visible(doc.getElementById("tracking-protection-icon-box")), TrackingProtection.enabled, "icon box is visible if TP is on");
-  is(!hidden("#tracking-action-block"), TrackingProtection.enabled, "blockButton is visible if TP is on");
+  ok(BrowserTestUtils.is_visible(ContentBlocking.iconBox), "icon box is visible");
+  ok(!hidden("#tracking-action-block"), "blockButton is visible");
   ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
-  ok(!hidden("#tracking-protection-preferences-button"), "preferences button is visible");
+  ok(!hidden("#identity-popup-content-blocking-disabled-label"), "disabled label is visible");
 
-  // Make sure that the blocked tracking elements message appears
-  ok(hidden("#tracking-not-detected"), "labelNoTracking is hidden");
-  is(hidden("#tracking-loaded"), TrackingProtection.enabled,
-     "labelTrackingLoaded is visible if TP is off");
-  is(!hidden("#tracking-loaded-exception"), TrackingProtection.enabled,
-     "labelTrackingLoadedException is visible if TP is on");
-  ok(hidden("#tracking-blocked"), "labelTrackingBlocked is hidden");
+  ok(hidden("#identity-popup-content-blocking-not-detected"), "blocking not detected label is hidden");
+  ok(!hidden("#identity-popup-content-blocking-detected"), "blocking detected label is visible");
+
+  ok(!hidden("#identity-popup-content-blocking-category-list"), "category list is visible");
+  ok(hidden("#identity-popup-content-blocking-category-tracking-protection > .identity-popup-content-blocking-category-add-blocking"),
+    "TP category item is not showing add blocking");
+  ok(hidden("#identity-popup-content-blocking-category-tracking-protection > .identity-popup-content-blocking-category-state-label"),
+    "TP category item is not set to blocked");
 }
 
-async function testTrackingProtectionEnabled(tab) {
+function testTrackingPageWithCBDisabled() {
+  info("Tracking content must be white-listed and not blocked");
+  ok(ContentBlocking.content.hasAttribute("detected"), "trackers are detected");
+  ok(!ContentBlocking.content.hasAttribute("hasException"), "content shows no exception");
+
+  ok(!ContentBlocking.iconBox.hasAttribute("active"), "shield is not active");
+  ok(!ContentBlocking.iconBox.hasAttribute("hasException"), "shield shows no exception");
+  ok(!ContentBlocking.iconBox.getAttribute("tooltiptext"), "icon box has no tooltip");
+
+  ok(BrowserTestUtils.is_hidden(ContentBlocking.iconBox), "icon box is hidden");
+  ok(hidden("#tracking-action-block"), "blockButton is hidden");
+  ok(hidden("#tracking-action-unblock"), "unblockButton is hidden");
+  ok(!hidden("#identity-popup-content-blocking-disabled-label"), "disabled label is visible");
+
+  ok(hidden("#identity-popup-content-blocking-not-detected"), "blocking not detected label is hidden");
+  ok(!hidden("#identity-popup-content-blocking-detected"), "blocking detected label is visible");
+
+  ok(!hidden("#identity-popup-content-blocking-category-list"), "category list is visible");
+  ok(!hidden("#identity-popup-content-blocking-category-tracking-protection > .identity-popup-content-blocking-category-add-blocking"),
+    "TP category item is showing add blocking");
+  ok(hidden("#identity-popup-content-blocking-category-tracking-protection > .identity-popup-content-blocking-category-state-label"),
+    "TP category item is not set to blocked");
+}
+
+async function testContentBlockingEnabled(tab) {
   info("Testing with Tracking Protection ENABLED.");
 
   info("Load a test page not containing tracking elements");
   await promiseTabLoadEvent(tab, BENIGN_PAGE);
   testBenignPage();
 
   info("Load a test page not containing tracking elements which has an exception.");
   let isPrivateBrowsing = PrivateBrowsingUtils.isWindowPrivate(tab.ownerGlobal);
@@ -179,30 +197,30 @@ async function testTrackingProtectionEna
   } else {
     Services.perms.remove(uri, "trackingprotection");
   }
 
   info("Load a test page containing tracking elements");
   await promiseTabLoadEvent(tab, TRACKING_PAGE);
   testTrackingPage(tab.ownerGlobal);
 
-  info("Disable TP for the page (which reloads the page)");
+  info("Disable CB for the page (which reloads the page)");
   let tabReloadPromise = promiseTabLoadEvent(tab);
   clickButton("#tracking-action-unblock");
   await tabReloadPromise;
   testTrackingPageUnblocked();
 
   info("Re-enable TP for the page (which reloads the page)");
   tabReloadPromise = promiseTabLoadEvent(tab);
   clickButton("#tracking-action-block");
   await tabReloadPromise;
   testTrackingPage(tab.ownerGlobal);
 }
 
-async function testTrackingProtectionDisabled(tab) {
+async function testContentBlockingDisabled(tab) {
   info("Testing with Tracking Protection DISABLED.");
 
   info("Load a test page not containing tracking elements");
   await promiseTabLoadEvent(tab, BENIGN_PAGE);
   testBenignPage();
 
   info("Load a test page not containing tracking elements which has an exception.");
   let isPrivateBrowsing = PrivateBrowsingUtils.isWindowPrivate(tab.ownerGlobal);
@@ -219,55 +237,65 @@ async function testTrackingProtectionDis
   if (isPrivateBrowsing) {
     PrivateBrowsingUtils.removeFromTrackingAllowlist(uri);
   } else {
     Services.perms.remove(uri, "trackingprotection");
   }
 
   info("Load a test page containing tracking elements");
   await promiseTabLoadEvent(tab, TRACKING_PAGE);
-  testTrackingPageUnblocked();
+  testTrackingPageWithCBDisabled();
 }
 
 add_task(async function testNormalBrowsing() {
   await UrlClassifierTestUtils.addTestTrackers();
 
   tabbrowser = gBrowser;
   let tab = tabbrowser.selectedTab = BrowserTestUtils.addTab(tabbrowser);
 
+  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(PREF),
+  is(TrackingProtection.enabled, Services.prefs.getBoolPref(TP_PREF),
      "TP.enabled is based on the original pref value");
 
-  Services.prefs.setBoolPref(PREF, true);
+  Services.prefs.setBoolPref(TP_PREF, true);
   ok(TrackingProtection.enabled, "TP is enabled after setting the pref");
+  Services.prefs.setBoolPref(CB_PREF, true);
+  ok(ContentBlocking.enabled, "CB is enabled after setting the pref");
 
-  await testTrackingProtectionEnabled(tab);
+  await testContentBlockingEnabled(tab);
 
-  Services.prefs.setBoolPref(PREF, false);
-  ok(!TrackingProtection.enabled, "TP is disabled after setting the pref");
+  Services.prefs.setBoolPref(CB_PREF, false);
+  ok(!ContentBlocking.enabled, "CB is disabled after setting the pref");
 
-  await testTrackingProtectionDisabled(tab);
+  await testContentBlockingDisabled(tab);
+
+  gBrowser.removeCurrentTab();
 });
 
 add_task(async function testPrivateBrowsing() {
   let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
   tabbrowser = privateWin.gBrowser;
   let tab = tabbrowser.selectedTab = BrowserTestUtils.addTab(tabbrowser);
 
+  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(PB_PREF),
+  is(TrackingProtection.enabled, Services.prefs.getBoolPref(TP_PB_PREF),
      "TP.enabled is based on the pb pref value");
 
-  Services.prefs.setBoolPref(PB_PREF, true);
+  Services.prefs.setBoolPref(TP_PB_PREF, true);
   ok(TrackingProtection.enabled, "TP is enabled after setting the pref");
-
-  await testTrackingProtectionEnabled(tab);
+  Services.prefs.setBoolPref(CB_PREF, true);
+  ok(TrackingProtection.enabled, "CB is enabled after setting the pref");
 
-  Services.prefs.setBoolPref(PB_PREF, false);
-  ok(!TrackingProtection.enabled, "TP is disabled after setting the pref");
+  await testContentBlockingEnabled(tab);
 
-  await testTrackingProtectionDisabled(tab);
+  Services.prefs.setBoolPref(CB_PREF, false);
+  ok(!ContentBlocking.enabled, "CB is disabled after setting the pref");
+
+  await testContentBlockingDisabled(tab);
 
   privateWin.close();
 });
rename from browser/base/content/test/general/browser_trackingUI_telemetry.js
rename to browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js
--- a/browser/base/content/test/general/browser_trackingUI_telemetry.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js
@@ -1,16 +1,15 @@
 /*
  * Test telemetry for Tracking Protection
  */
 
 const PREF = "privacy.trackingprotection.enabled";
-const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
-const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
-const {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
+const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
+const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
 
 /**
  * Enable local telemetry recording for the duration of the tests.
  */
 var oldCanRecord = Services.telemetry.canRecordExtended;
 Services.telemetry.canRecordExtended = true;
 Services.prefs.setBoolPref(PREF, false);
 Services.telemetry.getHistogramById("TRACKING_PROTECTION_ENABLED").clear();
@@ -47,29 +46,29 @@ function getEventCounts() {
 add_task(async function setup() {
   await UrlClassifierTestUtils.addTestTrackers();
 
   let TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
   ok(TrackingProtection, "TP is attached to the browser window");
   ok(!TrackingProtection.enabled, "TP is not enabled");
 
   // Open a window with TP disabled to make sure 'enabled' is logged correctly.
-  let newWin = await promiseOpenAndLoadWindow({}, true);
-  await promiseWindowClosed(newWin);
+  let newWin = await BrowserTestUtils.openNewBrowserWindow({});
+  newWin.close();
 
   is(getEnabledCounts()[0], 1, "TP was disabled once on start up");
   is(getEnabledCounts()[1], 0, "TP was not enabled on start up");
 
   // Enable TP so the next browser to open will log 'enabled'
   Services.prefs.setBoolPref(PREF, true);
 });
 
 
 add_task(async function testNewWindow() {
-  let newWin = await promiseOpenAndLoadWindow({}, true);
+  let newWin = await BrowserTestUtils.openNewBrowserWindow({});
   let tab = await BrowserTestUtils.openNewForegroundTab(newWin.gBrowser);
   let TrackingProtection = newWin.TrackingProtection;
   ok(TrackingProtection, "TP is attached to the browser window");
 
   is(getEnabledCounts()[0], 1, "TP was disabled once on start up");
   is(getEnabledCounts()[1], 1, "TP was enabled once on start up");
 
   // Reset these to make counting easier
@@ -106,26 +105,26 @@ add_task(async function testNewWindow() 
   tabReloadPromise = promiseTabLoadEvent(tab);
   newWin.document.querySelector("#tracking-action-block").doCommand();
   await tabReloadPromise;
   todo_is(getEventCounts()[0], 4, "FIXME: TOTAL PAGE LOADS IS DOUBLE COUNTING");
   is(getEventCounts()[1], 1, "Disable actions");
   is(getEventCounts()[2], 1, "Enable actions");
   todo_is(getShieldCounts()[0], 1, "FIXME: TOTAL PAGE LOADS WITHOUT TRACKING IS DOUBLE COUNTING");
 
-  await promiseWindowClosed(newWin);
+  newWin.close();
 
   // Reset these to make counting easier for the next test
   getEventsHistogram().clear();
   getShieldHistogram().clear();
   getEnabledHistogram().clear();
 });
 
 add_task(async function testPrivateBrowsing() {
-  let privateWin = await promiseOpenAndLoadWindow({private: true}, true);
+  let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
   let tab = await BrowserTestUtils.openNewForegroundTab(privateWin.gBrowser);
   let TrackingProtection = privateWin.TrackingProtection;
   ok(TrackingProtection, "TP is attached to the browser window");
 
   // Do a bunch of actions and make sure that no telemetry data is gathered
   await promiseTabLoadEvent(tab, BENIGN_PAGE);
   await promiseTabLoadEvent(tab, TRACKING_PAGE);
   let tabReloadPromise = promiseTabLoadEvent(tab);
@@ -135,10 +134,10 @@ add_task(async function testPrivateBrows
   privateWin.document.querySelector("#tracking-action-block").doCommand();
   await tabReloadPromise;
 
   // Sum up all the counts to make sure that nothing got logged
   is(getEnabledCounts().reduce((p, c) => p + c), 0, "Telemetry logging off in PB mode");
   is(getEventCounts().reduce((p, c) => p + c), 0, "Telemetry logging off in PB mode");
   is(getShieldCounts().reduce((p, c) => p + c), 0, "Telemetry logging off in PB mode");
 
-  await promiseWindowClosed(privateWin);
+  privateWin.close();
 });
rename from browser/base/content/test/general/file_trackingUI_6.html
rename to browser/base/content/test/trackingUI/file_trackingUI_fetch.html
--- a/browser/base/content/test/general/file_trackingUI_6.html
+++ b/browser/base/content/test/trackingUI/file_trackingUI_fetch.html
@@ -3,14 +3,14 @@
 <head>
   <meta charset="UTF-8">
   <title>Testing the shield from fetch and XHR</title>
 </head>
 <body>
   <p>Hello there!</p>
   <script type="application/javascript">
     function test_fetch() {
-      let url = "http://trackertest.org/browser/browser/base/content/test/general/file_trackingUI_6.js";
+      let url = "http://trackertest.org/browser/browser/base/content/test/trackingUI/file_trackingUI_fetch.js";
       return fetch(url);
     }
   </script>
 </body>
 </html>
rename from browser/base/content/test/general/file_trackingUI_6.js
rename to browser/base/content/test/trackingUI/file_trackingUI_fetch.js
rename from browser/base/content/test/general/file_trackingUI_6.js^headers^
rename to browser/base/content/test/trackingUI/file_trackingUI_fetch.js^headers^
rename from browser/base/content/test/general/trackingPage.html
rename to browser/base/content/test/trackingUI/trackingPage.html
--- a/browser/components/uitour/test/browser.ini
+++ b/browser/components/uitour/test/browser.ini
@@ -13,18 +13,18 @@ skip-if = debug || asan # updateUI leaks
 [browser_no_tabs.js]
 [browser_openPreferences.js]
 [browser_openSearchPanel.js]
 skip-if = true # Bug 1113038 - Intermittent "Popup was opened"
 [browser_trackingProtection.js]
 skip-if = os == "linux" # Intermittent NS_ERROR_NOT_AVAILABLE [nsIUrlClassifierDBService.beginUpdate]
 tag = trackingprotection
 support-files =
-  !/browser/base/content/test/general/benignPage.html
-  !/browser/base/content/test/general/trackingPage.html
+  !/browser/base/content/test/trackingUI/benignPage.html
+  !/browser/base/content/test/trackingUI/trackingPage.html
 [browser_trackingProtection_tour.js]
 tag = trackingprotection
 [browser_showMenu.js]
 tag = trackingprotection
 [browser_UITour.js]
 skip-if = os == "linux" || verify # Intermittent failures, bug 951965
 [browser_UITour2.js]
 [browser_UITour3.js]
--- a/browser/components/uitour/test/browser_trackingProtection.js
+++ b/browser/components/uitour/test/browser_trackingProtection.js
@@ -1,30 +1,33 @@
 "use strict";
 
 const PREF_INTRO_COUNT = "privacy.trackingprotection.introCount";
+const PREF_CB_ENABLED = "browser.contentblocking.enabled";
 const PREF_TP_ENABLED = "privacy.trackingprotection.enabled";
-const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
-const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
+const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
+const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
 const TOOLTIP_PANEL = document.getElementById("UITourTooltip");
 const TOOLTIP_ANCHOR = document.getElementById("tracking-protection-icon-animatable-box");
 
 var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
 
 registerCleanupFunction(function() {
   UrlClassifierTestUtils.cleanupTestTrackers();
+  Services.prefs.clearUserPref(PREF_CB_ENABLED);
   Services.prefs.clearUserPref(PREF_TP_ENABLED);
   Services.prefs.clearUserPref(PREF_INTRO_COUNT);
 });
 
 function allowOneIntro() {
-  Services.prefs.setIntPref(PREF_INTRO_COUNT, TrackingProtection.MAX_INTROS - 1);
+  Services.prefs.setIntPref(PREF_INTRO_COUNT, window.ContentBlocking.MAX_INTROS - 1);
 }
 
 add_task(async function setup_test() {
+  Services.prefs.setBoolPref(PREF_CB_ENABLED, true);
   Services.prefs.setBoolPref(PREF_TP_ENABLED, true);
   await UrlClassifierTestUtils.addTestTrackers();
 });
 
 add_task(async function test_benignPage() {
   info("Load a test page not containing tracking elements");
   allowOneIntro();
   await BrowserTestUtils.withNewTab({gBrowser, url: BENIGN_PAGE}, async function() {
@@ -43,17 +46,17 @@ add_task(async function test_trackingPag
   info("Load a test page containing tracking elements");
   allowOneIntro();
   await BrowserTestUtils.withNewTab({gBrowser, url: TRACKING_PAGE}, async function() {
     await new Promise((resolve, reject) => {
       waitForPopupAtAnchor(TOOLTIP_PANEL, TOOLTIP_ANCHOR, resolve,
                            "Intro panel should appear");
     });
 
-    is(Services.prefs.getIntPref(PREF_INTRO_COUNT), TrackingProtection.MAX_INTROS, "Check intro count increased");
+    is(Services.prefs.getIntPref(PREF_INTRO_COUNT), window.ContentBlocking.MAX_INTROS, "Check intro count increased");
 
     let step2URL = Services.urlFormatter.formatURLPref("privacy.trackingprotection.introURL") +
                    "?step=2&newtab=true";
     let buttons = document.getElementById("UITourTooltipButtons");
 
     info("Click the step text and nothing should happen");
     let tabCount = gBrowser.tabs.length;
     await EventUtils.synthesizeMouseAtCenter(buttons.children[0], {});
@@ -62,17 +65,17 @@ add_task(async function test_trackingPag
     info("Resetting count to test that viewing the tour prevents future panels");
     allowOneIntro();
 
     let panelHiddenPromise = promisePanelElementHidden(window, TOOLTIP_PANEL);
     let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, step2URL);
     info("Clicking the main button");
     EventUtils.synthesizeMouseAtCenter(buttons.children[1], {});
     let tab = await tabPromise;
-    is(Services.prefs.getIntPref(PREF_INTRO_COUNT), TrackingProtection.MAX_INTROS,
+    is(Services.prefs.getIntPref(PREF_INTRO_COUNT), window.ContentBlocking.MAX_INTROS,
        "Check intro count is at the max after opening step 2");
     is(gBrowser.tabs.length, tabCount + 1, "Tour step 2 tab opened");
     await panelHiddenPromise;
     ok(true, "Panel hid when the button was clicked");
     BrowserTestUtils.removeTab(tab);
   });
 
   info("Open another tracking page and make sure we don't show the panel again");
--- a/browser/components/uitour/test/browser_trackingProtection_tour.js
+++ b/browser/components/uitour/test/browser_trackingProtection_tour.js
@@ -24,22 +24,22 @@ add_UITour_task(async function test_unbl
   await checkToggleTarget("controlCenter-trackingUnblock");
 });
 
 add_UITour_task(function setup_block_target() {
   // Preparation for test_block_target. These are separate since the reload
   // interferes with UITour as it does a teardown. All we really care about
   // is the permission manager entry but UITour tests shouldn't rely on that
   // implementation detail.
-  TrackingProtection.disableForCurrentPage();
+  window.ContentBlocking.disableForCurrentPage();
 });
 
 add_UITour_task(async function test_block_target() {
   await checkToggleTarget("controlCenter-trackingBlock");
-  TrackingProtection.enableForCurrentPage();
+  window.ContentBlocking.enableForCurrentPage();
 });
 
 
 async function checkToggleTarget(targetID) {
   let popup = document.getElementById("UITourTooltip");
 
   let trackerOpened = new Promise(function(resolve, reject) {
     Services.obs.addObserver(function onopen(subject) {