Bug 1451307 - Part 2 - Move trackingUI tests out of b/b/c/test/general into their own subdirectory. r=Gijs
☠☠ backed out by 76f35d0ecaa6 ☠ ☠
authorJohann Hofmann <jhofmann@mozilla.com>
Thu, 19 Apr 2018 17:22:11 +0200
changeset 469062 13e58d5887d8b8dae297577abe1d15edf254cd44
parent 469061 7f89d94d45bad5bb387568d935e8dff69312fd7b
child 469063 be0a9b78c2242fcc4eb2545d7fe5b58fecd250e7
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1451307
milestone61.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 1451307 - Part 2 - Move trackingUI tests out of b/b/c/test/general into their own subdirectory. r=Gijs MozReview-Commit-ID: 5e2Hwt9jcX5
browser/base/content/moz.build
browser/base/content/test/general/benignPage.html
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_trackingUI_1.js
browser/base/content/test/general/browser_trackingUI_2.js
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/.eslintrc.js
browser/base/content/test/trackingUI/benignPage.html
browser/base/content/test/trackingUI/browser.ini
browser/base/content/test/trackingUI/browser_trackingUI_1.js
browser/base/content/test/trackingUI/browser_trackingUI_2.js
browser/base/content/test/trackingUI/browser_trackingUI_3.js
browser/base/content/test/trackingUI/browser_trackingUI_4.js
browser/base/content/test/trackingUI/browser_trackingUI_5.js
browser/base/content/test/trackingUI/browser_trackingUI_6.js
browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js
browser/base/content/test/trackingUI/file_trackingUI_6.html
browser/base/content/test/trackingUI/file_trackingUI_6.js
browser/base/content/test/trackingUI/file_trackingUI_6.js^headers^
browser/base/content/test/trackingUI/head.js
browser/base/content/test/trackingUI/trackingPage.html
browser/base/moz.build
browser/components/uitour/test/browser.ini
browser/components/uitour/test/browser_trackingProtection.js
--- a/browser/base/content/moz.build
+++ b/browser/base/content/moz.build
@@ -84,16 +84,19 @@ with Files("test/tabcrashed/**"):
     BUG_COMPONENT = ("Firefox", "Tabbed Browser")
 
 with Files("test/tabs/**"):
     BUG_COMPONENT = ("Firefox", "Tabbed Browser")
 
 with Files("test/touch/**"):
     BUG_COMPONENT = ("Firefox", "General")
 
+with Files("test/trackingUI/**"):
+    BUG_COMPONENT = ("Firefox", "Tracking Protection")
+
 with Files("test/urlbar/**"):
     BUG_COMPONENT = ("Firefox", "Address Bar")
 
 with Files("test/webextensions/**"):
     BUG_COMPONENT = ("Toolkit", "WebExtensions: Untriaged")
 
 with Files("test/webrtc/**"):
     BUG_COMPONENT = ("Core", "WebRTC")
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -455,54 +455,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_1.js]
-tags = trackingprotection
-support-files =
-  trackingPage.html
-  benignPage.html
-# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
-[browser_trackingUI_2.js]
-tags = trackingprotection
-support-files =
-  trackingPage.html
-  benignPage.html
-# 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_utilityOverlay.js]
 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/trackingUI/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "plugin:mozilla/browser-test"
+  ]
+};
rename from browser/base/content/test/general/benignPage.html
rename to browser/base/content/test/trackingUI/benignPage.html
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/trackingUI/browser.ini
@@ -0,0 +1,18 @@
+[DEFAULT]
+tags = trackingprotection
+support-files =
+  head.js
+  trackingPage.html
+  benignPage.html
+
+[browser_trackingUI_1.js]
+[browser_trackingUI_2.js]
+[browser_trackingUI_3.js]
+[browser_trackingUI_4.js]
+[browser_trackingUI_5.js]
+[browser_trackingUI_6.js]
+support-files =
+  file_trackingUI_6.html
+  file_trackingUI_6.js
+  file_trackingUI_6.js^headers^
+[browser_trackingUI_telemetry.js]
rename from browser/base/content/test/general/browser_trackingUI_1.js
rename to browser/base/content/test/trackingUI/browser_trackingUI_1.js
--- a/browser/base/content/test/general/browser_trackingUI_1.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_1.js
@@ -2,25 +2,19 @@
  * Test that the Tracking Protection section is visible in the Control Center
  * and has the correct state for the cases when:
  *   1) A page with no tracking elements is loaded.
  *   2) A page with tracking elements is loaded and they are blocked.
  *   3) A page with tracking elements is loaded and they are not blocked.
  * See also Bugs 1175327, 1043801, 1178985
  */
 
