Bug 1335431 - Move site identity tests out of test/general. r=Gijs draft
authorJohann Hofmann <jhofmann@mozilla.com>
Tue, 31 Jan 2017 09:27:51 +0100
changeset 469571 82a59bdb1b32194292711f92bb8a819a82b2516c
parent 469330 f985243bb630b2c78cd57731c8d8ab191aa09527
child 544245 2277703b87324704e56e5db3cec06d6425cab57d
push id43776
push userbmo:jhofmann@mozilla.com
push dateThu, 02 Feb 2017 13:20:15 +0000
reviewersGijs
bugs1335431
milestone54.0a1
Bug 1335431 - Move site identity tests out of test/general. r=Gijs MozReview-Commit-ID: 5BKZXFPn7PW
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_bug1045809.js
browser/base/content/test/general/browser_bug435035.js
browser/base/content/test/general/browser_bug822367.js
browser/base/content/test/general/browser_bug902156.js
browser/base/content/test/general/browser_bug906190.js
browser/base/content/test/general/browser_csp_block_all_mixedcontent.js
browser/base/content/test/general/browser_identity_UI.js
browser/base/content/test/general/browser_insecureLoginForms.js
browser/base/content/test/general/browser_mcb_redirect.js
browser/base/content/test/general/browser_mixedContentFramesOnHttp.js
browser/base/content/test/general/browser_mixedContentFromOnunload.js
browser/base/content/test/general/browser_mixed_content_cert_override.js
browser/base/content/test/general/browser_mixedcontent_securityflags.js
browser/base/content/test/general/browser_no_mcb_on_http_site.js
browser/base/content/test/general/file_bug1045809_1.html
browser/base/content/test/general/file_bug1045809_2.html
browser/base/content/test/general/file_bug822367_1.html
browser/base/content/test/general/file_bug822367_1.js
browser/base/content/test/general/file_bug822367_2.html
browser/base/content/test/general/file_bug822367_3.html
browser/base/content/test/general/file_bug822367_4.html
browser/base/content/test/general/file_bug822367_4.js
browser/base/content/test/general/file_bug822367_4B.html
browser/base/content/test/general/file_bug822367_5.html
browser/base/content/test/general/file_bug822367_6.html
browser/base/content/test/general/file_bug902156.js
browser/base/content/test/general/file_bug902156_1.html
browser/base/content/test/general/file_bug902156_2.html
browser/base/content/test/general/file_bug902156_3.html
browser/base/content/test/general/file_bug906190.js
browser/base/content/test/general/file_bug906190.sjs
browser/base/content/test/general/file_bug906190_1.html
browser/base/content/test/general/file_bug906190_2.html
browser/base/content/test/general/file_bug906190_3_4.html
browser/base/content/test/general/file_bug906190_redirected.html
browser/base/content/test/general/file_csp_block_all_mixedcontent.html
browser/base/content/test/general/file_csp_block_all_mixedcontent.js
browser/base/content/test/general/file_mixedContentFramesOnHttp.html
browser/base/content/test/general/file_mixedContentFromOnunload.html
browser/base/content/test/general/file_mixedContentFromOnunload_test1.html
browser/base/content/test/general/file_mixedContentFromOnunload_test2.html
browser/base/content/test/general/file_mixedPassiveContent.html
browser/base/content/test/general/head.js
browser/base/content/test/general/insecure_opener.html
browser/base/content/test/general/test-mixedcontent-securityerrors.html
browser/base/content/test/general/test_bug435035.html
browser/base/content/test/general/test_mcb_double_redirect_image.html
browser/base/content/test/general/test_mcb_redirect.html
browser/base/content/test/general/test_mcb_redirect.js
browser/base/content/test/general/test_mcb_redirect.sjs
browser/base/content/test/general/test_mcb_redirect_image.html
browser/base/content/test/general/test_no_mcb_on_http_site_font.css
browser/base/content/test/general/test_no_mcb_on_http_site_font.html
browser/base/content/test/general/test_no_mcb_on_http_site_font2.css
browser/base/content/test/general/test_no_mcb_on_http_site_font2.html
browser/base/content/test/general/test_no_mcb_on_http_site_img.css
browser/base/content/test/general/test_no_mcb_on_http_site_img.html
browser/base/content/test/siteIdentity/browser.ini
browser/base/content/test/siteIdentity/browser_bug1045809.js
browser/base/content/test/siteIdentity/browser_bug435035.js
browser/base/content/test/siteIdentity/browser_bug822367.js
browser/base/content/test/siteIdentity/browser_bug902156.js
browser/base/content/test/siteIdentity/browser_bug906190.js
browser/base/content/test/siteIdentity/browser_csp_block_all_mixedcontent.js
browser/base/content/test/siteIdentity/browser_identity_UI.js
browser/base/content/test/siteIdentity/browser_insecureLoginForms.js
browser/base/content/test/siteIdentity/browser_mcb_redirect.js
browser/base/content/test/siteIdentity/browser_mixedContentFramesOnHttp.js
browser/base/content/test/siteIdentity/browser_mixedContentFromOnunload.js
browser/base/content/test/siteIdentity/browser_mixed_content_cert_override.js
browser/base/content/test/siteIdentity/browser_mixedcontent_securityflags.js
browser/base/content/test/siteIdentity/browser_no_mcb_on_http_site.js
browser/base/content/test/siteIdentity/file_bug1045809_1.html
browser/base/content/test/siteIdentity/file_bug1045809_2.html
browser/base/content/test/siteIdentity/file_bug822367_1.html
browser/base/content/test/siteIdentity/file_bug822367_1.js
browser/base/content/test/siteIdentity/file_bug822367_2.html
browser/base/content/test/siteIdentity/file_bug822367_3.html
browser/base/content/test/siteIdentity/file_bug822367_4.html
browser/base/content/test/siteIdentity/file_bug822367_4.js
browser/base/content/test/siteIdentity/file_bug822367_4B.html
browser/base/content/test/siteIdentity/file_bug822367_5.html
browser/base/content/test/siteIdentity/file_bug822367_6.html
browser/base/content/test/siteIdentity/file_bug902156.js
browser/base/content/test/siteIdentity/file_bug902156_1.html
browser/base/content/test/siteIdentity/file_bug902156_2.html
browser/base/content/test/siteIdentity/file_bug902156_3.html
browser/base/content/test/siteIdentity/file_bug906190.js
browser/base/content/test/siteIdentity/file_bug906190.sjs
browser/base/content/test/siteIdentity/file_bug906190_1.html
browser/base/content/test/siteIdentity/file_bug906190_2.html
browser/base/content/test/siteIdentity/file_bug906190_3_4.html
browser/base/content/test/siteIdentity/file_bug906190_redirected.html
browser/base/content/test/siteIdentity/file_csp_block_all_mixedcontent.html
browser/base/content/test/siteIdentity/file_csp_block_all_mixedcontent.js
browser/base/content/test/siteIdentity/file_mixedContentFramesOnHttp.html
browser/base/content/test/siteIdentity/file_mixedContentFromOnunload.html
browser/base/content/test/siteIdentity/file_mixedContentFromOnunload_test1.html
browser/base/content/test/siteIdentity/file_mixedContentFromOnunload_test2.html
browser/base/content/test/siteIdentity/file_mixedPassiveContent.html
browser/base/content/test/siteIdentity/head.js
browser/base/content/test/siteIdentity/insecure_opener.html
browser/base/content/test/siteIdentity/test-mixedcontent-securityerrors.html
browser/base/content/test/siteIdentity/test_bug435035.html
browser/base/content/test/siteIdentity/test_mcb_double_redirect_image.html
browser/base/content/test/siteIdentity/test_mcb_redirect.html
browser/base/content/test/siteIdentity/test_mcb_redirect.js
browser/base/content/test/siteIdentity/test_mcb_redirect.sjs
browser/base/content/test/siteIdentity/test_mcb_redirect_image.html
browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font.css
browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font.html
browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font2.css
browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font2.html
browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_img.css
browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_img.html
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -27,41 +27,17 @@ support-files =
   contextmenu_common.js
   ctxmenu-image.png
   discovery.html
   download_page.html
   dummy_page.html
   feed_tab.html
   file_generic_favicon.ico
   file_with_favicon.html
-  file_bug822367_1.html
-  file_bug822367_1.js
-  file_bug822367_2.html
-  file_bug822367_3.html
-  file_bug822367_4.html
-  file_bug822367_4.js
-  file_bug822367_4B.html
-  file_bug822367_5.html
-  file_bug822367_6.html
-  file_bug902156.js
-  file_bug902156_1.html
-  file_bug902156_2.html
-  file_bug902156_3.html
-  file_bug906190_1.html
-  file_bug906190_2.html
-  file_bug906190_3_4.html
-  file_bug906190_redirected.html
-  file_bug906190.js
-  file_bug906190.sjs
   file_mediaPlayback.html
-  file_mixedContentFromOnunload.html
-  file_mixedContentFromOnunload_test1.html
-  file_mixedContentFromOnunload_test2.html
-  file_mixedContentFramesOnHttp.html
-  file_mixedPassiveContent.html
   file_bug970276_popup1.html
   file_bug970276_popup2.html
   file_bug970276_favicon1.ico
   file_bug970276_favicon2.ico
   file_documentnavigation_frameset.html
   file_double_close_tab.html
   file_favicon_change.html
   file_favicon_change_not_in_document.html
@@ -80,56 +56,36 @@ support-files =
   popup_blocker.html
   print_postdata.sjs
   searchSuggestionEngine.sjs
   searchSuggestionEngine.xml
   searchSuggestionEngine2.xml
   subtst_contextmenu.html
   subtst_contextmenu_input.html
   subtst_contextmenu_xul.xul
-  test-mixedcontent-securityerrors.html
-  test_bug435035.html
   test_bug462673.html
   test_bug628179.html
   test_bug839103.html
   test_bug959531.html
   test_process_flags_chrome.html
   title_test.svg
   unknownContentType_file.pif
   unknownContentType_file.pif^headers^
   video.ogg
   web_video.html
   web_video1.ogv
   web_video1.ogv^headers^
   zoom_test.html
-  test_no_mcb_on_http_site_img.html
-  test_no_mcb_on_http_site_img.css
-  test_no_mcb_on_http_site_font.html
-  test_no_mcb_on_http_site_font.css
-  test_no_mcb_on_http_site_font2.html
-  test_no_mcb_on_http_site_font2.css
-  test_mcb_redirect.html
-  test_mcb_redirect_image.html
-  test_mcb_double_redirect_image.html
-  test_mcb_redirect.js
-  test_mcb_redirect.sjs
-  file_bug1045809_1.html
-  file_bug1045809_2.html
-  file_csp_block_all_mixedcontent.html
-  file_csp_block_all_mixedcontent.js
   file_install_extensions.html
   browser_webext_permissions.xpi
   browser_webext_nopermissions.xpi
   browser_webext_update1.xpi
   browser_webext_update2.xpi
   browser_webext_update.json
   !/image/test/mochitest/blue.png
-  !/toolkit/components/passwordmgr/test/browser/form_basic.html
-  !/toolkit/components/passwordmgr/test/browser/insecure_test.html
-  !/toolkit/components/passwordmgr/test/browser/insecure_test_subframe.html
   !/toolkit/content/tests/browser/common/mockTransfer.js
   !/toolkit/modules/tests/browser/metadata_*.html
   !/toolkit/mozapps/extensions/test/xpinstall/amosigned.xpi
   !/toolkit/mozapps/extensions/test/xpinstall/corrupt.xpi
   !/toolkit/mozapps/extensions/test/xpinstall/incompatible.xpi
   !/toolkit/mozapps/extensions/test/xpinstall/installtrigger.html
   !/toolkit/mozapps/extensions/test/xpinstall/redirect.sjs
   !/toolkit/mozapps/extensions/test/xpinstall/restartless-unsigned.xpi
@@ -179,17 +135,16 @@ skip-if = true # browser_bug321000.js is
 [browser_bug419612.js]
 [browser_bug422590.js]
 [browser_bug423833.js]
 skip-if = true # bug 428712
 [browser_bug424101.js]
 [browser_bug427559.js]
 [browser_bug431826.js]
 [browser_bug432599.js]
-[browser_bug435035.js]
 [browser_bug435325.js]
 [browser_bug441778.js]
 [browser_bug455852.js]
 [browser_bug460146.js]
 [browser_bug462289.js]
 skip-if = toolkit == "cocoa"
 [browser_bug462673.js]
 [browser_bug477014.js]
@@ -258,29 +213,19 @@ skip-if = os == "mac" # Bug 1102331 - do
 [browser_bug719271.js]
 [browser_bug724239.js]
 [browser_bug734076.js]
 [browser_bug735471.js]
 [browser_bug749738.js]
 [browser_bug763468_perwindowpb.js]
 [browser_bug767836_perwindowpb.js]
 [browser_bug817947.js]
-[browser_bug822367.js]
-tags = mcb
 [browser_bug832435.js]
 [browser_bug839103.js]
 [browser_bug882977.js]
-[browser_bug902156.js]
-tags = mcb
-[browser_bug906190.js]
-tags = mcb
-[browser_mixedContentFromOnunload.js]
-tags = mcb
-[browser_mixedContentFramesOnHttp.js]
-tags = mcb
 [browser_bug970746.js]
 [browser_bug1015721.js]
 skip-if = os == 'win'
 [browser_accesskeys.js]
 [browser_clipboard.js]
 subsuite = clipboard
 [browser_clipboard_pastefile.js]
 skip-if = true # Disabled due to the clipboard not supporting real file types yet (bug 1288773)
@@ -318,34 +263,28 @@ skip-if = os == "linux" # Linux: Intermi
 [browser_fxaccounts.js]
 support-files = fxa_profile_handler.sjs
 [browser_fxa_web_channel.js]
 [browser_gestureSupport.js]
 skip-if = e10s # Bug 863514 - no gesture support.
 [browser_getshortcutoruri.js]
 [browser_hide_removing.js]
 [browser_homeDrop.js]
-[browser_identity_UI.js]
-[browser_insecureLoginForms.js]
-support-files = insecure_opener.html
 [browser_invalid_uri_back_forward_manipulation.js]
 [browser_keywordBookmarklets.js]
 [browser_keywordSearch.js]
 [browser_keywordSearch_postData.js]
 [browser_lastAccessedTab.js]
 skip-if = toolkit == "windows" # Disabled on Windows due to frequent failures (bug 969405)
 [browser_menuButtonFitts.js]
 skip-if = os != "win" # The Fitts Law menu button is only supported on Windows (bug 969376)
 [browser_middleMouse_noJSPaste.js]
 subsuite = clipboard
 [browser_minimize.js]
 [browser_misused_characters_in_strings.js]
