Bug 1360844 - Test browserContainersGroup according to privacy.userContext.ui.enabled state, r?jaws draft
authorFischer.json <fischer.json@gmail.com>
Fri, 28 Apr 2017 17:31:59 +0800
changeset 570717 f82a563db5b3ad75b77615cf031900ac28983c60
parent 570625 d24775dea08f9316a382e80bdd132d8dddb5c0a3
child 626550 5faaecdc8dc6ffef3579a5f21a3a3337ff760d54
push id56557
push userbmo:fliu@mozilla.com
push dateSun, 30 Apr 2017 04:37:58 +0000
reviewersjaws
bugs1360844
milestone55.0a1
Bug 1360844 - Test browserContainersGroup according to privacy.userContext.ui.enabled state, r?jaws The browserContainersGroup is behind privacy.userContext.ui.enabled so have to test it according the pref state. MozReview-Commit-ID: 5GxJJh2Mi6S
browser/components/preferences/in-content/tests/browser_bug731866.js
browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js
--- a/browser/components/preferences/in-content/tests/browser_bug731866.js
+++ b/browser/components/preferences/in-content/tests/browser_bug731866.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
 Components.utils.import("resource://gre/modules/NetUtil.jsm");
 
 const storageManagerDisabled = !SpecialPowers.getBoolPref("browser.storageManager.enabled");
 const offlineGroupDisabled = !SpecialPowers.getBoolPref("browser.preferences.offlineGroup.enabled");
+const browserContainersGroupDisabled = !SpecialPowers.getBoolPref("privacy.userContext.ui.enabled");
 
 function test() {
   waitForExplicitFinish();
   open_preferences(runTest);
 }
 
 var gElements;
 
@@ -33,16 +34,21 @@ function checkElements(expectedPane) {
     }
     // The siteDataGroup in the Storage Management project will replace the offlineGroup eventually,
     // so during the transition period, we have to check the pref to see if the offlineGroup
     // should be hidden always. See the bug 1354530 for the details.
     if (element.id == "offlineGroup" && offlineGroupDisabled) {
       is_element_hidden(element, "Disabled offlineGroup should be hidden");
       continue;
     }
+    // The browserContainersGroup is still only pref-on on Nightly
+    if (element.id == "browserContainersGroup" && browserContainersGroupDisabled) {
+      is_element_hidden(element, "Disabled browserContainersGroup should be hidden");
+      continue;
+    }
 
     let attributeValue = element.getAttribute("data-category");
     let suffix = " (id=" + element.id + ")";
     if (attributeValue == "pane" + expectedPane) {
       is_element_visible(element, expectedPane + " elements should be visible" + suffix);
     } else {
       is_element_hidden(element, "Elements not in " + expectedPane + " should be hidden" + suffix);
     }
--- a/browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js
+++ b/browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js
@@ -16,17 +16,18 @@ function test() {
     Services.perms.removeFromPrincipal(principal, "persistent-storage");
   });
 
   SpecialPowers.pushPrefEnv({set: [
     ["browser.cache.offline.enable", false],
     ["browser.cache.disk.enable", false],
     ["browser.cache.memory.enable", false],
     ["browser.storageManager.enabled", true],
-    ["browser.preferences.offlineGroup.enabled", true]
+    ["browser.preferences.offlineGroup.enabled", true],
+    ["privacy.userContext.ui.enabled", true]
   ]}).then(() => open_preferences(runTest));
 }
 
 function runTest(win) {
   is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded");
 
   let tab = win.document;
   let elements = tab.getElementById("mainPrefPane").children;
@@ -34,18 +35,18 @@ function runTest(win) {
   // Test if privacy pane is opened correctly
   win.gotoPref("panePrivacy");
   for (let element of elements) {
     if (element.nodeName == "preferences") {
       continue;
     }
     let attributeValue = element.getAttribute("data-category");
     if (attributeValue == "panePrivacy") {
-      is_element_visible(element, "Privacy elements should be visible");
+      is_element_visible(element, `Privacy element of id=${element.id} should be visible`);
     } else {
-      is_element_hidden(element, "Non-Privacy elements should be hidden");
+      is_element_hidden(element, `Non-Privacy element of id=${element.id} should be hidden`);
     }
   }
 
   gBrowser.removeCurrentTab();
   win.close();
   finish();
 }