-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", {});
-
 registerCleanupFunction(function() {
   TrackingProtection = tabbrowser = null;
   UrlClassifierTestUtils.cleanupTestTrackers();
   Services.prefs.clearUserPref(PREF);
   Services.prefs.clearUserPref(PB_PREF);
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
rename from browser/base/content/test/general/browser_trackingUI_2.js
rename to browser/base/content/test/trackingUI/browser_trackingUI_2.js
--- a/browser/base/content/test/general/browser_trackingUI_2.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_2.js
@@ -1,23 +1,17 @@
 /*
  * Test that the Tracking Protection section is never visible in the
  * Control Center when the feature is off.
  * See also Bugs 1175327, 1043801, 1178985.
  */
 
-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", {});
-
 registerCleanupFunction(function() {
   TrackingProtection = tabbrowser = null;
   UrlClassifierTestUtils.cleanupTestTrackers();
   Services.prefs.clearUserPref(PREF);
   Services.prefs.clearUserPref(PB_PREF);
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
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
@@ -1,19 +1,16 @@
 /*
  * Test that the Tracking Protection is correctly enabled / disabled
  * in both normal and private windows given all possible states of the prefs:
  *   privacy.trackingprotection.enabled
  *   privacy.trackingprotection.pbmode.enabled
  * See also Bug 1178985.
  */
 
-const PREF = "privacy.trackingprotection.enabled";
-const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
-
 registerCleanupFunction(function() {
   Services.prefs.clearUserPref(PREF);
   Services.prefs.clearUserPref(PB_PREF);
 });
 
 add_task(async function testNormalBrowsing() {
   let TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
   ok(TrackingProtection, "TP is attached to the browser window");
rename from browser/base/content/test/general/browser_trackingUI_4.js
rename to browser/base/content/test/trackingUI/browser_trackingUI_4.js
--- a/browser/base/content/test/general/browser_trackingUI_4.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_4.js
@@ -1,23 +1,17 @@
 /*
  * Test that the Tracking Protection 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", {});
-
 registerCleanupFunction(function() {
   TrackingProtection = tabbrowser = null;
   UrlClassifierTestUtils.cleanupTestTrackers();
   Services.prefs.clearUserPref(PREF);
   Services.prefs.clearUserPref(PB_PREF);
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
   }
rename from browser/base/content/test/general/browser_trackingUI_5.js
rename to browser/base/content/test/trackingUI/browser_trackingUI_5.js
--- a/browser/base/content/test/general/browser_trackingUI_5.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_5.js
@@ -1,19 +1,16 @@
 /* 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";
 var TrackingProtection = null;
 var browser = null;
-var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
 
 registerCleanupFunction(function() {
   TrackingProtection = browser = null;
   UrlClassifierTestUtils.cleanupTestTrackers();
 });
 
 function hidden(sel) {
   let win = browser.ownerGlobal;
@@ -73,17 +70,17 @@ function testTrackingPageUnblocked() {
 
 add_task(async function testExceptionAddition() {
   await UrlClassifierTestUtils.addTestTrackers();
   let privateWin = await promiseOpenAndLoadWindow({private: true}, true);
   browser = privateWin.gBrowser;
   let tab = await BrowserTestUtils.openNewForegroundTab({ gBrowser: browser, waitForLoad: true, waitForStateStop: true });
 
   TrackingProtection = browser.ownerGlobal.TrackingProtection;
-  await pushPrefs([PB_PREF, true]);
+  await SpecialPowers.pushPrefEnv({"set": [[PB_PREF, true]]});
 
   ok(TrackingProtection.enabled, "TP is enabled after setting the pref");
 
   info("Load a test page containing tracking elements");
   await promiseTabLoadEvent(tab, TRACKING_PAGE);
 
   testTrackingPage(tab.ownerGlobal);
 
rename from browser/base/content/test/general/browser_trackingUI_6.js
rename to browser/base/content/test/trackingUI/browser_trackingUI_6.js
--- a/browser/base/content/test/general/browser_trackingUI_6.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_6.js
@@ -1,9 +1,9 @@
-const URL = "http://mochi.test:8888/browser/browser/base/content/test/general/file_trackingUI_6.html";
+const URL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://mochi.test:8888") + "file_trackingUI_6.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);
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,17 +1,12 @@
 /*
  * 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", {});
-
 /**
  * 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();
 registerCleanupFunction(function() {
rename from browser/base/content/test/general/file_trackingUI_6.html
rename to browser/base/content/test/trackingUI/file_trackingUI_6.html
--- a/browser/base/content/test/general/file_trackingUI_6.html
+++ b/browser/base/content/test/trackingUI/file_trackingUI_6.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_6.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_6.js
rename from browser/base/content/test/general/file_trackingUI_6.js^headers^
rename to browser/base/content/test/trackingUI/file_trackingUI_6.js^headers^
copy from browser/base/content/test/general/head.js
copy to browser/base/content/test/trackingUI/head.js
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/trackingUI/head.js
@@ -1,214 +1,15 @@
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-ChromeUtils.defineModuleGetter(this, "PlacesUtils",
-  "resource://gre/modules/PlacesUtils.jsm");
-ChromeUtils.defineModuleGetter(this, "PlacesTestUtils",
-  "resource://testing-common/PlacesTestUtils.jsm");
-ChromeUtils.defineModuleGetter(this, "TabCrashHandler",
-  "resource:///modules/ContentCrashHandlers.jsm");
-
-/**
- * Wait for a <notification> to be closed then call the specified callback.
- */
-function waitForNotificationClose(notification, cb) {
-  let parent = notification.parentNode;
-
-  let observer = new MutationObserver(function onMutatations(mutations) {
-    for (let mutation of mutations) {
-      for (let i = 0; i < mutation.removedNodes.length; i++) {
-        let node = mutation.removedNodes.item(i);
-        if (node != notification) {
-          continue;
-        }
-        observer.disconnect();
-        cb();
-      }
-    }
-  });
-  observer.observe(parent, {childList: true});
-}
-
-function closeAllNotifications() {
-  let notificationBox = document.getElementById("global-notificationbox");
-
-  if (!notificationBox || !notificationBox.currentNotification) {
-    return Promise.resolve();
-  }
-
-  return new Promise(resolve => {
-    for (let notification of notificationBox.allNotifications) {
-      waitForNotificationClose(notification, function() {
-        if (notificationBox.allNotifications.length === 0) {
-          resolve();
-        }
-      });
-      notification.close();
-    }
-
-  });
-}
-
-function whenDelayedStartupFinished(aWindow, aCallback) {
-  Services.obs.addObserver(function observer(aSubject, aTopic) {
-    if (aWindow == aSubject) {
-      Services.obs.removeObserver(observer, aTopic);
-      executeSoon(aCallback);
-    }
-  }, "browser-delayed-startup-finished");
-}
-
-function openToolbarCustomizationUI(aCallback, aBrowserWin) {
-  if (!aBrowserWin)
-    aBrowserWin = window;
-
-  aBrowserWin.gCustomizeMode.enter();
-
-  aBrowserWin.gNavToolbox.addEventListener("customizationready", function() {
-    executeSoon(function() {
-      aCallback(aBrowserWin);
-    });
-  }, {once: true});
-}
-
-function closeToolbarCustomizationUI(aCallback, aBrowserWin) {
-  aBrowserWin.gNavToolbox.addEventListener("aftercustomization", function() {
-    executeSoon(aCallback);
-  }, {once: true});
-
-  aBrowserWin.gCustomizeMode.exit();
-}
-
-function waitForCondition(condition, nextTest, errorMsg, retryTimes) {
-  retryTimes = typeof retryTimes !== "undefined" ? retryTimes : 30;
-  var tries = 0;
-  var interval = setInterval(function() {
-    if (tries >= retryTimes) {
-      ok(false, errorMsg);
-      moveOn();
-    }
-    var conditionPassed;
-    try {
-      conditionPassed = condition();
-    } catch (e) {
-      ok(false, e + "\n" + e.stack);
-      conditionPassed = false;
-    }
-    if (conditionPassed) {
-      moveOn();
-    }
-    tries++;
-  }, 100);
-  var moveOn = function() { clearInterval(interval); nextTest(); };
-}
+var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
 
-function promiseWaitForCondition(aConditionFn) {
-  return new Promise(resolve => {
-    waitForCondition(aConditionFn, resolve, "Condition didn't pass.");
-  });
-}
-
-function promiseWaitForEvent(object, eventName, capturing = false, chrome = false) {
-  return new Promise((resolve) => {
-    function listener(event) {
-      info("Saw " + eventName);
-      object.removeEventListener(eventName, listener, capturing, chrome);
-      resolve(event);
-    }
-
-    info("Waiting for " + eventName);
-    object.addEventListener(eventName, listener, capturing, chrome);
-  });
-}
-
-/**
- * Allows setting focus on a window, and waiting for that window to achieve
- * focus.
- *
- * @param aWindow
- *        The window to focus and wait for.
- *
- * @return {Promise}
- * @resolves When the window is focused.
- * @rejects Never.
- */
-function promiseWaitForFocus(aWindow) {
-  return new Promise((resolve) => {
-    waitForFocus(resolve, aWindow);
-  });
-}
-
-function getTestPlugin(aName) {
-  var pluginName = aName || "Test Plug-in";
-  var ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-  var tags = ph.getPluginTags();
-
-  // Find the test plugin
-  for (var i = 0; i < tags.length; i++) {
-    if (tags[i].name == pluginName)
-      return tags[i];
-  }
-  ok(false, "Unable to find plugin");
-  return null;
-}
-
-// call this to set the test plugin(s) initially expected enabled state.
-// it will automatically be reset to it's previous value after the test
-// ends
-function setTestPluginEnabledState(newEnabledState, pluginName) {
-  var plugin = getTestPlugin(pluginName);
-  var oldEnabledState = plugin.enabledState;
-  plugin.enabledState = newEnabledState;
-  SimpleTest.registerCleanupFunction(function() {
-    getTestPlugin(pluginName).enabledState = oldEnabledState;
-  });
-}
-
-function pushPrefs(...aPrefs) {
-  return new Promise(resolve => {
-    SpecialPowers.pushPrefEnv({"set": aPrefs}, resolve);
-  });
-}
-
-function popPrefs() {
-  return new Promise(resolve => {
-    SpecialPowers.popPrefEnv(resolve);
-  });
-}
-
-function updateBlocklist(aCallback) {
-  var blocklistNotifier = Cc["@mozilla.org/extensions/blocklist;1"]
-                          .getService(Ci.nsITimerCallback);
-  var observer = function() {
-    Services.obs.removeObserver(observer, "blocklist-updated");
-    SimpleTest.executeSoon(aCallback);
-  };
-  Services.obs.addObserver(observer, "blocklist-updated");
-  blocklistNotifier.notify(null);
-}
-
-var _originalTestBlocklistURL = null;
-function setAndUpdateBlocklist(aURL, aCallback) {
-  if (!_originalTestBlocklistURL)
-    _originalTestBlocklistURL = Services.prefs.getCharPref("extensions.blocklist.url");
-  Services.prefs.setCharPref("extensions.blocklist.url", aURL);
-  updateBlocklist(aCallback);
-}
-
-function resetBlocklist() {
-  Services.prefs.setCharPref("extensions.blocklist.url", _originalTestBlocklistURL);
-}
-
-function whenNewWindowLoaded(aOptions, aCallback) {
-  let win = OpenBrowserWindow(aOptions);
-  win.addEventListener("load", function() {
-    aCallback(win);
-  }, {once: true});
-}
+const PREF = "privacy.trackingprotection.enabled";
+const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
+const ROOT = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://tracking.example.org");
+const BENIGN_PAGE = ROOT + "benignPage.html";
+const TRACKING_PAGE = ROOT + "trackingPage.html";
 
 function promiseWindowWillBeClosed(win) {
   return new Promise((resolve, reject) => {
     Services.obs.addObserver(function observe(subject, topic) {
       if (subject == win) {
         Services.obs.removeObserver(observe, topic);
         executeSoon(resolve);
       }
@@ -238,177 +39,16 @@ function promiseOpenAndLoadWindow(aOptio
       win.addEventListener("load", function() {
         resolve(win);
       }, {once: true});
     }
   });
 }
 
 /**
- * Waits for all pending async statements on the default connection, before
- * proceeding with aCallback.
- *
- * @param aCallback
- *        Function to be called when done.
- * @param aScope
- *        Scope for the callback.
- * @param aArguments
- *        Arguments array for the callback.
- *
- * @note The result is achieved by asynchronously executing a query requiring
- *       a write lock.  Since all statements on the same connection are
- *       serialized, the end of this write operation means that all writes are
- *       complete.  Note that WAL makes so that writers don't block readers, but
- *       this is a problem only across different connections.
- */
-function waitForAsyncUpdates(aCallback, aScope, aArguments) {
-  let scope = aScope || this;
-  let args = aArguments || [];
-  let db = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
-                              .DBConnection;
-  let begin = db.createAsyncStatement("BEGIN EXCLUSIVE");
-  begin.executeAsync();
-  begin.finalize();
-
-  let commit = db.createAsyncStatement("COMMIT");
-  commit.executeAsync({
-    handleResult() {},
-    handleError() {},
-    handleCompletion(aReason) {
-      aCallback.apply(scope, args);
-    }
-  });
-  commit.finalize();
-}
-
-function whenNewTabLoaded(aWindow, aCallback) {
-  aWindow.BrowserOpenTab();
-
-  let browser = aWindow.gBrowser.selectedBrowser;
-  let doc = browser.contentDocumentAsCPOW;
-  if (doc && doc.readyState === "complete") {
-    aCallback();
-    return;
-  }
-
-  whenTabLoaded(aWindow.gBrowser.selectedTab, aCallback);
-}
-
-function whenTabLoaded(aTab, aCallback) {
-  promiseTabLoadEvent(aTab).then(aCallback);
-}
-
-function promiseTabLoaded(aTab) {
-  return new Promise(resolve => {
-    whenTabLoaded(aTab, resolve);
-  });
-}
-
-var FullZoomHelper = {
-
-  selectTabAndWaitForLocationChange: function selectTabAndWaitForLocationChange(tab) {
-    if (!tab)
-      throw new Error("tab must be given.");
-    if (gBrowser.selectedTab == tab)
-      return Promise.resolve();
-
-    return Promise.all([BrowserTestUtils.switchTab(gBrowser, tab),
-                        this.waitForLocationChange()]);
-  },
-
-  removeTabAndWaitForLocationChange: function removeTabAndWaitForLocationChange(tab) {
-    tab = tab || gBrowser.selectedTab;
-    let selected = gBrowser.selectedTab == tab;
-    gBrowser.removeTab(tab);
-    if (selected)
-      return this.waitForLocationChange();
-    return Promise.resolve();
-  },
-
-  waitForLocationChange: function waitForLocationChange() {
-    return new Promise(resolve => {
-      Services.obs.addObserver(function obs(subj, topic, data) {
-        Services.obs.removeObserver(obs, topic);
-        resolve();
-      }, "browser-fullZoom:location-change");
-    });
-  },
-
-  load: function load(tab, url) {
-    return new Promise(resolve => {
-      let didLoad = false;
-      let didZoom = false;
-
-      promiseTabLoadEvent(tab).then(event => {
-        didLoad = true;
-        if (didZoom)
-          resolve();
-      }, true);
-
-      this.waitForLocationChange().then(function() {
-        didZoom = true;
-        if (didLoad)
-          resolve();
-      });
-
-      tab.linkedBrowser.loadURI(url);
-    });
-  },
-
-  zoomTest: function zoomTest(tab, val, msg) {
-    is(ZoomManager.getZoomForBrowser(tab.linkedBrowser), val, msg);
-  },
-
-  enlarge: function enlarge() {
-    return new Promise(resolve => FullZoom.enlarge(resolve));
-  },
-
-  reduce: function reduce() {
-    return new Promise(resolve => FullZoom.reduce(resolve));
-  },
-
-  reset: function reset() {
-    return FullZoom.reset();
-  },
-
-  BACK: 0,
-  FORWARD: 1,
-  navigate: function navigate(direction) {
-    return new Promise(resolve => {
-      let didPs = false;
-      let didZoom = false;
-
-      BrowserTestUtils.waitForContentEvent(gBrowser.selectedBrowser, "pageshow", true).then(() => {
-        didPs = true;
-        if (didZoom)
-          resolve();
-      });
-
-      if (direction == this.BACK)
-        gBrowser.goBack();
-      else if (direction == this.FORWARD)
-        gBrowser.goForward();
-
-      this.waitForLocationChange().then(function() {
-        didZoom = true;
-        if (didPs)
-          resolve();
-      });
-    });
-  },
-
-  failAndContinue: function failAndContinue(func) {
-    return function(err) {
-      ok(false, err);
-      func();
-    };
-  },
-};
-
-/**
  * Waits for a load (or custom) event to finish in a given tab. If provided
  * load an uri into the tab.
  *
  * @param tab
  *        The tab to load into.
  * @param [optional] url
  *        The url to load, or the current url.
  * @return {Promise} resolved when the event is handled.
@@ -430,207 +70,8 @@ function promiseTabLoadEvent(tab, url) {
 
   let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, handle);
 
   if (url)
     BrowserTestUtils.loadURI(tab.linkedBrowser, url);
 
   return loaded;
 }
-
-/**
- * Returns a Promise that resolves once a new tab has been opened in
- * a xul:tabbrowser.
- *
- * @param aTabBrowser
- *        The xul:tabbrowser to monitor for a new tab.
- * @return {Promise}
- *        Resolved when the new tab has been opened.
- * @resolves to the TabOpen event that was fired.
- * @rejects Never.
- */
-function waitForNewTabEvent(aTabBrowser) {
-  return promiseWaitForEvent(aTabBrowser.tabContainer, "TabOpen");
-}
-
-function is_hidden(element) {
-  var style = element.ownerGlobal.getComputedStyle(element);
-  if (style.display == "none")
-    return true;
-  if (style.visibility != "visible")
-    return true;
-  if (style.display == "-moz-popup")
-    return ["hiding", "closed"].includes(element.state);
-
-  // Hiding a parent element will hide all its children
-  if (element.parentNode != element.ownerDocument)
-    return is_hidden(element.parentNode);
-
-  return false;
-}
-
-function is_visible(element) {
-  var style = element.ownerGlobal.getComputedStyle(element);
-  if (style.display == "none")
-    return false;
-  if (style.visibility != "visible")
-    return false;
-  if (style.display == "-moz-popup" && element.state != "open")
-    return false;
-
-  // Hiding a parent element will hide all its children
-  if (element.parentNode != element.ownerDocument)
-    return is_visible(element.parentNode);
-
-  return true;
-}
-
-function is_element_visible(element, msg) {
-  isnot(element, null, "Element should not be null, when checking visibility");
-  ok(is_visible(element), msg || "Element should be visible");
-}
-
-function is_element_hidden(element, msg) {
-  isnot(element, null, "Element should not be null, when checking visibility");
-  ok(is_hidden(element), msg || "Element should be hidden");
-}
-
-function promisePopupEvent(popup, eventSuffix) {
-  let endState = {shown: "open", hidden: "closed"}[eventSuffix];
-
-  if (popup.state == endState)
-    return Promise.resolve();
-
-  let eventType = "popup" + eventSuffix;
-  return new Promise(resolve => {
-    popup.addEventListener(eventType, function(event) {
-      resolve();
-    }, {once: true});
-
-  });
-}
-
-function promisePopupShown(popup) {
-  return promisePopupEvent(popup, "shown");
-}
-
-function promisePopupHidden(popup) {
-  return promisePopupEvent(popup, "hidden");
-}
-
-function promiseNotificationShown(notification) {
-  let win = notification.browser.ownerGlobal;
-  if (win.PopupNotifications.panel.state == "open") {
-    return Promise.resolve();
-  }
-  let panelPromise = promisePopupShown(win.PopupNotifications.panel);
-  notification.reshow();
-  return panelPromise;
-}
-
-function promiseNewSearchEngine(basename) {
-  return new Promise((resolve, reject) => {
-    info("Waiting for engine to be added: " + basename);
-    let url = getRootDirectory(gTestPath) + basename;
-    Services.search.addEngine(url, null, "", false, {
-      onSuccess(engine) {
-        info("Search engine added: " + basename);
-        registerCleanupFunction(() => Services.search.removeEngine(engine));
-        resolve(engine);
-      },
-      onError(errCode) {
-        Assert.ok(false, "addEngine failed with error code " + errCode);
-        reject();
-      },
-    });
-  });
-}
-
-/**
- * Resolves when a bookmark with the given uri is added.
- */
-function promiseOnBookmarkItemAdded(aExpectedURI) {
-  return new Promise((resolve, reject) => {
-    let bookmarksObserver = {
-      onItemAdded(aItemId, aFolderId, aIndex, aItemType, aURI) {
-        info("Added a bookmark to " + aURI.spec);
-        PlacesUtils.bookmarks.removeObserver(bookmarksObserver);
-        if (aURI.equals(aExpectedURI)) {
-          resolve();
-        } else {
-          reject(new Error("Added an unexpected bookmark"));
-        }
-      },
-      onBeginUpdateBatch() {},
-      onEndUpdateBatch() {},
-      onItemRemoved() {},
-      onItemChanged() {},
-      onItemVisited() {},
-      onItemMoved() {},
-      QueryInterface: XPCOMUtils.generateQI([
-        Ci.nsINavBookmarkObserver,
-      ])
-    };
-    info("Waiting for a bookmark to be added");
-    PlacesUtils.bookmarks.addObserver(bookmarksObserver);
-  });
-}
-
-async function loadBadCertPage(url) {
-  const EXCEPTION_DIALOG_URI = "chrome://pippki/content/exceptionDialog.xul";
-  let exceptionDialogResolved = new Promise(function(resolve) {
-    // When the certificate exception dialog has opened, click the button to add
-    // an exception.
-    let certExceptionDialogObserver = {
-      observe(aSubject, aTopic, aData) {
-        if (aTopic == "cert-exception-ui-ready") {
-          Services.obs.removeObserver(this, "cert-exception-ui-ready");
-          let certExceptionDialog = getCertExceptionDialog(EXCEPTION_DIALOG_URI);
-          ok(certExceptionDialog, "found exception dialog");
-          executeSoon(function() {
-            certExceptionDialog.documentElement.getButton("extra1").click();
-            resolve();
-          });
-        }
-      }
-    };
-
-    Services.obs.addObserver(certExceptionDialogObserver,
-                             "cert-exception-ui-ready");
-  });
-
-  let loaded = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
-  await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
-  await loaded;
-
-  await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
-    content.document.getElementById("exceptionDialogButton").click();
-  });
-  await exceptionDialogResolved;
-  await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
-}
-
-// Utility function to get a handle on the certificate exception dialog.
-// Modified from toolkit/components/passwordmgr/test/prompt_common.js
-function getCertExceptionDialog(aLocation) {
-  let enumerator = Services.wm.getXULWindowEnumerator(null);
-
-  while (enumerator.hasMoreElements()) {
-    let win = enumerator.getNext();
-    let windowDocShell = win.QueryInterface(Ci.nsIXULWindow).docShell;
-
-    let containedDocShells = windowDocShell.getDocShellEnumerator(
-                                      Ci.nsIDocShellTreeItem.typeChrome,
-                                      Ci.nsIDocShell.ENUMERATE_FORWARDS);
-    while (containedDocShells.hasMoreElements()) {
-      // Get the corresponding document for this docshell
-      let childDocShell = containedDocShells.getNext();
-      let childDoc = childDocShell.QueryInterface(Ci.nsIDocShell)
-                                  .contentViewer
-                                  .DOMDocument;
-
-      if (childDoc.location.href == aLocation) {
-        return childDoc;
-      }
-    }
-  }
-  return undefined;
-}
rename from browser/base/content/test/general/trackingPage.html
rename to browser/base/content/test/trackingUI/trackingPage.html
--- a/browser/base/moz.build
+++ b/browser/base/moz.build
@@ -48,16 +48,17 @@ BROWSER_CHROME_MANIFESTS += [
     'content/test/siteIdentity/browser.ini',
     'content/test/static/browser.ini',
     'content/test/statuspanel/browser.ini',
     'content/test/sync/browser.ini',
     'content/test/tabcrashed/browser.ini',
     'content/test/tabPrompts/browser.ini',
     'content/test/tabs/browser.ini',
     'content/test/touch/browser.ini',
+    'content/test/trackingUI/browser.ini',
     'content/test/urlbar/browser.ini',
     'content/test/webextensions/browser.ini',
     'content/test/webrtc/browser.ini',
 ]
 
 DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
 DEFINES['MOZ_APP_VERSION_DISPLAY'] = CONFIG['MOZ_APP_VERSION_DISPLAY']
 
--- a/browser/components/uitour/test/browser.ini
+++ b/browser/components/uitour/test/browser.ini
@@ -12,18 +12,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" # 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,14 +1,14 @@
 "use strict";
 
 const PREF_INTRO_COUNT = "privacy.trackingprotection.introCount";
 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");
 
 var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
 
 registerCleanupFunction(function() {
   UrlClassifierTestUtils.cleanupTestTrackers();
   Services.prefs.clearUserPref(PREF_TP_ENABLED);