-[browser_mixed_content_cert_override.js]
-[browser_mixedcontent_securityflags.js]
-tags = mcb
 [browser_modifiedclick_inherit_principal.js]
 [browser_offlineQuotaNotification.js]
 [browser_feed_discovery.js]
 support-files = feed_discovery.html
 [browser_gZipOfflineChild.js]
 support-files = test_offline_gzip.html gZipOfflineChild.cacheManifest gZipOfflineChild.cacheManifest^headers^ gZipOfflineChild.html gZipOfflineChild.html^headers^
 [browser_overflowScroll.js]
 [browser_pageInfo.js]
@@ -478,37 +417,29 @@ skip-if = true # Bug 1005420 - fails int
 [browser_visibleTabs_contextMenu.js]
 [browser_visibleTabs_tabPreview.js]
 skip-if = (os == "win" && !debug)
 [browser_web_channel.js]
 [browser_windowopen_reflows.js]
 [browser_zbug569342.js]
 skip-if = e10s || debug # Bug 1094240 - has findbar-related failures
 [browser_registerProtocolHandler_notification.js]
-[browser_no_mcb_on_http_site.js]
-tags = mcb
 [browser_addCertException.js]
-[browser_bug1045809.js]
-tags = mcb
 [browser_e10s_about_page_triggeringprincipal.js]
 [browser_e10s_switchbrowser.js]
 [browser_e10s_about_process.js]
 [browser_e10s_chrome_process.js]
 [browser_e10s_javascript.js]
 [browser_blockHPKP.js]
 tags = psm
-[browser_mcb_redirect.js]
-tags = mcb
 [browser_windowactivation.js]
 [browser_contextmenu_childprocess.js]
 [browser_bug963945.js]
 [browser_domFullscreen_fullscreenMode.js]
 tags = fullscreen
 [browser_menuButtonBadgeManager.js]
 [browser_newTabDrop.js]
 [browser_newWindowDrop.js]
-[browser_csp_block_all_mixedcontent.js]
-tags = mcb
 [browser_newwindow_focus.js]
 skip-if = (os == "linux" && !e10s) # Bug 1263254 - Perma fails on Linux without e10s for some reason.
 [browser_bug1299667.js]
 [browser_close_dependent_tabs.js]
 skip-if = !e10s # GroupedSHistory is e10s-only
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -640,180 +640,16 @@ function promiseTabLoadEvent(tab, url) {
  *        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");
 }
 
-/**
- * Test the state of the identity box and control center to make
- * sure they are correctly showing the expected mixed content states.
- *
- * @note The checks are done synchronously, but new code should wait on the
- *       returned Promise object to ensure the identity panel has closed.
- *       Bug 1221114 is filed to fix the existing code.
- *
- * @param tabbrowser
- * @param Object states
- *        MUST include the following properties:
- *        {
- *           activeLoaded: true|false,
- *           activeBlocked: true|false,
- *           passiveLoaded: true|false,
- *        }
- *
- * @return {Promise}
- * @resolves When the operation has finished and the identity panel has closed.
- */
-function assertMixedContentBlockingState(tabbrowser, states = {}) {
-  if (!tabbrowser || !("activeLoaded" in states) ||
-      !("activeBlocked" in states) || !("passiveLoaded" in states)) {
-    throw new Error("assertMixedContentBlockingState requires a browser and a states object");
-  }
-
-  let {passiveLoaded, activeLoaded, activeBlocked} = states;
-  let {gIdentityHandler} = tabbrowser.ownerGlobal;
-  let doc = tabbrowser.ownerDocument;
-  let identityBox = gIdentityHandler._identityBox;
-  let classList = identityBox.classList;
-  let connectionIcon = doc.getElementById("connection-icon");
-  let connectionIconImage = tabbrowser.ownerGlobal.getComputedStyle(connectionIcon).
-                         getPropertyValue("list-style-image");
-
-  let stateSecure = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_IS_SECURE;
-  let stateBroken = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_IS_BROKEN;
-  let stateInsecure = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_IS_INSECURE;
-  let stateActiveBlocked = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT;
-  let stateActiveLoaded = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT;
-  let statePassiveLoaded = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_LOADED_MIXED_DISPLAY_CONTENT;
-
-  is(activeBlocked, !!stateActiveBlocked, "Expected state for activeBlocked matches UI state");
-  is(activeLoaded, !!stateActiveLoaded, "Expected state for activeLoaded matches UI state");
-  is(passiveLoaded, !!statePassiveLoaded, "Expected state for passiveLoaded matches UI state");
-
-  if (stateInsecure) {
-    // HTTP request, there should be no MCB classes for the identity box and the non secure icon
-    // should always be visible regardless of MCB state.
-    ok(classList.contains("unknownIdentity"), "unknownIdentity on HTTP page");
-    is_element_hidden(connectionIcon);
-
-    ok(!classList.contains("mixedActiveContent"), "No MCB icon on HTTP page");
-    ok(!classList.contains("mixedActiveBlocked"), "No MCB icon on HTTP page");
-    ok(!classList.contains("mixedDisplayContent"), "No MCB icon on HTTP page");
-    ok(!classList.contains("mixedDisplayContentLoadedActiveBlocked"), "No MCB icon on HTTP page");
-  } else {
-    // Make sure the identity box UI has the correct mixedcontent states and icons
-    is(classList.contains("mixedActiveContent"), activeLoaded,
-        "identityBox has expected class for activeLoaded");
-    is(classList.contains("mixedActiveBlocked"), activeBlocked && !passiveLoaded,
-        "identityBox has expected class for activeBlocked && !passiveLoaded");
-    is(classList.contains("mixedDisplayContent"), passiveLoaded && !(activeLoaded || activeBlocked),
-       "identityBox has expected class for passiveLoaded && !(activeLoaded || activeBlocked)");
-    is(classList.contains("mixedDisplayContentLoadedActiveBlocked"), passiveLoaded && activeBlocked,
-       "identityBox has expected class for passiveLoaded && activeBlocked");
-
-    is_element_visible(connectionIcon);
-    if (activeLoaded) {
-      is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-active-loaded.svg#icon\")",
-        "Using active loaded icon");
-    }
-    if (activeBlocked && !passiveLoaded) {
-      is(connectionIconImage, "url(\"chrome://browser/skin/connection-secure.svg\")",
-        "Using active blocked icon");
-    }
-    if (passiveLoaded && !(activeLoaded || activeBlocked)) {
-      is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg#icon\")",
-        "Using passive loaded icon");
-    }
-    if (passiveLoaded && activeBlocked) {
-      is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg#icon\")",
-        "Using active blocked and passive loaded icon");
-    }
-  }
-
-  // Make sure the identity popup has the correct mixedcontent states
-  gIdentityHandler._identityBox.click();
-  let popupAttr = doc.getElementById("identity-popup").getAttribute("mixedcontent");
-  let bodyAttr = doc.getElementById("identity-popup-securityView-body").getAttribute("mixedcontent");
-
-  is(popupAttr.includes("active-loaded"), activeLoaded,
-      "identity-popup has expected attr for activeLoaded");
-  is(bodyAttr.includes("active-loaded"), activeLoaded,
-      "securityView-body has expected attr for activeLoaded");
-
-  is(popupAttr.includes("active-blocked"), activeBlocked,
-      "identity-popup has expected attr for activeBlocked");
-  is(bodyAttr.includes("active-blocked"), activeBlocked,
-      "securityView-body has expected attr for activeBlocked");
-
-  is(popupAttr.includes("passive-loaded"), passiveLoaded,
-      "identity-popup has expected attr for passiveLoaded");
-  is(bodyAttr.includes("passive-loaded"), passiveLoaded,
-      "securityView-body has expected attr for passiveLoaded");
-
-  // Make sure the correct icon is visible in the Control Center.
-  // This logic is controlled with CSS, so this helps prevent regressions there.
-  let securityView = doc.getElementById("identity-popup-securityView");
-  let securityViewBG = tabbrowser.ownerGlobal.getComputedStyle(securityView).
-                       getPropertyValue("background-image");
-  let securityContentBG = tabbrowser.ownerGlobal.getComputedStyle(securityView).
-                          getPropertyValue("background-image");
-
-  if (stateInsecure) {
-    is(securityViewBG, "url(\"chrome://browser/skin/controlcenter/conn-not-secure.svg\")",
-      "CC using 'not secure' icon");
-    is(securityContentBG, "url(\"chrome://browser/skin/controlcenter/conn-not-secure.svg\")",
-      "CC using 'not secure' icon");
-  }
-
-  if (stateSecure) {
-    is(securityViewBG, "url(\"chrome://browser/skin/controlcenter/connection.svg#connection-secure\")",
-      "CC using secure icon");
-    is(securityContentBG, "url(\"chrome://browser/skin/controlcenter/connection.svg#connection-secure\")",
-      "CC using secure icon");
-  }
-
-  if (stateBroken) {
-    if (activeLoaded) {
-      is(securityViewBG, "url(\"chrome://browser/skin/controlcenter/mcb-disabled.svg\")",
-        "CC using active loaded icon");
-      is(securityContentBG, "url(\"chrome://browser/skin/controlcenter/mcb-disabled.svg\")",
-        "CC using active loaded icon");
-    } else if (activeBlocked || passiveLoaded) {
-      is(securityViewBG, "url(\"chrome://browser/skin/controlcenter/connection.svg#connection-degraded\")",
-        "CC using degraded icon");
-      is(securityContentBG, "url(\"chrome://browser/skin/controlcenter/connection.svg#connection-degraded\")",
-        "CC using degraded icon");
-    } else {
-      // There is a case here with weak ciphers, but no bc tests are handling this yet.
-      is(securityViewBG, "url(\"chrome://browser/skin/controlcenter/connection.svg#connection-degraded\")",
-        "CC using degraded icon");
-      is(securityContentBG, "url(\"chrome://browser/skin/controlcenter/connection.svg#connection-degraded\")",
-        "CC using degraded icon");
-    }
-  }
-
-  if (activeLoaded || activeBlocked || passiveLoaded) {
-    doc.getElementById("identity-popup-security-expander").click();
-    is(Array.filter(doc.querySelectorAll("[observes=identity-popup-mcb-learn-more]"),
-                    element => !is_hidden(element)).length, 1,
-       "The 'Learn more' link should be visible once.");
-  }
-
-  gIdentityHandler._identityPopup.hidden = true;
-
-  // Wait for the panel to be closed before continuing. The promisePopupHidden
-  // function cannot be used because it's unreliable unless promisePopupShown is
-  // also called before closing the panel. This cannot be done until all callers
-  // are made asynchronous (bug 1221114).
-  return new Promise(resolve => executeSoon(resolve));
-}
-
 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"].indexOf(element.state) != -1;
@@ -918,45 +754,16 @@ function promiseNewSearchEngine(basename
       onError(errCode) {
         Assert.ok(false, "addEngine failed with error code " + errCode);
         reject();
       },
     });
   });
 }
 
-// Compares the security state of the page with what is expected
-function isSecurityState(expectedState) {
-  let ui = gTestBrowser.securityUI;
-  if (!ui) {
-    ok(false, "No security UI to get the security state");
-    return;
-  }
-
-  const wpl = Components.interfaces.nsIWebProgressListener;
-
-  // determine the security state
-  let isSecure = ui.state & wpl.STATE_IS_SECURE;
-  let isBroken = ui.state & wpl.STATE_IS_BROKEN;
-  let isInsecure = ui.state & wpl.STATE_IS_INSECURE;
-
-  let actualState;
-  if (isSecure && !(isBroken || isInsecure)) {
-    actualState = "secure";
-  } else if (isBroken && !(isSecure || isInsecure)) {
-    actualState = "broken";
-  } else if (isInsecure && !(isSecure || isBroken)) {
-    actualState = "insecure";
-  } else {
-    actualState = "unknown";
-  }
-
-  is(expectedState, actualState, "Expected state " + expectedState + " and the actual state is " + actualState + ".");
-}
-
 /**
  * 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);
--- a/browser/base/content/test/siteIdentity/browser.ini
+++ b/browser/base/content/test/siteIdentity/browser.ini
@@ -1,6 +1,91 @@
 [DEFAULT]
 support-files =
   head.js
+  !/image/test/mochitest/blue.png
 
+[browser_bug435035.js]
+support-files =
+  test_bug435035.html
+[browser_bug822367.js]
+tags = mcb
+support-files =
+  file_bug822367_1.html
+  file_bug822367_1.js
+  file_bug822367_2.html
+  file_bug822367_3.html
+  file_bug822367_4.html
+  file_bug822367_4.js
+  file_bug822367_4B.html
+  file_bug822367_5.html
+  file_bug822367_6.html
+[browser_bug902156.js]
+tags = mcb
+support-files =
+  file_bug902156.js
+  file_bug902156_1.html
+  file_bug902156_2.html
+  file_bug902156_3.html
+[browser_bug906190.js]
+tags = mcb
+support-files =
+  file_bug906190_1.html
+  file_bug906190_2.html
+  file_bug906190_3_4.html
+  file_bug906190_redirected.html
+  file_bug906190.js
+  file_bug906190.sjs
+[browser_bug1045809.js]
+tags = mcb
+support-files =
+  file_bug1045809_1.html
+  file_bug1045809_2.html
+[browser_csp_block_all_mixedcontent.js]
+tags = mcb
+support-files =
+  file_csp_block_all_mixedcontent.html
+  file_csp_block_all_mixedcontent.js
+[browser_identity_UI.js]
 [browser_identityBlock_focus.js]
 support-files = ../general/permissions.html
+[browser_insecureLoginForms.js]
+support-files =
+  insecure_opener.html
+  !/toolkit/components/passwordmgr/test/browser/form_basic.html
+  !/toolkit/components/passwordmgr/test/browser/insecure_test.html
+  !/toolkit/components/passwordmgr/test/browser/insecure_test_subframe.html
+[browser_mcb_redirect.js]
+tags = mcb
+support-files =
+  test_mcb_redirect.html
+  test_mcb_redirect_image.html
+  test_mcb_double_redirect_image.html
+  test_mcb_redirect.js
+  test_mcb_redirect.sjs
+[browser_mixed_content_cert_override.js]
+tags = mcb
+support-files =
+  test-mixedcontent-securityerrors.html
+[browser_mixedcontent_securityflags.js]
+tags = mcb
+support-files =
+  test-mixedcontent-securityerrors.html
+[browser_mixedContentFramesOnHttp.js]
+tags = mcb
+support-files =
+  file_mixedContentFramesOnHttp.html
+  file_mixedPassiveContent.html
+[browser_mixedContentFromOnunload.js]
+tags = mcb
+support-files =
+  file_mixedContentFromOnunload.html
+  file_mixedContentFromOnunload_test1.html
+  file_mixedContentFromOnunload_test2.html
+[browser_no_mcb_on_http_site.js]
+tags = mcb
+support-files =
+  test_no_mcb_on_http_site_img.html
+  test_no_mcb_on_http_site_img.css
+  test_no_mcb_on_http_site_font.html
+  test_no_mcb_on_http_site_font.css
+  test_no_mcb_on_http_site_font2.html
+  test_no_mcb_on_http_site_font2.css
rename from browser/base/content/test/general/browser_bug1045809.js
rename to browser/base/content/test/siteIdentity/browser_bug1045809.js
--- a/browser/base/content/test/general/browser_bug1045809.js
+++ b/browser/base/content/test/siteIdentity/browser_bug1045809.js
@@ -1,33 +1,31 @@
 // Test that the Mixed Content Doorhanger Action to re-enable protection works
 
 const PREF_ACTIVE = "security.mixed_content.block_active_content";
+const TEST_URL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com") + "file_bug1045809_1.html";
 
 var origBlockActive;
 
 add_task(function* () {
   registerCleanupFunction(function() {
     Services.prefs.setBoolPref(PREF_ACTIVE, origBlockActive);
     gBrowser.removeCurrentTab();
   });
 
   // Store original preferences so we can restore settings after testing
   origBlockActive = Services.prefs.getBoolPref(PREF_ACTIVE);
 
   // Make sure mixed content blocking is on
   Services.prefs.setBoolPref(PREF_ACTIVE, true);
 
-  var url =
-    "https://test1.example.com/browser/browser/base/content/test/general/" +
-    "file_bug1045809_1.html";
   let tab = gBrowser.selectedTab = gBrowser.addTab();
 
   // Test 1: mixed content must be blocked
-  yield promiseTabLoadEvent(tab, url);
+  yield promiseTabLoadEvent(tab, TEST_URL);
   yield* test1(gBrowser.getBrowserForTab(tab));
 
   yield promiseTabLoadEvent(tab);
   // Test 2: mixed content must NOT be blocked
   yield* test2(gBrowser.getBrowserForTab(tab));
 
   // Test 3: mixed content must be blocked again
   yield promiseTabLoadEvent(tab);
rename from browser/base/content/test/general/browser_bug435035.js
rename to browser/base/content/test/siteIdentity/browser_bug435035.js
--- a/browser/base/content/test/general/browser_bug435035.js
+++ b/browser/base/content/test/siteIdentity/browser_bug435035.js
@@ -1,17 +1,17 @@
+const TEST_URL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com") + "test_bug435035.html";
+
 function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
   BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser).then(() => {
     is(document.getElementById("identity-box").className,
        "unknownIdentity mixedDisplayContent",
        "identity box has class name for mixed content");
 
     gBrowser.removeCurrentTab();
     finish();
   });
 
-  gBrowser.loadURI(
-    "https://example.com/browser/browser/base/content/test/general/test_bug435035.html"
-  );
+  gBrowser.loadURI(TEST_URL);
 }
rename from browser/base/content/test/general/browser_bug822367.js
rename to browser/base/content/test/siteIdentity/browser_bug822367.js
--- a/browser/base/content/test/general/browser_bug822367.js
+++ b/browser/base/content/test/siteIdentity/browser_bug822367.js
@@ -2,18 +2,18 @@
  * User Override Mixed Content Block - Tests for Bug 822367
  */
 
 
 const PREF_DISPLAY = "security.mixed_content.block_display_content";
 const PREF_ACTIVE = "security.mixed_content.block_active_content";
 
 // We alternate for even and odd test cases to simulate different hosts
-const gHttpTestRoot = "https://example.com/browser/browser/base/content/test/general/";
-const gHttpTestRoot2 = "https://test1.example.com/browser/browser/base/content/test/general/";
+const HTTPS_TEST_ROOT = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com");
+const HTTPS_TEST_ROOT_2 = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://test1.example.com");
 
 var gTestBrowser = null;
 
 registerCleanupFunction(function() {
   // Set preferences back to their original values
   Services.prefs.clearUserPref(PREF_DISPLAY);
   Services.prefs.clearUserPref(PREF_ACTIVE);
 });
@@ -32,164 +32,164 @@ function test() {
 
   var newTab = gBrowser.addTab();
   gBrowser.selectedTab = newTab;
   gTestBrowser = gBrowser.selectedBrowser;
   newTab.linkedBrowser.stop()
 
   // Mixed Script Test
   gTestBrowser.addEventListener("load", MixedTest1A, true);
-  var url = gHttpTestRoot + "file_bug822367_1.html";
+  var url = HTTPS_TEST_ROOT + "file_bug822367_1.html";
   gTestBrowser.contentWindow.location = url;
 }
 
 // Mixed Script Test
 function MixedTest1A() {
   gTestBrowser.removeEventListener("load", MixedTest1A, true);
   gTestBrowser.addEventListener("load", MixedTest1B, true);
 
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
 
   let {gIdentityHandler} = gTestBrowser.ownerGlobal;
   gIdentityHandler.disableMixedContentProtection();
 }
 function MixedTest1B() {
-  waitForCondition(() => content.document.getElementById("p1").innerHTML == "hello", MixedTest1C, "Waited too long for mixed script to run in Test 1");
+  BrowserTestUtils.waitForCondition(() => content.document.getElementById("p1").innerHTML == "hello", "Waited too long for mixed script to run in Test 1").then(MixedTest1C);
 }
 function MixedTest1C() {
   ok(content.document.getElementById("p1").innerHTML == "hello", "Mixed script didn't load in Test 1");
   gTestBrowser.removeEventListener("load", MixedTest1B, true);
   MixedTest2();
 }
 
 // Mixed Display Test - Doorhanger should not appear
 function MixedTest2() {
   gTestBrowser.addEventListener("load", MixedTest2A, true);
-  var url = gHttpTestRoot2 + "file_bug822367_2.html";
+  var url = HTTPS_TEST_ROOT_2 + "file_bug822367_2.html";
   gTestBrowser.contentWindow.location = url;
 }
 
 function MixedTest2A() {
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: false, passiveLoaded: false});
   MixedTest3();
 }
 
 // Mixed Script and Display Test - User Override should cause both the script and the image to load.
 function MixedTest3() {
   gTestBrowser.removeEventListener("load", MixedTest2A, true);
   gTestBrowser.addEventListener("load", MixedTest3A, true);
-  var url = gHttpTestRoot + "file_bug822367_3.html";
+  var url = HTTPS_TEST_ROOT + "file_bug822367_3.html";
   gTestBrowser.contentWindow.location = url;
 }
 function MixedTest3A() {
   gTestBrowser.removeEventListener("load", MixedTest3A, true);
   gTestBrowser.addEventListener("load", MixedTest3B, true);
 
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
 
   let {gIdentityHandler} = gTestBrowser.ownerGlobal;
   gIdentityHandler.disableMixedContentProtection();
 }
 function MixedTest3B() {
-  waitForCondition(() => content.document.getElementById("p1").innerHTML == "hello", MixedTest3C, "Waited too long for mixed script to run in Test 3");
+  BrowserTestUtils.waitForCondition(() => content.document.getElementById("p1").innerHTML == "hello", "Waited too long for mixed script to run in Test 3").then(MixedTest3C);
 }
 function MixedTest3C() {
-  waitForCondition(() => content.document.getElementById("p2").innerHTML == "bye", MixedTest3D, "Waited too long for mixed image to load in Test 3");
+  BrowserTestUtils.waitForCondition(() => content.document.getElementById("p2").innerHTML == "bye", "Waited too long for mixed image to load in Test 3").then(MixedTest3D);
 }
 function MixedTest3D() {
   ok(content.document.getElementById("p1").innerHTML == "hello", "Mixed script didn't load in Test 3");
   ok(content.document.getElementById("p2").innerHTML == "bye", "Mixed image didn't load in Test 3");
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: true});
   MixedTest4();
 }
 
 // Location change - User override on one page doesn't propogate to another page after location change.
 function MixedTest4() {
   gTestBrowser.removeEventListener("load", MixedTest3B, true);
   gTestBrowser.addEventListener("load", MixedTest4A, true);
-  var url = gHttpTestRoot2 + "file_bug822367_4.html";
+  var url = HTTPS_TEST_ROOT_2 + "file_bug822367_4.html";
   gTestBrowser.contentWindow.location = url;
 }
 function MixedTest4A() {
   gTestBrowser.removeEventListener("load", MixedTest4A, true);
   gTestBrowser.addEventListener("load", MixedTest4B, true);
 
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
 
   let {gIdentityHandler} = gTestBrowser.ownerGlobal;
   gIdentityHandler.disableMixedContentProtection();
 }
 function MixedTest4B() {
-  waitForCondition(() => content.document.location == gHttpTestRoot + "file_bug822367_4B.html", MixedTest4C, "Waited too long for mixed script to run in Test 4");
+  BrowserTestUtils.waitForCondition(() => content.document.location == HTTPS_TEST_ROOT + "file_bug822367_4B.html", "Waited too long for mixed script to run in Test 4").then(MixedTest4C);
 }
 function MixedTest4C() {
-  ok(content.document.location == gHttpTestRoot + "file_bug822367_4B.html", "Location didn't change in test 4");
+  ok(content.document.location == HTTPS_TEST_ROOT + "file_bug822367_4B.html", "Location didn't change in test 4");
 
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
 
-  waitForCondition(() => content.document.getElementById("p1").innerHTML == "", MixedTest4D, "Mixed script loaded in test 4 after location change!");
+  BrowserTestUtils.waitForCondition(() => content.document.getElementById("p1").innerHTML == "", "Mixed script loaded in test 4 after location change!").then(MixedTest4D);
 }
 function MixedTest4D() {
   ok(content.document.getElementById("p1").innerHTML == "", "p1.innerHTML changed; mixed script loaded after location change in Test 4");
   MixedTest5();
 }
 
 // Mixed script attempts to load in a document.open()
 function MixedTest5() {
   gTestBrowser.removeEventListener("load", MixedTest4B, true);
   gTestBrowser.addEventListener("load", MixedTest5A, true);
-  var url = gHttpTestRoot + "file_bug822367_5.html";
+  var url = HTTPS_TEST_ROOT + "file_bug822367_5.html";
   gTestBrowser.contentWindow.location = url;
 }
 function MixedTest5A() {
   gTestBrowser.removeEventListener("load", MixedTest5A, true);
   gTestBrowser.addEventListener("load", MixedTest5B, true);
 
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
 
   let {gIdentityHandler} = gTestBrowser.ownerGlobal;
   gIdentityHandler.disableMixedContentProtection();
 }
 function MixedTest5B() {
-  waitForCondition(() => content.document.getElementById("p1").innerHTML == "hello", MixedTest5C, "Waited too long for mixed script to run in Test 5");
+  BrowserTestUtils.waitForCondition(() => content.document.getElementById("p1").innerHTML == "hello", "Waited too long for mixed script to run in Test 5").then(MixedTest5C);
 }
 function MixedTest5C() {
   ok(content.document.getElementById("p1").innerHTML == "hello", "Mixed script didn't load in Test 5");
   MixedTest6();
 }
 
 // Mixed script attempts to load in a document.open() that is within an iframe.
 function MixedTest6() {
   gTestBrowser.removeEventListener("load", MixedTest5B, true);
   gTestBrowser.addEventListener("load", MixedTest6A, true);
-  var url = gHttpTestRoot2 + "file_bug822367_6.html";
+  var url = HTTPS_TEST_ROOT_2 + "file_bug822367_6.html";
   gTestBrowser.contentWindow.location = url;
 }
 function MixedTest6A() {
   gTestBrowser.removeEventListener("load", MixedTest6A, true);
   let {gIdentityHandler} = gTestBrowser.ownerGlobal;
-  waitForCondition(() => gIdentityHandler._identityBox.classList.contains("mixedActiveBlocked"), MixedTest6B, "Waited too long for control center to get mixed active blocked state");
+  BrowserTestUtils.waitForCondition(() => gIdentityHandler._identityBox.classList.contains("mixedActiveBlocked"), "Waited too long for control center to get mixed active blocked state").then(MixedTest6B);
 }
 
 function MixedTest6B() {
   gTestBrowser.addEventListener("load", MixedTest6C, true);
 
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
 
   let {gIdentityHandler} = gTestBrowser.ownerGlobal;
   gIdentityHandler.disableMixedContentProtection();
 }
 
 function MixedTest6C() {
   gTestBrowser.removeEventListener("load", MixedTest6C, true);
-  waitForCondition(function() {
+  BrowserTestUtils.waitForCondition(function() {
     try {
       return content.document.getElementById("f1").contentDocument.getElementById("p1").innerHTML == "hello";
     } catch (e) {
       return false;
     }
-  }, MixedTest6D, "Waited too long for mixed script to run in Test 6");
+  }, "Waited too long for mixed script to run in Test 6").then(MixedTest6D);
 }
 function MixedTest6D() {
   ok(content.document.getElementById("f1").contentDocument.getElementById("p1").innerHTML == "hello", "Mixed script didn't load in Test 6");
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: false});
   MixedTestsCompleted();
 }
rename from browser/base/content/test/general/browser_bug902156.js
rename to browser/base/content/test/siteIdentity/browser_bug902156.js
--- a/browser/base/content/test/general/browser_bug902156.js
+++ b/browser/base/content/test/siteIdentity/browser_bug902156.js
@@ -20,18 +20,18 @@
  *      we navigated away from html page where we disabled the protection.
  *
  * Note, for all tests we set gHttpTestRoot to use 'https'.
  */
 
 const PREF_ACTIVE = "security.mixed_content.block_active_content";
 
 // We alternate for even and odd test cases to simulate different hosts
-const gHttpTestRoot1 = "https://test1.example.com/browser/browser/base/content/test/general/";
-const gHttpTestRoot2 = "https://test2.example.com/browser/browser/base/content/test/general/";
+const HTTPS_TEST_ROOT_1 = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://test1.example.com");
+const HTTPS_TEST_ROOT_2 = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://test2.example.com");
 
 var origBlockActive;
 var gTestBrowser = null;
 
 registerCleanupFunction(function() {
   // Set preferences back to their original values
   Services.prefs.setBoolPref(PREF_ACTIVE, origBlockActive);
 });
@@ -51,30 +51,30 @@ function test1A() {
 
   // Disable Mixed Content Protection for the page (and reload)
   let {gIdentityHandler} = gTestBrowser.ownerGlobal;
   gIdentityHandler.disableMixedContentProtection();
 }
 
 function test1B() {
   var expected = "Mixed Content Blocker disabled";
-  waitForCondition(
+  BrowserTestUtils.waitForCondition(
     () => content.document.getElementById("mctestdiv").innerHTML == expected,
-    test1C, "Error: Waited too long for mixed script to run in Test 1B");
+    "Error: Waited too long for mixed script to run in Test 1B").then(test1C);
 }
 
 function test1C() {
   var actual = content.document.getElementById("mctestdiv").innerHTML;
   is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 1C");
 
   // The Script loaded after we disabled the page, now we are going to reload the
   // page and see if our decision is persistent
   BrowserTestUtils.browserLoaded(gTestBrowser).then(test1D);
 
-  var url = gHttpTestRoot1 + "file_bug902156_2.html";
+  var url = HTTPS_TEST_ROOT_1 + "file_bug902156_2.html";
   gTestBrowser.loadURI(url);
 }
 
 function test1D() {
   // The Control Center button should appear but isMixedContentBlocked should be NOT true,
   // because our decision of disabling the mixed content blocker is persistent.
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: true, activeBlocked: false, passiveLoaded: false});
 
@@ -84,35 +84,35 @@ function test1D() {
   // move on to Test 2
   test2();
 }
 
 // ------------------------ Test 2 ------------------------------
 
 function test2() {
   BrowserTestUtils.browserLoaded(gTestBrowser).then(test2A);
-  var url = gHttpTestRoot2 + "file_bug902156_2.html";
+  var url = HTTPS_TEST_ROOT_2 + "file_bug902156_2.html";
   gTestBrowser.loadURI(url);
 }
 
 function test2A() {
   BrowserTestUtils.browserLoaded(gTestBrowser).then(test2B);
 
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
 
   // Disable Mixed Content Protection for the page (and reload)
   let {gIdentityHandler} = gTestBrowser.ownerGlobal;
   gIdentityHandler.disableMixedContentProtection();
 }
 
 function test2B() {
   var expected = "Mixed Content Blocker disabled";
-  waitForCondition(
+  BrowserTestUtils.waitForCondition(
     () => content.document.getElementById("mctestdiv").innerHTML == expected,
-    test2C, "Error: Waited too long for mixed script to run in Test 2B");
+    "Error: Waited too long for mixed script to run in Test 2B").then(test2C);
 }
 
 function test2C() {
   var actual = content.document.getElementById("mctestdiv").innerHTML;
   is(actual, "Mixed Content Blocker disabled", "OK: Executed mixed script in Test 2C");
 
   // The Script loaded after we disabled the page, now we are going to reload the
   // page and see if our decision is persistent
@@ -134,17 +134,17 @@ function test2D() {
   // move on to Test 3
   test3();
 }
 
 // ------------------------ Test 3 ------------------------------
 
 function test3() {
   BrowserTestUtils.browserLoaded(gTestBrowser).then(test3A);
-  var url = gHttpTestRoot1 + "file_bug902156_3.html";
+  var url = HTTPS_TEST_ROOT_1 + "file_bug902156_3.html";
   gTestBrowser.loadURI(url);
 }
 
 function test3A() {
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
 
   // We are done with tests, clean up
   cleanUpAfterTests();
@@ -164,11 +164,11 @@ function test() {
   // Not really sure what this is doing
   var newTab = gBrowser.addTab();
   gBrowser.selectedTab = newTab;
   gTestBrowser = gBrowser.selectedBrowser;
   newTab.linkedBrowser.stop()
 
   // Starting Test Number 1:
   BrowserTestUtils.browserLoaded(gTestBrowser).then(test1A);
-  var url = gHttpTestRoot1 + "file_bug902156_1.html";
+  var url = HTTPS_TEST_ROOT_1 + "file_bug902156_1.html";
   gTestBrowser.loadURI(url);
 }
rename from browser/base/content/test/general/browser_bug906190.js
rename to browser/base/content/test/siteIdentity/browser_bug906190.js
--- a/browser/base/content/test/general/browser_bug906190.js
+++ b/browser/base/content/test/siteIdentity/browser_bug906190.js
@@ -5,18 +5,18 @@
  * Tests the persistence of the "disable protection" option for Mixed Content
  * Blocker in child tabs (bug 906190).
  */
 
 requestLongerTimeout(2);
 
 // We use the different urls for testing same origin checks before allowing
 // mixed content on child tabs.
-const gHttpTestRoot1 = "https://test1.example.com/browser/browser/base/content/test/general/";
-const gHttpTestRoot2 = "https://test2.example.com/browser/browser/base/content/test/general/";
+const HTTPS_TEST_ROOT_1 = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://test1.example.com");
+const HTTPS_TEST_ROOT_2 = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://test2.example.com");
 
 /**
  * For all tests, we load the pages over HTTPS and test both:
  *   - |CTRL+CLICK|
  *   - |RIGHT CLICK -> OPEN LINK IN TAB|
  */
 function* doTest(parentTabSpec, childTabSpec, testTaskFn, waitForMetaRefresh) {
   yield BrowserTestUtils.withNewTab({
@@ -30,17 +30,17 @@ function* doTest(parentTabSpec, childTab
 
     // Disable the Mixed Content Blocker for the page, which reloads it.
     let promiseReloaded = BrowserTestUtils.browserLoaded(browser);
     gIdentityHandler.disableMixedContentProtection();
     yield promiseReloaded;
 
     // Wait for the script in the page to update the contents of the test div.
     let testDiv = content.document.getElementById("mctestdiv");
-    yield promiseWaitForCondition(
+    yield BrowserTestUtils.waitForCondition(
       () => testDiv.innerHTML == "Mixed Content Blocker disabled");
 
     // Add the link for the child tab to the page.
     let mainDiv = content.document.createElement("div");
     mainDiv.innerHTML =
       '<p><a id="linkToOpenInNewTab" href="' + childTabSpec + '">Link</a></p>';
     content.document.body.appendChild(mainDiv);
 
@@ -106,18 +106,18 @@ add_task(function* test_initialize() {
 
 /**
  * 1. - Load a html page which has mixed content
  *    - Doorhanger to disable protection appears - we disable it
  *    - Load a subpage from the same origin in a new tab simulating a click
  *    - Doorhanger should >> NOT << appear anymore!
  */
 add_task(function* test_same_origin() {
-  yield doTest(gHttpTestRoot1 + "file_bug906190_1.html",
-               gHttpTestRoot1 + "file_bug906190_2.html", function* () {
+  yield doTest(HTTPS_TEST_ROOT_1 + "file_bug906190_1.html",
+               HTTPS_TEST_ROOT_1 + "file_bug906190_2.html", function* () {
     // The doorhanger should appear but activeBlocked should be >> NOT << true,
     // because our decision of disabling the mixed content blocker is persistent
     // across tabs.
     yield assertMixedContentBlockingState(gBrowser, {
       activeLoaded: true, activeBlocked: false, passiveLoaded: false,
     });
 
     is(content.document.getElementById("mctestdiv").innerHTML,
@@ -127,18 +127,18 @@ add_task(function* test_same_origin() {
 
 /**
  * 2. - Load a html page which has mixed content
  *    - Doorhanger to disable protection appears - we disable it
  *    - Load a new page from a different origin in a new tab simulating a click
  *    - Doorhanger >> SHOULD << appear again!
  */
 add_task(function* test_different_origin() {
-  yield doTest(gHttpTestRoot1 + "file_bug906190_2.html",
-               gHttpTestRoot2 + "file_bug906190_2.html", function* () {
+  yield doTest(HTTPS_TEST_ROOT_1 + "file_bug906190_2.html",
+               HTTPS_TEST_ROOT_2 + "file_bug906190_2.html", function* () {
     // The doorhanger should appear and activeBlocked should be >> TRUE <<,
     // because our decision of disabling the mixed content blocker should only
     // persist if pages are from the same domain.
     yield assertMixedContentBlockingState(gBrowser, {
       activeLoaded: false, activeBlocked: true, passiveLoaded: false,
     });
 
     is(content.document.getElementById("mctestdiv").innerHTML,
@@ -150,18 +150,18 @@ add_task(function* test_different_origin
  * 3. - Load a html page which has mixed content
  *    - Doorhanger to disable protection appears - we disable it
  *    - Load a new page from the same origin in a new tab simulating a click
  *    - Redirect to another page from the same origin using meta-refresh
  *    - Doorhanger should >> NOT << appear again!
  */
 add_task(function* test_same_origin_metarefresh_same_origin() {
   // file_bug906190_3_4.html redirects to page test1.example.com/* using meta-refresh
-  yield doTest(gHttpTestRoot1 + "file_bug906190_1.html",
-               gHttpTestRoot1 + "file_bug906190_3_4.html", function* () {
+  yield doTest(HTTPS_TEST_ROOT_1 + "file_bug906190_1.html",
+               HTTPS_TEST_ROOT_1 + "file_bug906190_3_4.html", function* () {
     // The doorhanger should appear but activeBlocked should be >> NOT << true!
     yield assertMixedContentBlockingState(gBrowser, {
       activeLoaded: true, activeBlocked: false, passiveLoaded: false,
     });
 
     is(content.document.getElementById("mctestdiv").innerHTML,
        "Mixed Content Blocker disabled", "OK: Executed mixed script");
   }, true);
@@ -170,18 +170,18 @@ add_task(function* test_same_origin_meta
 /**
  * 4. - Load a html page which has mixed content
  *    - Doorhanger to disable protection appears - we disable it
  *    - Load a new page from the same origin in a new tab simulating a click
  *    - Redirect to another page from a different origin using meta-refresh
  *    - Doorhanger >> SHOULD << appear again!
  */
 add_task(function* test_same_origin_metarefresh_different_origin() {
-  yield doTest(gHttpTestRoot2 + "file_bug906190_1.html",
-               gHttpTestRoot2 + "file_bug906190_3_4.html", function* () {
+  yield doTest(HTTPS_TEST_ROOT_2 + "file_bug906190_1.html",
+               HTTPS_TEST_ROOT_2 + "file_bug906190_3_4.html", function* () {
     // The doorhanger should appear and activeBlocked should be >> TRUE <<.
     yield assertMixedContentBlockingState(gBrowser, {
       activeLoaded: false, activeBlocked: true, passiveLoaded: false,
     });
 
     is(content.document.getElementById("mctestdiv").innerHTML,
        "Mixed Content Blocker enabled", "OK: Blocked mixed script");
   }, true);
@@ -190,18 +190,18 @@ add_task(function* test_same_origin_meta
 /**
  * 5. - Load a html page which has mixed content
  *    - Doorhanger to disable protection appears - we disable it
  *    - Load a new page from the same origin in a new tab simulating a click
  *    - Redirect to another page from the same origin using 302 redirect
  */
 add_task(function* test_same_origin_302redirect_same_origin() {
   // the sjs files returns a 302 redirect- note, same origins
-  yield doTest(gHttpTestRoot1 + "file_bug906190_1.html",
-               gHttpTestRoot1 + "file_bug906190.sjs", function* () {
+  yield doTest(HTTPS_TEST_ROOT_1 + "file_bug906190_1.html",
+               HTTPS_TEST_ROOT_1 + "file_bug906190.sjs", function* () {
     // The doorhanger should appear but activeBlocked should be >> NOT << true.
     // Currently it is >> TRUE << - see follow up bug 914860
     ok(!gIdentityHandler._identityBox.classList.contains("mixedActiveBlocked"),
        "OK: Mixed Content is NOT being blocked");
 
     is(content.document.getElementById("mctestdiv").innerHTML,
        "Mixed Content Blocker disabled", "OK: Executed mixed script");
   });
@@ -210,31 +210,31 @@ add_task(function* test_same_origin_302r
 /**
  * 6. - Load a html page which has mixed content
  *    - Doorhanger to disable protection appears - we disable it
  *    - Load a new page from the same origin in a new tab simulating a click
  *    - Redirect to another page from a different origin using 302 redirect
  */
 add_task(function* test_same_origin_302redirect_different_origin() {
   // the sjs files returns a 302 redirect - note, different origins
-  yield doTest(gHttpTestRoot2 + "file_bug906190_1.html",
-               gHttpTestRoot2 + "file_bug906190.sjs", function* () {
+  yield doTest(HTTPS_TEST_ROOT_2 + "file_bug906190_1.html",
+               HTTPS_TEST_ROOT_2 + "file_bug906190.sjs", function* () {
     // The doorhanger should appear and activeBlocked should be >> TRUE <<.
     yield assertMixedContentBlockingState(gBrowser, {
       activeLoaded: false, activeBlocked: true, passiveLoaded: false,
     });
 
     is(content.document.getElementById("mctestdiv").innerHTML,
        "Mixed Content Blocker enabled", "OK: Blocked mixed script");
   });
 });
 
 /**
  * 7. - Test memory leak issue on redirection error. See Bug 1269426.
  */
 add_task(function* test_bad_redirection() {
   // the sjs files returns a 302 redirect - note, different origins
-  yield doTest(gHttpTestRoot2 + "file_bug906190_1.html",
-               gHttpTestRoot2 + "file_bug906190.sjs?bad-redirection=1", function* () {
+  yield doTest(HTTPS_TEST_ROOT_2 + "file_bug906190_1.html",
+               HTTPS_TEST_ROOT_2 + "file_bug906190.sjs?bad-redirection=1", function* () {
     // Nothing to do. Just see if memory leak is reported in the end.
     ok(true, "Nothing to do");
   });
 });
rename from browser/base/content/test/general/browser_csp_block_all_mixedcontent.js
rename to browser/base/content/test/siteIdentity/browser_csp_block_all_mixedcontent.js
--- a/browser/base/content/test/general/browser_csp_block_all_mixedcontent.js
+++ b/browser/base/content/test/siteIdentity/browser_csp_block_all_mixedcontent.js
@@ -1,17 +1,17 @@
 /*
  * Description of the Test:
  * We load an https page which uses a CSP including block-all-mixed-content.
  * The page tries to load a script over http. We make sure the UI is not
  * influenced when blocking the mixed content. In particular the page
  * should still appear fully encrypted with a green lock.
  */
 
-const PRE_PATH = "https://example.com/browser/browser/base/content/test/general/";
+const PRE_PATH = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com");
 var gTestBrowser = null;
 
 // ------------------------------------------------------
 function cleanUpAfterTests() {
   gBrowser.removeCurrentTab();
   window.focus();
   finish();
 }
rename from browser/base/content/test/general/browser_identity_UI.js
rename to browser/base/content/test/siteIdentity/browser_identity_UI.js
--- a/browser/base/content/test/general/browser_identity_UI.js
+++ b/browser/base/content/test/siteIdentity/browser_identity_UI.js
@@ -94,22 +94,22 @@ function nextTest() {
     }
 
     // Navigate to the next page, which will cause checkResult to fire.
     let spec = gBrowser.selectedBrowser.currentURI.spec;
     if (spec == "about:blank" || spec == gCurrentTest.location) {
       BrowserTestUtils.loadURI(gBrowser.selectedBrowser, gCurrentTest.location);
     } else {
       // Open the Control Center and make sure it closes after nav (Bug 1207542).
-      let popupShown = promisePopupShown(gIdentityHandler._identityPopup);
-      gPopupHidden = promisePopupHidden(gIdentityHandler._identityPopup);
+      let popupShown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
+      gPopupHidden = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popuphidden");
       gIdentityHandler._identityBox.click();
       info("Waiting for the Control Center to be shown");
       popupShown.then(() => {
-        is_element_visible(gIdentityHandler._identityPopup, "Control Center is visible");
+        ok(!is_hidden(gIdentityHandler._identityPopup), "Control Center is visible");
         // Show the subview, which is an easy way in automation to reproduce
         // Bug 1207542, where the CC wouldn't close on navigation.
         gBrowser.ownerDocument.querySelector("#identity-popup-security-expander").click();
         BrowserTestUtils.loadURI(gBrowser.selectedBrowser, gCurrentTest.location);
       });
     }
   } else {
     gCheckETLD = false;
@@ -135,15 +135,15 @@ function checkResult(event) {
   } else {
     is(gIdentityHandler.getEffectiveHost(), gCurrentTest.effectiveHost, "effectiveHost matches for test " + gTestDesc);
   }
 
   if (gPopupHidden) {
     info("Waiting for the Control Center to hide");
     gPopupHidden.then(() => {
       gPopupHidden = null;
-      is_element_hidden(gIdentityHandler._identityPopup, "control center is hidden");
+      ok(is_hidden(gIdentityHandler._identityPopup), "Control Center is hidden");
       executeSoon(nextTest);
     });
   } else {
     executeSoon(nextTest);
   }
 }
rename from browser/base/content/test/general/browser_insecureLoginForms.js
rename to browser/base/content/test/siteIdentity/browser_insecureLoginForms.js
--- a/browser/base/content/test/general/browser_insecureLoginForms.js
+++ b/browser/base/content/test/siteIdentity/browser_insecureLoginForms.js
@@ -36,17 +36,17 @@ add_task(function* test_simple() {
       waitForInsecureLoginFormsStateChange(browser, 2),
     ]);
 
     let { gIdentityHandler } = gBrowser.ownerGlobal;
     gIdentityHandler._identityBox.click();
     document.getElementById("identity-popup-security-expander").click();
 
     if (expectWarning) {
-      is_element_visible(document.getElementById("connection-icon"));
+      ok(is_visible(document.getElementById("connection-icon")), "Connection icon should be visible");
       let connectionIconImage = gBrowser.ownerGlobal
             .getComputedStyle(document.getElementById("connection-icon"))
             .getPropertyValue("list-style-image");
       let securityViewBG = gBrowser.ownerGlobal
             .getComputedStyle(document.getElementById("identity-popup-securityView"))
             .getPropertyValue("background-image");
       let securityContentBG = gBrowser.ownerGlobal
             .getComputedStyle(document.getElementById("identity-popup-security-content"))
rename from browser/base/content/test/general/browser_mcb_redirect.js
rename to browser/base/content/test/siteIdentity/browser_mcb_redirect.js
--- a/browser/base/content/test/general/browser_mcb_redirect.js
+++ b/browser/base/content/test/siteIdentity/browser_mcb_redirect.js
@@ -50,18 +50,18 @@
  *    https inside an https page
  *    - the image would have gone through two redirects: HTTPS->HTTP->HTTPS,
  *      but instead we try to use the cached image.
  *    - the image should not load
  */
 
 const PREF_ACTIVE = "security.mixed_content.block_active_content";
 const PREF_DISPLAY = "security.mixed_content.block_display_content";
-const gHttpsTestRoot = "https://example.com/browser/browser/base/content/test/general/";
-const gHttpTestRoot = "http://example.com/browser/browser/base/content/test/general/";
+const HTTPS_TEST_ROOT = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com");
+const HTTP_TEST_ROOT = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.com");
 
 var origBlockActive;
 var origBlockDisplay;
 var gTestBrowser = null;
 
 // ------------------------ Helper Functions ---------------------
 
 registerCleanupFunction(function() {
@@ -96,17 +96,17 @@ function waitForCondition(condition, nex
     clearInterval(interval); nextTest();
   };
 }
 
 // ------------------------ Test 1 ------------------------------
 
 function test1() {
   gTestBrowser.addEventListener("load", checkUIForTest1, true);
-  var url = gHttpsTestRoot + "test_mcb_redirect.html"
+  var url = HTTPS_TEST_ROOT + "test_mcb_redirect.html"
   gTestBrowser.contentWindow.location = url;
 }
 
 function checkUIForTest1() {
   gTestBrowser.removeEventListener("load", checkUIForTest1, true);
 
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: true, passiveLoaded: false});
 
@@ -116,17 +116,17 @@ function checkUIForTest1() {
     test2, "Error: Waited too long for status in Test 1!",
     "OK: Expected result in innerHTML for Test1!");
 }
 
 // ------------------------ Test 2 ------------------------------
 
 function test2() {
   gTestBrowser.addEventListener("load", checkUIForTest2, true);
-  var url = gHttpTestRoot + "test_mcb_redirect.html"
+  var url = HTTP_TEST_ROOT + "test_mcb_redirect.html"
   gTestBrowser.contentWindow.location = url;
 }
 
 function checkUIForTest2() {
   gTestBrowser.removeEventListener("load", checkUIForTest2, true);
 
   assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: false, passiveLoaded: false});
 
@@ -136,17 +136,17 @@ function checkUIForTest2() {
     test3, "Error: Waited too long for status in Test 2!",
     "OK: Expected result in innerHTML for Test2!");
 }
 
 // ------------------------ Test 3 ------------------------------
 // HTTPS page loading insecure image
 function test3() {
   gTestBrowser.addEventListener("load", checkLoadEventForTest3, true);
-  var url = gHttpsTestRoot + "test_mcb_redirect_image.html"
+  var url = HTTPS_TEST_ROOT + "test_mcb_redirect_image.html";
   gTestBrowser.contentWindow.location = url;
 }
 
 function checkLoadEventForTest3() {
   gTestBrowser.removeEventListener("load", checkLoadEventForTest3, true);
 
   var expected = "image blocked"
   waitForCondition(
@@ -154,17 +154,17 @@ function checkLoadEventForTest3() {
     test4, "Error: Waited too long for status in Test 3!",
     "OK: Expected result in innerHTML for Test3!");
 }
 
 // ------------------------ Test 4 ------------------------------
 // HTTP page loading insecure image
 function test4() {
   gTestBrowser.addEventListener("load", checkLoadEventForTest4, true);
-  var url = gHttpTestRoot + "test_mcb_redirect_image.html"
+  var url = HTTP_TEST_ROOT + "test_mcb_redirect_image.html";
   gTestBrowser.contentWindow.location = url;
 }
 
 function checkLoadEventForTest4() {
   gTestBrowser.removeEventListener("load", checkLoadEventForTest4, true);
 
   var expected = "image loaded"
   waitForCondition(
@@ -177,17 +177,17 @@ function checkLoadEventForTest4() {
 // HTTP page laoding insecure cached image
 // Assuming test 4 succeeded, the image has already been loaded once
 // and hence should be cached per the sjs cache-control header
 // Going into offline mode to ensure we are loading from the cache.
 function test5() {
   gTestBrowser.addEventListener("load", checkLoadEventForTest5, true);
   // Go into offline mode
   Services.io.offline = true;
-  var url = gHttpTestRoot + "test_mcb_redirect_image.html"
+  var url = HTTP_TEST_ROOT + "test_mcb_redirect_image.html";
   gTestBrowser.contentWindow.location = url;
 }
 
 function checkLoadEventForTest5() {
   gTestBrowser.removeEventListener("load", checkLoadEventForTest5, true);
 
   var expected = "image loaded"
   waitForCondition(
@@ -202,17 +202,17 @@ function checkLoadEventForTest5() {
 // HTTPS page loading insecure cached image
 // Assuming test 4 succeeded, the image has already been loaded once
 // and hence should be cached per the sjs cache-control header
 // Going into offline mode to ensure we are loading from the cache.
 function test6() {
   gTestBrowser.addEventListener("load", checkLoadEventForTest6, true);
   // Go into offline mode
   Services.io.offline = true;
-  var url = gHttpsTestRoot + "test_mcb_redirect_image.html"
+  var url = HTTPS_TEST_ROOT + "test_mcb_redirect_image.html";
   gTestBrowser.contentWindow.location = url;
 }
 
 function checkLoadEventForTest6() {
   gTestBrowser.removeEventListener("load", checkLoadEventForTest6, true);
 
   var expected = "image blocked"
   waitForCondition(
@@ -222,17 +222,17 @@ function checkLoadEventForTest6() {
   // Go back online
   Services.io.offline = false;
 }
 
 // ------------------------ Test 7 ------------------------------
 // HTTP page loading insecure image that went through a double redirect
 function test7() {
   gTestBrowser.addEventListener("load", checkLoadEventForTest7, true);
-  var url = gHttpTestRoot + "test_mcb_double_redirect_image.html"
+  var url = HTTP_TEST_ROOT + "test_mcb_double_redirect_image.html";
   gTestBrowser.contentWindow.location = url;
 }
 
 function checkLoadEventForTest7() {
   gTestBrowser.removeEventListener("load", checkLoadEventForTest7, true);
 
   var expected = "image loaded"
   waitForCondition(
@@ -245,17 +245,17 @@ function checkLoadEventForTest7() {
 // HTTP page loading insecure cached image that went through a double redirect
 // Assuming test 7 succeeded, the image has already been loaded once
 // and hence should be cached per the sjs cache-control header
 // Going into offline mode to ensure we are loading from the cache.
 function test8() {
   gTestBrowser.addEventListener("load", checkLoadEventForTest8, true);
   // Go into offline mode
   Services.io.offline = true;
-  var url = gHttpTestRoot + "test_mcb_double_redirect_image.html"
+  var url = HTTP_TEST_ROOT + "test_mcb_double_redirect_image.html";
   gTestBrowser.contentWindow.location = url;
 }
 
 function checkLoadEventForTest8() {
   gTestBrowser.removeEventListener("load", checkLoadEventForTest8, true);
 
   var expected = "image loaded"
   waitForCondition(
@@ -270,17 +270,17 @@ function checkLoadEventForTest8() {
 // HTTPS page loading insecure cached image that went through a double redirect
 // Assuming test 7 succeeded, the image has already been loaded once
 // and hence should be cached per the sjs cache-control header
 // Going into offline mode to ensure we are loading from the cache.
 function test9() {
   gTestBrowser.addEventListener("load", checkLoadEventForTest9, true);
   // Go into offline mode
   Services.io.offline = true;
-  var url = gHttpsTestRoot + "test_mcb_double_redirect_image.html"
+  var url = HTTPS_TEST_ROOT + "test_mcb_double_redirect_image.html";
   gTestBrowser.contentWindow.location = url;
 }
 
 function checkLoadEventForTest9() {
   gTestBrowser.removeEventListener("load", checkLoadEventForTest9, true);
 
   var expected = "image blocked"
   waitForCondition(
@@ -298,17 +298,19 @@ function test() {
   waitForExplicitFinish();
 
   // Store original preferences so we can restore settings after testing
   origBlockActive = Services.prefs.getBoolPref(PREF_ACTIVE);
   origBlockDisplay = Services.prefs.getBoolPref(PREF_DISPLAY);
   Services.prefs.setBoolPref(PREF_ACTIVE, true);
   Services.prefs.setBoolPref(PREF_DISPLAY, true);
 
-  pushPrefs(["dom.ipc.processCount", 1]).then(() => {
+  // TODO (Bug 1301015): This was forced into single process mode in
+  // bug 1301340, need to find a real fix.
+  SpecialPowers.pushPrefEnv({"set": [["dom.ipc.processCount", 1]]}, () => {
     var newTab = gBrowser.addTab();
     gBrowser.selectedTab = newTab;
     gTestBrowser = gBrowser.selectedBrowser;
     newTab.linkedBrowser.stop();
 
     executeSoon(test1);
   });
 }
rename from browser/base/content/test/general/browser_mixedContentFramesOnHttp.js
rename to browser/base/content/test/siteIdentity/browser_mixedContentFramesOnHttp.js
--- a/browser/base/content/test/general/browser_mixedContentFramesOnHttp.js
+++ b/browser/base/content/test/siteIdentity/browser_mixedContentFramesOnHttp.js
@@ -5,28 +5,23 @@
  * Test for Bug 1182551 -
  *
  * This test has a top level HTTP page with an HTTPS iframe.  The HTTPS iframe
  * includes an HTTP image.  We check that the top level security state is
  * STATE_IS_INSECURE.  The mixed content from the iframe shouldn't "upgrade"
  * the HTTP top level page to broken HTTPS.
  */
 
-const gHttpTestUrl = "http://example.com/browser/browser/base/content/test/general/file_mixedContentFramesOnHttp.html";
-
-var gTestBrowser = null;
+const TEST_URL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.com") + "file_mixedContentFramesOnHttp.html";
 
 add_task(function *() {
   yield SpecialPowers.pushPrefEnv({
     "set": [
       ["security.mixed_content.block_active_content", true],
       ["security.mixed_content.block_display_content", false]
     ]});
 
-  let url = gHttpTestUrl
-  yield BrowserTestUtils.withNewTab({gBrowser, url}, function*() {
-    gTestBrowser = gBrowser.selectedBrowser;
-    // check security state is insecure
-    isSecurityState("insecure");
-    assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: false, passiveLoaded: true});
+  yield BrowserTestUtils.withNewTab(TEST_URL, function*(browser) {
+    isSecurityState(browser, "insecure");
+    assertMixedContentBlockingState(browser, {activeLoaded: false, activeBlocked: false, passiveLoaded: true});
   });
 });
 
rename from browser/base/content/test/general/browser_mixedContentFromOnunload.js
rename to browser/base/content/test/siteIdentity/browser_mixedContentFromOnunload.js
--- a/browser/base/content/test/general/browser_mixedContentFromOnunload.js
+++ b/browser/base/content/test/siteIdentity/browser_mixedContentFromOnunload.js
@@ -3,45 +3,43 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  *
  * Tests for Bug 947079 - Fix bug in nsSecureBrowserUIImpl that sets the wrong
  * security state on a page because of a subresource load that is not on the
  * same page.
  */
 
 // We use different domains for each test and for navigation within each test
-const gHttpTestRoot1 = "http://example.com/browser/browser/base/content/test/general/";
-const gHttpsTestRoot1 = "https://test1.example.com/browser/browser/base/content/test/general/";
-const gHttpTestRoot2 = "http://example.net/browser/browser/base/content/test/general/";
-const gHttpsTestRoot2 = "https://test2.example.com/browser/browser/base/content/test/general/";
+const HTTP_TEST_ROOT_1 = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.com");
+const HTTPS_TEST_ROOT_1 = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://test1.example.com");
+const HTTP_TEST_ROOT_2 = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.net");
+const HTTPS_TEST_ROOT_2 = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://test2.example.com");
 
-var gTestBrowser = null;
 add_task(function *() {
-  let url = gHttpTestRoot1 + "file_mixedContentFromOnunload.html";
-  yield BrowserTestUtils.withNewTab({gBrowser, url}, function*() {
+  let url = HTTP_TEST_ROOT_1 + "file_mixedContentFromOnunload.html";
+  yield BrowserTestUtils.withNewTab(url, function*(browser) {
     yield SpecialPowers.pushPrefEnv({
       "set": [
         ["security.mixed_content.block_active_content", true],
         ["security.mixed_content.block_display_content", false]
       ]
     });
-  gTestBrowser = gBrowser.selectedBrowser;
-  // Navigation from an http page to a https page with no mixed content
-  // The http page loads an http image on unload
-  url = gHttpsTestRoot1 + "file_mixedContentFromOnunload_test1.html";
-  yield BrowserTestUtils.loadURI(gTestBrowser, url);
-  yield BrowserTestUtils.browserLoaded(gTestBrowser);
-  // check security state.  Since current url is https and doesn't have any
-  // mixed content resources, we expect it to be secure.
-  isSecurityState("secure");
-  assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: false, passiveLoaded: false});
-  // Navigation from an http page to a https page that has mixed display content
-  // The https page loads an http image on unload
-  url = gHttpTestRoot2 + "file_mixedContentFromOnunload.html";
-  yield BrowserTestUtils.loadURI(gTestBrowser, url);
-  yield BrowserTestUtils.browserLoaded(gTestBrowser);
-  url = gHttpsTestRoot2 + "file_mixedContentFromOnunload_test2.html";
-  yield BrowserTestUtils.loadURI(gTestBrowser, url);
-  yield BrowserTestUtils.browserLoaded(gTestBrowser);
-  isSecurityState("broken");
-  assertMixedContentBlockingState(gTestBrowser, {activeLoaded: false, activeBlocked: false, passiveLoaded: true});
+    // Navigation from an http page to a https page with no mixed content
+    // The http page loads an http image on unload
+    url = HTTPS_TEST_ROOT_1 + "file_mixedContentFromOnunload_test1.html";
+    yield BrowserTestUtils.loadURI(browser, url);
+    yield BrowserTestUtils.browserLoaded(browser);
+    // check security state.  Since current url is https and doesn't have any
+    // mixed content resources, we expect it to be secure.
+    isSecurityState(browser, "secure");
+    assertMixedContentBlockingState(browser, {activeLoaded: false, activeBlocked: false, passiveLoaded: false});
+    // Navigation from an http page to a https page that has mixed display content
+    // The https page loads an http image on unload
+    url = HTTP_TEST_ROOT_2 + "file_mixedContentFromOnunload.html";
+    yield BrowserTestUtils.loadURI(browser, url);
+    yield BrowserTestUtils.browserLoaded(browser);
+    url = HTTPS_TEST_ROOT_2 + "file_mixedContentFromOnunload_test2.html";
+    yield BrowserTestUtils.loadURI(browser, url);
+    yield BrowserTestUtils.browserLoaded(browser);
+    isSecurityState(browser, "broken");
+    assertMixedContentBlockingState(browser, {activeLoaded: false, activeBlocked: false, passiveLoaded: true});
   });
 });
rename from browser/base/content/test/general/browser_mixed_content_cert_override.js
rename to browser/base/content/test/siteIdentity/browser_mixed_content_cert_override.js
--- a/browser/base/content/test/general/browser_mixed_content_cert_override.js
+++ b/browser/base/content/test/siteIdentity/browser_mixed_content_cert_override.js
@@ -1,15 +1,15 @@
 /*
  * Bug 1253771 - check mixed content blocking in combination with overriden certificates
  */
 
 "use strict";
 
-const MIXED_CONTENT_URL = "https://self-signed.example.com/browser/browser/base/content/test/general/test-mixedcontent-securityerrors.html";
+const MIXED_CONTENT_URL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://self-signed.example.com") + "test-mixedcontent-securityerrors.html";
 
 function getConnectionState() {
   return document.getElementById("identity-popup").getAttribute("connection");
 }
 
 function getPopupContentVerifier() {
   return document.getElementById("identity-popup-content-verifier");
 }
rename from browser/base/content/test/general/browser_mixedcontent_securityflags.js
rename to browser/base/content/test/siteIdentity/browser_mixedcontent_securityflags.js
--- a/browser/base/content/test/general/browser_mixedcontent_securityflags.js
+++ b/browser/base/content/test/siteIdentity/browser_mixedcontent_securityflags.js
@@ -5,17 +5,17 @@
 // makes sure that the mixed content flags on the docshell are set correctly.
 // * Using default about:config prefs (mixed active blocked, mixed display
 //   loaded) we load the page and check the flags.
 // * We change the about:config prefs (mixed active blocked, mixed display
 //   blocked), reload the page, and check the flags again.
 // * We override protection so all mixed content can load and check the
 //   flags again.
 
-const TEST_URI = "https://example.com/browser/browser/base/content/test/general/test-mixedcontent-securityerrors.html";
+const TEST_URI = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com") + "test-mixedcontent-securityerrors.html";
 const PREF_DISPLAY = "security.mixed_content.block_display_content";
 const PREF_ACTIVE = "security.mixed_content.block_active_content";
 var gTestBrowser = null;
 
 registerCleanupFunction(function() {
   // Set preferences back to their original values
   Services.prefs.clearUserPref(PREF_DISPLAY);
   Services.prefs.clearUserPref(PREF_ACTIVE);
rename from browser/base/content/test/general/browser_no_mcb_on_http_site.js
rename to browser/base/content/test/siteIdentity/browser_no_mcb_on_http_site.js
--- a/browser/base/content/test/general/browser_no_mcb_on_http_site.js
+++ b/browser/base/content/test/siteIdentity/browser_no_mcb_on_http_site.js
@@ -21,29 +21,29 @@
 *
  * Since the top-domain is >> NOT << served using https, the MCB
  * should >> NOT << trigger a warning.
  */
 
 const PREF_ACTIVE = "security.mixed_content.block_active_content";
 const PREF_DISPLAY = "security.mixed_content.block_display_content";
 
-const gHttpTestRoot = "http://example.com/browser/browser/base/content/test/general/";
+const HTTP_TEST_ROOT = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.com");
 
 var gTestBrowser = null;
 
 function cleanUpAfterTests() {
   gBrowser.removeCurrentTab();
   window.focus();
 }
 
 add_task(function* init() {
   yield SpecialPowers.pushPrefEnv({ set: [[ PREF_ACTIVE, true ],
                                           [ PREF_DISPLAY, true ]] });
-  let url = gHttpTestRoot + "test_no_mcb_on_http_site_img.html";
+  let url = HTTP_TEST_ROOT + "test_no_mcb_on_http_site_img.html";
   let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, url)
   gTestBrowser = tab.linkedBrowser;
 });
 
 // ------------- TEST 1 -----------------------------------------
 
 add_task(function* test1() {
   let expected = "Verifying MCB does not trigger warning/error for an http page ";
@@ -54,17 +54,17 @@ add_task(function* test1() {
       () => content.document.getElementById("testDiv").innerHTML == condition,
       "Waited too long for status in Test 1!");
   });
 
   // Explicit OKs needed because the harness requires at least one call to ok.
   ok(true, "test 1 passed");
 
   // set up test 2
-  let url = gHttpTestRoot + "test_no_mcb_on_http_site_font.html";
+  let url = HTTP_TEST_ROOT + "test_no_mcb_on_http_site_font.html";
   BrowserTestUtils.loadURI(gTestBrowser, url);
   yield BrowserTestUtils.browserLoaded(gTestBrowser);
 });
 
 // ------------- TEST 2 -----------------------------------------
 
 add_task(function* test2() {
   let expected = "Verifying MCB does not trigger warning/error for an http page ";
@@ -74,17 +74,17 @@ add_task(function* test2() {
     yield ContentTaskUtils.waitForCondition(
       () => content.document.getElementById("testDiv").innerHTML == condition,
       "Waited too long for status in Test 2!");
   });
 
   ok(true, "test 2 passed");
 
   // set up test 3
-  let url = gHttpTestRoot + "test_no_mcb_on_http_site_font2.html";
+  let url = HTTP_TEST_ROOT + "test_no_mcb_on_http_site_font2.html";
   BrowserTestUtils.loadURI(gTestBrowser, url);
   yield BrowserTestUtils.browserLoaded(gTestBrowser);
 });
 
 // ------------- TEST 3 -----------------------------------------
 
 add_task(function* test3() {
   let expected = "Verifying MCB does not trigger warning/error for an http page "
rename from browser/base/content/test/general/file_bug1045809_1.html
rename to browser/base/content/test/siteIdentity/file_bug1045809_1.html
--- a/browser/base/content/test/general/file_bug1045809_1.html
+++ b/browser/base/content/test/siteIdentity/file_bug1045809_1.html
@@ -1,7 +1,7 @@
 <html>
   <head>
   </head>
   <body>
-    <iframe src="http://test1.example.com/browser/browser/base/content/test/general/file_bug1045809_2.html"></iframe>
+    <iframe src="http://test1.example.com/browser/browser/base/content/test/siteIdentity/file_bug1045809_2.html"></iframe>
   </body>
 </html>
rename from browser/base/content/test/general/file_bug1045809_2.html
rename to browser/base/content/test/siteIdentity/file_bug1045809_2.html
rename from browser/base/content/test/general/file_bug822367_1.html
rename to browser/base/content/test/siteIdentity/file_bug822367_1.html
--- a/browser/base/content/test/general/file_bug822367_1.html
+++ b/browser/base/content/test/siteIdentity/file_bug822367_1.html
@@ -7,12 +7,12 @@ https://bugzilla.mozilla.org/show_bug.cg
 <head>
   <meta charset="utf-8">
   <title>Test 1 for Bug 822367</title>
 </head>
 <body>
   <div id="testContent">
     <p id="p1"></p>
   </div>
-  <script src="http://example.com/browser/browser/base/content/test/general/file_bug822367_1.js">
+  <script src="http://example.com/browser/browser/base/content/test/siteIdentity/file_bug822367_1.js">
   </script>
 </body>
 </html>
rename from browser/base/content/test/general/file_bug822367_1.js
rename to browser/base/content/test/siteIdentity/file_bug822367_1.js
rename from browser/base/content/test/general/file_bug822367_2.html
rename to browser/base/content/test/siteIdentity/file_bug822367_2.html
rename from browser/base/content/test/general/file_bug822367_3.html
rename to browser/base/content/test/siteIdentity/file_bug822367_3.html
--- a/browser/base/content/test/general/file_bug822367_3.html
+++ b/browser/base/content/test/siteIdentity/file_bug822367_3.html
@@ -16,12 +16,12 @@ https://bugzilla.mozilla.org/show_bug.cg
   }
   </script>
 </head>
 <body>
   <div id="testContent">
     <p id="p1"></p>
     <img src="http://example.com/tests/image/test/mochitest/blue.png" onload="foo()">
   </div>
-  <script src="http://example.com/browser/browser/base/content/test/general/file_bug822367_1.js">
+  <script src="http://example.com/browser/browser/base/content/test/siteIdentity/file_bug822367_1.js">
   </script>
 </body>
 </html>
rename from browser/base/content/test/general/file_bug822367_4.html
rename to browser/base/content/test/siteIdentity/file_bug822367_4.html
--- a/browser/base/content/test/general/file_bug822367_4.html
+++ b/browser/base/content/test/siteIdentity/file_bug822367_4.html
@@ -7,12 +7,12 @@ https://bugzilla.mozilla.org/show_bug.cg
 <head>
   <meta charset="utf-8">
   <title>Test 4 for Bug 822367</title>
 </head>
 <body>
   <div id="testContent">
     <p id="p1"></p>
   </div>
-  <script src="http://example.com/browser/browser/base/content/test/general/file_bug822367_4.js">
+  <script src="http://example.com/browser/browser/base/content/test/siteIdentity/file_bug822367_4.js">
   </script>
 </body>
 </html>
rename from browser/base/content/test/general/file_bug822367_4.js
rename to browser/base/content/test/siteIdentity/file_bug822367_4.js
--- a/browser/base/content/test/general/file_bug822367_4.js
+++ b/browser/base/content/test/siteIdentity/file_bug822367_4.js
@@ -1,1 +1,1 @@
-document.location = "https://example.com/browser/browser/base/content/test/general/file_bug822367_4B.html";
+document.location = "https://example.com/browser/browser/base/content/test/siteIdentity/file_bug822367_4B.html";
rename from browser/base/content/test/general/file_bug822367_4B.html
rename to browser/base/content/test/siteIdentity/file_bug822367_4B.html
--- a/browser/base/content/test/general/file_bug822367_4B.html
+++ b/browser/base/content/test/siteIdentity/file_bug822367_4B.html
@@ -7,12 +7,12 @@ https://bugzilla.mozilla.org/show_bug.cg
 <head>
   <meta charset="utf-8">
   <title>Test 4B Location Change for Bug 822367</title>
 </head>
 <body>
   <div id="testContent">
     <p id="p1"></p>
   </div>
-  <script src="http://example.com/browser/browser/base/content/test/general/file_bug822367_1.js">
+  <script src="http://example.com/browser/browser/base/content/test/siteIdentity/file_bug822367_1.js">
   </script>
 </body>
 </html>
rename from browser/base/content/test/general/file_bug822367_5.html
rename to browser/base/content/test/siteIdentity/file_bug822367_5.html
--- a/browser/base/content/test/general/file_bug822367_5.html
+++ b/browser/base/content/test/siteIdentity/file_bug822367_5.html
@@ -5,17 +5,17 @@ Test 5 for Mixed Content Blocker User Ov
 https://bugzilla.mozilla.org/show_bug.cgi?id=822367
 -->
 <head>
   <meta charset="utf-8">
   <title>Test 5 for Bug 822367</title>
   <script>
     function createDoc() {
       var doc = document.open("text/html", "replace");
-      doc.write('<!DOCTYPE html><html><body><p id="p1">This is some content</p><script src="http://example.com/browser/browser/base/content/test/general/file_bug822367_1.js">\<\/script\>\<\/body>\<\/html>');
+      doc.write('<!DOCTYPE html><html><body><p id="p1">This is some content</p><script src="http://example.com/browser/browser/base/content/test/siteIdentity/file_bug822367_1.js">\<\/script\>\<\/body>\<\/html>');
       doc.close();
     }
   </script>
 </head>
 <body>
   <div id="testContent">
     <img src="https://example.com/tests/image/test/mochitest/blue.png" onload="createDoc()">
   </div>
rename from browser/base/content/test/general/file_bug822367_6.html
rename to browser/base/content/test/siteIdentity/file_bug822367_6.html
--- a/browser/base/content/test/general/file_bug822367_6.html
+++ b/browser/base/content/test/siteIdentity/file_bug822367_6.html
@@ -5,12 +5,12 @@ Test 6 for Mixed Content Blocker User Ov
 https://bugzilla.mozilla.org/show_bug.cgi?id=822367
 -->
 <head>
   <meta charset="utf-8">
   <title>Test 6 for Bug 822367</title>
 </head>
 <body>
   <div id="testContent">
-    <iframe name="f1" id="f1" src="https://example.com/browser/browser/base/content/test/general/file_bug822367_5.html"></iframe>
+    <iframe name="f1" id="f1" src="https://example.com/browser/browser/base/content/test/siteIdentity/file_bug822367_5.html"></iframe>
   </div>
 </body>
 </html>
rename from browser/base/content/test/general/file_bug902156.js
rename to browser/base/content/test/siteIdentity/file_bug902156.js
rename from browser/base/content/test/general/file_bug902156_1.html
rename to browser/base/content/test/siteIdentity/file_bug902156_1.html
--- a/browser/base/content/test/general/file_bug902156_1.html
+++ b/browser/base/content/test/siteIdentity/file_bug902156_1.html
@@ -5,11 +5,11 @@
   https://bugzilla.mozilla.org/show_bug.cgi?id=902156
 -->
 <head>
   <meta charset="utf-8">
   <title>Test 1 for Bug 902156</title>
 </head>
 <body>
   <div id="mctestdiv">Mixed Content Blocker enabled</div>
-  <script src="http://test1.example.com/browser/browser/base/content/test/general/file_bug902156.js" ></script>
+  <script src="http://test1.example.com/browser/browser/base/content/test/siteIdentity/file_bug902156.js" ></script>
 </body>
 </html>
rename from browser/base/content/test/general/file_bug902156_2.html
rename to browser/base/content/test/siteIdentity/file_bug902156_2.html
--- a/browser/base/content/test/general/file_bug902156_2.html
+++ b/browser/base/content/test/siteIdentity/file_bug902156_2.html
@@ -5,13 +5,13 @@
   https://bugzilla.mozilla.org/show_bug.cgi?id=902156
 -->
 <head>
   <meta charset="utf-8">
   <title>Test 2 for Bug 902156</title>
 </head>
 <body>
   <div id="mctestdiv">Mixed Content Blocker enabled</div>
-  <a href="https://test2.example.com/browser/browser/base/content/test/general/file_bug902156_1.html"
+  <a href="https://test2.example.com/browser/browser/base/content/test/siteIdentity/file_bug902156_1.html"
      id="mctestlink" target="_top">Go to http site</a>
-  <script src="http://test2.example.com/browser/browser/base/content/test/general/file_bug902156.js" ></script>
+  <script src="http://test2.example.com/browser/browser/base/content/test/siteIdentity/file_bug902156.js" ></script>
 </body>
 </html>
rename from browser/base/content/test/general/file_bug902156_3.html
rename to browser/base/content/test/siteIdentity/file_bug902156_3.html
--- a/browser/base/content/test/general/file_bug902156_3.html
+++ b/browser/base/content/test/siteIdentity/file_bug902156_3.html
@@ -5,11 +5,11 @@
   https://bugzilla.mozilla.org/show_bug.cgi?id=902156
 -->
 <head>
   <meta charset="utf-8">
   <title>Test 3 for Bug 902156</title>
 </head>
 <body>
   <div id="mctestdiv">Mixed Content Blocker enabled</div>
-  <script src="http://test1.example.com/browser/browser/base/content/test/general/file_bug902156.js" ></script>
+  <script src="http://test1.example.com/browser/browser/base/content/test/siteIdentity/file_bug902156.js" ></script>
 </body>
 </html>
rename from browser/base/content/test/general/file_bug906190.js
rename to browser/base/content/test/siteIdentity/file_bug906190.js
rename from browser/base/content/test/general/file_bug906190.sjs
rename to browser/base/content/test/siteIdentity/file_bug906190.sjs
--- a/browser/base/content/test/general/file_bug906190.sjs
+++ b/browser/base/content/test/siteIdentity/file_bug906190.sjs
@@ -1,11 +1,11 @@
 function handleRequest(request, response) {
   var page = "<!DOCTYPE html><html><body>bug 906190</body></html>";
-  var path = "https://test1.example.com/browser/browser/base/content/test/general/";
+  var path = "https://test1.example.com/browser/browser/base/content/test/siteIdentity/";
   var url;
 
   if (request.queryString.includes('bad-redirection=1')) {
     url = path + "this_page_does_not_exist.html";
   } else {
     url = path + "file_bug906190_redirected.html";
   }
 
rename from browser/base/content/test/general/file_bug906190_1.html
rename to browser/base/content/test/siteIdentity/file_bug906190_1.html
--- a/browser/base/content/test/general/file_bug906190_1.html
+++ b/browser/base/content/test/siteIdentity/file_bug906190_1.html
@@ -5,11 +5,11 @@
   https://bugzilla.mozilla.org/show_bug.cgi?id=906190
 -->
 <head>
   <meta charset="utf-8">
   <title>Test 1 for Bug 906190</title>
 </head>
 <body>
   <div id="mctestdiv">Mixed Content Blocker enabled</div>
-  <script src="http://test1.example.com/browser/browser/base/content/test/general/file_bug906190.js" ></script>
+  <script src="http://test1.example.com/browser/browser/base/content/test/siteIdentity/file_bug906190.js" ></script>
 </body>
 </html>
rename from browser/base/content/test/general/file_bug906190_2.html
rename to browser/base/content/test/siteIdentity/file_bug906190_2.html
--- a/browser/base/content/test/general/file_bug906190_2.html
+++ b/browser/base/content/test/siteIdentity/file_bug906190_2.html
@@ -5,11 +5,11 @@
   https://bugzilla.mozilla.org/show_bug.cgi?id=906190
 -->
 <head>
   <meta charset="utf-8">
   <title>Test 2 for Bug 906190</title>
 </head>
 <body>
   <div id="mctestdiv">Mixed Content Blocker enabled</div>
-  <script src="http://test2.example.com/browser/browser/base/content/test/general/file_bug906190.js" ></script>
+  <script src="http://test2.example.com/browser/browser/base/content/test/siteIdentity/file_bug906190.js" ></script>
 </body>
 </html>
rename from browser/base/content/test/general/file_bug906190_3_4.html
rename to browser/base/content/test/siteIdentity/file_bug906190_3_4.html
--- a/browser/base/content/test/general/file_bug906190_3_4.html
+++ b/browser/base/content/test/siteIdentity/file_bug906190_3_4.html
@@ -1,14 +1,14 @@
 <!DOCTYPE HTML>
 <html>
 <!--
   Test 3 and 4 for Bug 906190 - See file browser_bug902156.js for description.
   https://bugzilla.mozilla.org/show_bug.cgi?id=906190
 -->
 <head>
   <meta charset="utf-8">
-  <meta http-equiv="refresh" content="0; url=https://test1.example.com/browser/browser/base/content/test/general/file_bug906190_redirected.html">
+  <meta http-equiv="refresh" content="0; url=https://test1.example.com/browser/browser/base/content/test/siteIdentity/file_bug906190_redirected.html">
   <title>Test 3 and 4 for Bug 906190</title>
 </head>
 <body>
 </body>
 </html>
rename from browser/base/content/test/general/file_bug906190_redirected.html
rename to browser/base/content/test/siteIdentity/file_bug906190_redirected.html
--- a/browser/base/content/test/general/file_bug906190_redirected.html
+++ b/browser/base/content/test/siteIdentity/file_bug906190_redirected.html
@@ -5,11 +5,11 @@
   https://bugzilla.mozilla.org/show_bug.cgi?id=906190
 -->
 <head>
   <meta charset="utf-8">
   <title>Redirected Page for Bug 906190</title>
 </head>
 <body>
   <div id="mctestdiv">Mixed Content Blocker enabled</div>
-  <script src="http://test1.example.com/browser/browser/base/content/test/general/file_bug906190.js" ></script>
+  <script src="http://test1.example.com/browser/browser/base/content/test/siteIdentity/file_bug906190.js" ></script>
 </body>
 </html>
rename from browser/base/content/test/general/file_csp_block_all_mixedcontent.html
rename to browser/base/content/test/siteIdentity/file_csp_block_all_mixedcontent.html
--- a/browser/base/content/test/general/file_csp_block_all_mixedcontent.html
+++ b/browser/base/content/test/siteIdentity/file_csp_block_all_mixedcontent.html
@@ -1,9 +1,11 @@
 <!DOCTYPE HTML>
-<html><head><meta charset="utf-8">
-<title>Bug 1122236 - CSP: Implement block-all-mixed-content</title>
+<html>
+<head>
+  <meta charset="utf-8">
+  <title>Bug 1122236 - CSP: Implement block-all-mixed-content</title>
+  <meta http-equiv="Content-Security-Policy" content="block-all-mixed-content">
 </head>
-<meta http-equiv="Content-Security-Policy" content="block-all-mixed-content">
 <body>
-<script src="http://example.com/browser/browser/base/content/test/general/file_csp_block_all_mixedcontent.js"/>
+  <script src="http://example.com/browser/browser/base/content/test/siteIdentity/file_csp_block_all_mixedcontent.js"></script>
 </body>
 </html>
rename from browser/base/content/test/general/file_csp_block_all_mixedcontent.js
rename to browser/base/content/test/siteIdentity/file_csp_block_all_mixedcontent.js
rename from browser/base/content/test/general/file_mixedContentFramesOnHttp.html
rename to browser/base/content/test/siteIdentity/file_mixedContentFramesOnHttp.html
--- a/browser/base/content/test/general/file_mixedContentFramesOnHttp.html
+++ b/browser/base/content/test/siteIdentity/file_mixedContentFramesOnHttp.html
@@ -4,11 +4,11 @@
 Test for https://bugzilla.mozilla.org/show_bug.cgi?id=1182551
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 1182551</title>
 </head>
 <body>
   <p>Test for Bug 1182551.  This is an HTTP top level page.  We include an HTTPS iframe that loads mixed passive content.</p>
-  <iframe src="https://example.org/browser/browser/base/content/test/general/file_mixedPassiveContent.html"></iframe>
+  <iframe src="https://example.org/browser/browser/base/content/test/siteIdentity/file_mixedPassiveContent.html"></iframe>
 </body>
 </html>
rename from browser/base/content/test/general/file_mixedContentFromOnunload.html
rename to browser/base/content/test/siteIdentity/file_mixedContentFromOnunload.html
rename from browser/base/content/test/general/file_mixedContentFromOnunload_test1.html
rename to browser/base/content/test/siteIdentity/file_mixedContentFromOnunload_test1.html
rename from browser/base/content/test/general/file_mixedContentFromOnunload_test2.html
rename to browser/base/content/test/siteIdentity/file_mixedContentFromOnunload_test2.html
rename from browser/base/content/test/general/file_mixedPassiveContent.html
rename to browser/base/content/test/siteIdentity/file_mixedPassiveContent.html
--- a/browser/base/content/test/siteIdentity/head.js
+++ b/browser/base/content/test/siteIdentity/head.js
@@ -1,6 +1,340 @@
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "Promise",
   "resource://gre/modules/Promise.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Task",
   "resource://gre/modules/Task.jsm");
+
+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"].indexOf(element.state) != -1;
+
+  // 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;
+}
+
+/**
+ * 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 BrowserTestUtils.waitForEvent(aTabBrowser.tabContainer, "TabOpen");
+}
+
+/**
+ * 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.
+ * @resolves to the received event
+ * @rejects if a valid load event is not received within a meaningful interval
+ */
+function promiseTabLoadEvent(tab, url) {
+  info("Wait tab event: load");
+
+  function handle(loadedUrl) {
+    if (loadedUrl === "about:blank" || (url && loadedUrl !== url)) {
+      info(`Skipping spurious load event for ${loadedUrl}`);
+      return false;
+    }
+
+    info("Tab event received: load");
+    return true;
+  }
+
+  let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, handle);
+
+  if (url)
+    BrowserTestUtils.loadURI(tab.linkedBrowser, url);
+
+  return loaded;
+}
+
+// Compares the security state of the page with what is expected
+function isSecurityState(browser, expectedState) {
+  let ui = browser.securityUI;
+  if (!ui) {
+    ok(false, "No security UI to get the security state");
+    return;
+  }
+
+  const wpl = Components.interfaces.nsIWebProgressListener;
+
+  // determine the security state
+  let isSecure = ui.state & wpl.STATE_IS_SECURE;
+  let isBroken = ui.state & wpl.STATE_IS_BROKEN;
+  let isInsecure = ui.state & wpl.STATE_IS_INSECURE;
+
+  let actualState;
+  if (isSecure && !(isBroken || isInsecure)) {
+    actualState = "secure";
+  } else if (isBroken && !(isSecure || isInsecure)) {
+    actualState = "broken";
+  } else if (isInsecure && !(isSecure || isBroken)) {
+    actualState = "insecure";
+  } else {
+    actualState = "unknown";
+  }
+
+  is(expectedState, actualState, "Expected state " + expectedState + " and the actual state is " + actualState + ".");
+}
+
+/**
+ * Test the state of the identity box and control center to make
+ * sure they are correctly showing the expected mixed content states.
+ *
+ * @note The checks are done synchronously, but new code should wait on the
+ *       returned Promise object to ensure the identity panel has closed.
+ *       Bug 1221114 is filed to fix the existing code.
+ *
+ * @param tabbrowser
+ * @param Object states
+ *        MUST include the following properties:
+ *        {
+ *           activeLoaded: true|false,
+ *           activeBlocked: true|false,
+ *           passiveLoaded: true|false,
+ *        }
+ *
+ * @return {Promise}
+ * @resolves When the operation has finished and the identity panel has closed.
+ */
+function assertMixedContentBlockingState(tabbrowser, states = {}) {
+  if (!tabbrowser || !("activeLoaded" in states) ||
+      !("activeBlocked" in states) || !("passiveLoaded" in states)) {
+    throw new Error("assertMixedContentBlockingState requires a browser and a states object");
+  }
+
+  let {passiveLoaded, activeLoaded, activeBlocked} = states;
+  let {gIdentityHandler} = tabbrowser.ownerGlobal;
+  let doc = tabbrowser.ownerDocument;
+  let identityBox = gIdentityHandler._identityBox;
+  let classList = identityBox.classList;
+  let connectionIcon = doc.getElementById("connection-icon");
+  let connectionIconImage = tabbrowser.ownerGlobal.getComputedStyle(connectionIcon).
+                         getPropertyValue("list-style-image");
+
+  let stateSecure = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_IS_SECURE;
+  let stateBroken = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_IS_BROKEN;
+  let stateInsecure = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_IS_INSECURE;
+  let stateActiveBlocked = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT;
+  let stateActiveLoaded = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT;
+  let statePassiveLoaded = gIdentityHandler._state & Ci.nsIWebProgressListener.STATE_LOADED_MIXED_DISPLAY_CONTENT;
+
+  is(activeBlocked, !!stateActiveBlocked, "Expected state for activeBlocked matches UI state");
+  is(activeLoaded, !!stateActiveLoaded, "Expected state for activeLoaded matches UI state");
+  is(passiveLoaded, !!statePassiveLoaded, "Expected state for passiveLoaded matches UI state");
+
+  if (stateInsecure) {
+    // HTTP request, there should be no MCB classes for the identity box and the non secure icon
+    // should always be visible regardless of MCB state.
+    ok(classList.contains("unknownIdentity"), "unknownIdentity on HTTP page");
+    ok(is_hidden(connectionIcon), "connection icon should be hidden");
+
+    ok(!classList.contains("mixedActiveContent"), "No MCB icon on HTTP page");
+    ok(!classList.contains("mixedActiveBlocked"), "No MCB icon on HTTP page");
+    ok(!classList.contains("mixedDisplayContent"), "No MCB icon on HTTP page");
+    ok(!classList.contains("mixedDisplayContentLoadedActiveBlocked"), "No MCB icon on HTTP page");
+  } else {
+    // Make sure the identity box UI has the correct mixedcontent states and icons
+    is(classList.contains("mixedActiveContent"), activeLoaded,
+        "identityBox has expected class for activeLoaded");
+    is(classList.contains("mixedActiveBlocked"), activeBlocked && !passiveLoaded,
+        "identityBox has expected class for activeBlocked && !passiveLoaded");
+    is(classList.contains("mixedDisplayContent"), passiveLoaded && !(activeLoaded || activeBlocked),
+       "identityBox has expected class for passiveLoaded && !(activeLoaded || activeBlocked)");
+    is(classList.contains("mixedDisplayContentLoadedActiveBlocked"), passiveLoaded && activeBlocked,
+       "identityBox has expected class for passiveLoaded && activeBlocked");
+
+    ok(!is_hidden(connectionIcon), "connection icon should be visible");
+    if (activeLoaded) {
+      is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-active-loaded.svg#icon\")",
+        "Using active loaded icon");
+    }
+    if (activeBlocked && !passiveLoaded) {
+      is(connectionIconImage, "url(\"chrome://browser/skin/connection-secure.svg\")",
+        "Using active blocked icon");
+    }
+    if (passiveLoaded && !(activeLoaded || activeBlocked)) {
+      is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg#icon\")",
+        "Using passive loaded icon");
+    }
+    if (passiveLoaded && activeBlocked) {
+      is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg#icon\")",
+        "Using active blocked and passive loaded icon");
+    }
+  }
+
+  // Make sure the identity popup has the correct mixedcontent states
+  gIdentityHandler._identityBox.click();
+  let popupAttr = doc.getElementById("identity-popup").getAttribute("mixedcontent");
+  let bodyAttr = doc.getElementById("identity-popup-securityView-body").getAttribute("mixedcontent");
+
+  is(popupAttr.includes("active-loaded"), activeLoaded,
+      "identity-popup has expected attr for activeLoaded");
+  is(bodyAttr.includes("active-loaded"), activeLoaded,
+      "securityView-body has expected attr for activeLoaded");
+
+  is(popupAttr.includes("active-blocked"), activeBlocked,
+      "identity-popup has expected attr for activeBlocked");
+  is(bodyAttr.includes("active-blocked"), activeBlocked,
+      "securityView-body has expected attr for activeBlocked");
+
+  is(popupAttr.includes("passive-loaded"), passiveLoaded,
+      "identity-popup has expected attr for passiveLoaded");
+  is(bodyAttr.includes("passive-loaded"), passiveLoaded,
+      "securityView-body has expected attr for passiveLoaded");
+
+  // Make sure the correct icon is visible in the Control Center.
+  // This logic is controlled with CSS, so this helps prevent regressions there.
+  let securityView = doc.getElementById("identity-popup-securityView");
+  let securityViewBG = tabbrowser.ownerGlobal.getComputedStyle(securityView).
+                       getPropertyValue("background-image");
+  let securityContentBG = tabbrowser.ownerGlobal.getComputedStyle(securityView).
+                          getPropertyValue("background-image");
+
+  if (stateInsecure) {
+    is(securityViewBG, "url(\"chrome://browser/skin/controlcenter/conn-not-secure.svg\")",
+      "CC using 'not secure' icon");
+    is(securityContentBG, "url(\"chrome://browser/skin/controlcenter/conn-not-secure.svg\")",
+      "CC using 'not secure' icon");
+  }
+
+  if (stateSecure) {
+    is(securityViewBG, "url(\"chrome://browser/skin/controlcenter/connection.svg#connection-secure\")",
+      "CC using secure icon");
+    is(securityContentBG, "url(\"chrome://browser/skin/controlcenter/connection.svg#connection-secure\")",
+      "CC using secure icon");
+  }
+
+  if (stateBroken) {
+    if (activeLoaded) {
+      is(securityViewBG, "url(\"chrome://browser/skin/controlcenter/mcb-disabled.svg\")",
+        "CC using active loaded icon");
+      is(securityContentBG, "url(\"chrome://browser/skin/controlcenter/mcb-disabled.svg\")",
+        "CC using active loaded icon");
+    } else if (activeBlocked || passiveLoaded) {
+      is(securityViewBG, "url(\"chrome://browser/skin/controlcenter/connection.svg#connection-degraded\")",
+        "CC using degraded icon");
+      is(securityContentBG, "url(\"chrome://browser/skin/controlcenter/connection.svg#connection-degraded\")",
+        "CC using degraded icon");
+    } else {
+      // There is a case here with weak ciphers, but no bc tests are handling this yet.
+      is(securityViewBG, "url(\"chrome://browser/skin/controlcenter/connection.svg#connection-degraded\")",
+        "CC using degraded icon");
+      is(securityContentBG, "url(\"chrome://browser/skin/controlcenter/connection.svg#connection-degraded\")",
+        "CC using degraded icon");
+    }
+  }
+
+  if (activeLoaded || activeBlocked || passiveLoaded) {
+    doc.getElementById("identity-popup-security-expander").click();
+    is(Array.filter(doc.querySelectorAll("[observes=identity-popup-mcb-learn-more]"),
+                    element => !is_hidden(element)).length, 1,
+       "The 'Learn more' link should be visible once.");
+  }
+
+  gIdentityHandler._identityPopup.hidden = true;
+
+  // Wait for the panel to be closed before continuing. The promisePopupHidden
+  // function cannot be used because it's unreliable unless promisePopupShown is
+  // also called before closing the panel. This cannot be done until all callers
+  // are made asynchronous (bug 1221114).
+  return new Promise(resolve => executeSoon(resolve));
+}
+
+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", false);
+  });
+
+  let loaded = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
+  yield BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
+  yield loaded;
+
+  yield ContentTask.spawn(gBrowser.selectedBrowser, null, function*() {
+    content.document.getElementById("exceptionDialogButton").click();
+  });
+  yield exceptionDialogResolved;
+  yield 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/insecure_opener.html
rename to browser/base/content/test/siteIdentity/insecure_opener.html
rename from browser/base/content/test/general/test-mixedcontent-securityerrors.html
rename to browser/base/content/test/siteIdentity/test-mixedcontent-securityerrors.html
rename from browser/base/content/test/general/test_bug435035.html
rename to browser/base/content/test/siteIdentity/test_bug435035.html
--- a/browser/base/content/test/general/test_bug435035.html
+++ b/browser/base/content/test/siteIdentity/test_bug435035.html
@@ -1,1 +1,1 @@
-<img src="http://example.com/browser/browser/base/content/test/general/moz.png">
+<img src="http://example.com/browser/browser/base/content/test/siteIdentity/moz.png">
rename from browser/base/content/test/general/test_mcb_double_redirect_image.html
rename to browser/base/content/test/siteIdentity/test_mcb_double_redirect_image.html
--- a/browser/base/content/test/general/test_mcb_double_redirect_image.html
+++ b/browser/base/content/test/siteIdentity/test_mcb_double_redirect_image.html
@@ -13,11 +13,11 @@
     }
     function image_blocked() {
       document.getElementById("mctestdiv").innerHTML = "image blocked";
     }
   </script>
 </head>
 <body>
   <div id="mctestdiv"></div>
-  <img src="https://example.com/browser/browser/base/content/test/general/test_mcb_redirect.sjs?image_redirect_http_sjs" onload="image_loaded()" onerror="image_blocked()" ></image>
+  <img src="https://example.com/browser/browser/base/content/test/siteIdentity/test_mcb_redirect.sjs?image_redirect_http_sjs" onload="image_loaded()" onerror="image_blocked()" ></image>
 </body>
 </html>
rename from browser/base/content/test/general/test_mcb_redirect.html
rename to browser/base/content/test/siteIdentity/test_mcb_redirect.html
--- a/browser/base/content/test/general/test_mcb_redirect.html
+++ b/browser/base/content/test/siteIdentity/test_mcb_redirect.html
@@ -5,11 +5,11 @@
   https://bugzilla.mozilla.org/show_bug.cgi?id=418354
 -->
 <head>
   <meta charset="utf-8">
   <title>Bug 418354</title>
 </head>
 <body>
   <div id="mctestdiv">script blocked</div>
-  <script src="https://example.com/browser/browser/base/content/test/general/test_mcb_redirect.sjs?script" ></script>
+  <script src="https://example.com/browser/browser/base/content/test/siteIdentity/test_mcb_redirect.sjs?script" ></script>
 </body>
 </html>
rename from browser/base/content/test/general/test_mcb_redirect.js
rename to browser/base/content/test/siteIdentity/test_mcb_redirect.js
rename from browser/base/content/test/general/test_mcb_redirect.sjs
rename to browser/base/content/test/siteIdentity/test_mcb_redirect.sjs
--- a/browser/base/content/test/general/test_mcb_redirect.sjs
+++ b/browser/base/content/test/siteIdentity/test_mcb_redirect.sjs
@@ -1,19 +1,19 @@
 function handleRequest(request, response) {
   var page = "<!DOCTYPE html><html><body>bug 418354 and bug 1082837</body></html>";
 
   if (request.queryString === "script") { 
-    var redirect = "http://example.com/browser/browser/base/content/test/general/test_mcb_redirect.js";
+    var redirect = "http://example.com/browser/browser/base/content/test/siteIdentity/test_mcb_redirect.js";
     response.setHeader("Cache-Control", "no-cache", false);
   } else if (request.queryString === "image_http") {
     var redirect = "http://example.com/tests/image/test/mochitest/blue.png";
     response.setHeader("Cache-Control", "max-age=3600", false);
   } else if (request.queryString === "image_redirect_http_sjs") {
-    var redirect = "http://example.com/browser/browser/base/content/test/general/test_mcb_redirect.sjs?image_redirect_https";
+    var redirect = "http://example.com/browser/browser/base/content/test/siteIdentity/test_mcb_redirect.sjs?image_redirect_https";
     response.setHeader("Cache-Control", "max-age=3600", false);
   } else if (request.queryString === "image_redirect_https") {
     var redirect = "https://example.com/tests/image/test/mochitest/blue.png";
     response.setHeader("Cache-Control", "max-age=3600", false);
   }
 
   response.setHeader("Content-Type", "text/html", false);
   response.setStatusLine(request.httpVersion, "302", "Found");
rename from browser/base/content/test/general/test_mcb_redirect_image.html
rename to browser/base/content/test/siteIdentity/test_mcb_redirect_image.html
--- a/browser/base/content/test/general/test_mcb_redirect_image.html
+++ b/browser/base/content/test/siteIdentity/test_mcb_redirect_image.html
@@ -13,11 +13,11 @@
     }
     function image_blocked() {
       document.getElementById("mctestdiv").innerHTML = "image blocked";
     }
   </script>
 </head>
 <body>
   <div id="mctestdiv"></div>
-  <img src="https://example.com/browser/browser/base/content/test/general/test_mcb_redirect.sjs?image_http" onload="image_loaded()" onerror="image_blocked()" ></image>
+  <img src="https://example.com/browser/browser/base/content/test/siteIdentity/test_mcb_redirect.sjs?image_http" onload="image_loaded()" onerror="image_blocked()" ></image>
 </body>
 </html>
rename from browser/base/content/test/general/test_no_mcb_on_http_site_font.css
rename to browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font.css
rename from browser/base/content/test/general/test_no_mcb_on_http_site_font.html
rename to browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font.html
--- a/browser/base/content/test/general/test_no_mcb_on_http_site_font.html
+++ b/browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font.html
@@ -2,17 +2,17 @@
 <html>
 <!--
   Test 2 for Bug 909920 - See file browser_no_mcb_on_http_site.js for description.
   https://bugzilla.mozilla.org/show_bug.cgi?id=909920
 -->
 <head>
   <meta charset="utf-8">
   <title>Test 2 for Bug 909920</title>
-  <link rel="stylesheet" type="text/css" href="https://example.com/browser/browser/base/content/test/general/test_no_mcb_on_http_site_font.css" />
+  <link rel="stylesheet" type="text/css" href="https://example.com/browser/browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font.css" />
 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
 <script type="text/javascript">
   function checkLoadStates() {
    var ui = SpecialPowers.wrap(window)
             .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
              .getInterface(SpecialPowers.Ci.nsIWebNavigation)
              .QueryInterface(SpecialPowers.Ci.nsIDocShell)
rename from browser/base/content/test/general/test_no_mcb_on_http_site_font2.css
rename to browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font2.css
--- a/browser/base/content/test/general/test_no_mcb_on_http_site_font2.css
+++ b/browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font2.css
@@ -1,1 +1,1 @@
-@import url(http://example.com/browser/browser/base/content/test/general/test_no_mcb_on_http_site_font.css);
+@import url(http://example.com/browser/browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font.css);
rename from browser/base/content/test/general/test_no_mcb_on_http_site_font2.html
rename to browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font2.html
--- a/browser/base/content/test/general/test_no_mcb_on_http_site_font2.html
+++ b/browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font2.html
@@ -2,17 +2,17 @@
 <html>
 <!--
   Test 3 for Bug 909920 - See file browser_no_mcb_on_http_site.js for description.
   https://bugzilla.mozilla.org/show_bug.cgi?id=909920
 -->
 <head>
   <meta charset="utf-8">
   <title>Test 3 for Bug 909920</title>
-  <link rel="stylesheet" type="text/css" href="https://example.com/browser/browser/base/content/test/general/test_no_mcb_on_http_site_font2.css" />
+  <link rel="stylesheet" type="text/css" href="https://example.com/browser/browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_font2.css" />
 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
 <script type="text/javascript">
   function checkLoadStates() {
    var ui = SpecialPowers.wrap(window)
         .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
              .getInterface(SpecialPowers.Ci.nsIWebNavigation)
              .QueryInterface(SpecialPowers.Ci.nsIDocShell)
rename from browser/base/content/test/general/test_no_mcb_on_http_site_img.css
rename to browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_img.css
rename from browser/base/content/test/general/test_no_mcb_on_http_site_img.html
rename to browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_img.html
--- a/browser/base/content/test/general/test_no_mcb_on_http_site_img.html
+++ b/browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_img.html
@@ -2,17 +2,17 @@
 <html>
 <!--
   Test 1 for Bug 909920 - See file browser_no_mcb_on_http_site.js for description.
   https://bugzilla.mozilla.org/show_bug.cgi?id=909920
 -->
 <head>
   <meta charset="utf-8">
   <title>Test 1 for Bug 909920</title>
-  <link rel="stylesheet" type="text/css" href="https://example.com/browser/browser/base/content/test/general/test_no_mcb_on_http_site_img.css" />
+  <link rel="stylesheet" type="text/css" href="https://example.com/browser/browser/base/content/test/siteIdentity/test_no_mcb_on_http_site_img.css" />
 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 
 <script type="text/javascript">
   function checkLoadStates() {
    var ui = SpecialPowers.wrap(window)
             .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
              .getInterface(SpecialPowers.Ci.nsIWebNavigation)
              .QueryInterface(SpecialPowers.Ci.nsIDocShell)