Bug 1140263: Test updates. r=mossop
authorStephen Pohl <spohl.mozilla.bugs@gmail.com>
Thu, 19 Mar 2015 22:59:45 -0400
changeset 263441 093ee924ee0ef24677c13a31d235cde0e0e33ad5
parent 263440 5ed058e1876bd32e87ccb01159035b5d3cae2353
child 263442 0e6aa605af74fc735eac425dbd58561994342d82
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1140263
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1140263: Test updates. r=mossop
toolkit/modules/tests/xpcshell/test_GMPInstallManager.js
toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
--- a/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js
+++ b/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu, manager: Cm} = Components;
 const URL_HOST = "http://localhost";
 
-Cu.import("resource://gre/modules/GMPInstallManager.jsm");
+let GMPScope = Cu.import("resource://gre/modules/GMPInstallManager.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/FileUtils.jsm");
 Cu.import("resource://testing-common/httpd.js");
 Cu.import("resource://gre/modules/Promise.jsm");
 Cu.import("resource://gre/modules/Preferences.jsm")
 
 do_get_profile();
@@ -21,36 +21,36 @@ function run_test() {Cu.import("resource
 }
 
 /**
  * Tests that the helper used for preferences works correctly
  */
 add_task(function* test_prefs() {
   let addon1 = "addon1", addon2 = "addon2";
 
-  GMPPrefs.set(GMPPrefs.KEY_URL, "http://not-really-used");
-  GMPPrefs.set(GMPPrefs.KEY_URL_OVERRIDE, "http://not-really-used-2");
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_LAST_UPDATE, "1", addon1);
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_VERSION, "2", addon1);
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_LAST_UPDATE, "3", addon2);
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_VERSION, "4", addon2);
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_AUTOUPDATE, false, addon2);
-  GMPPrefs.set(GMPPrefs.KEY_CERT_CHECKATTRS, true);
+  GMPScope.GMPPrefs.set(GMPScope.GMPPrefs.KEY_URL, "http://not-really-used");
+  GMPScope.GMPPrefs.set(GMPScope.GMPPrefs.KEY_URL_OVERRIDE, "http://not-really-used-2");
+  GMPScope.GMPPrefs.set(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, "1", addon1);
+  GMPScope.GMPPrefs.set(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, "2", addon1);
+  GMPScope.GMPPrefs.set(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, "3", addon2);
+  GMPScope.GMPPrefs.set(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, "4", addon2);
+  GMPScope.GMPPrefs.set(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, false, addon2);
+  GMPScope.GMPPrefs.set(GMPScope.GMPPrefs.KEY_CERT_CHECKATTRS, true);
 
-  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_URL), "http://not-really-used");
-  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_URL_OVERRIDE),
+  do_check_eq(GMPScope.GMPPrefs.get(GMPScope.GMPPrefs.KEY_URL), "http://not-really-used");
+  do_check_eq(GMPScope.GMPPrefs.get(GMPScope.GMPPrefs.KEY_URL_OVERRIDE),
               "http://not-really-used-2");
-  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_LAST_UPDATE, "", addon1), "1");
-  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_VERSION, "", addon1), "2");
-  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_LAST_UPDATE, "", addon2), "3");
-  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_VERSION, "", addon2), "4");
-  do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_AUTOUPDATE, undefined, addon2),
+  do_check_eq(GMPScope.GMPPrefs.get(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, "", addon1), "1");
+  do_check_eq(GMPScope.GMPPrefs.get(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, "", addon1), "2");
+  do_check_eq(GMPScope.GMPPrefs.get(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, "", addon2), "3");
+  do_check_eq(GMPScope.GMPPrefs.get(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, "", addon2), "4");
+  do_check_eq(GMPScope.GMPPrefs.get(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, undefined, addon2),
               false);
-  do_check_true(GMPPrefs.get(GMPPrefs.KEY_CERT_CHECKATTRS));
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_AUTOUPDATE, true, addon2);
+  do_check_true(GMPScope.GMPPrefs.get(GMPScope.GMPPrefs.KEY_CERT_CHECKATTRS));
+  GMPScope.GMPPrefs.set(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, true, addon2);
 });
 
 /**
  * Tests that an uninit without a check works fine
  */
 add_task(function* test_checkForAddons_uninitWithoutCheck() {
   let installManager = new GMPInstallManager();
   installManager.uninit();
@@ -179,36 +179,36 @@ add_test(function test_checkForAddons_ti
 /**
  * Tests that we throw correctly in case of ssl certification error.
  */
 add_test(function test_checkForAddons_bad_ssl() {
   //
   // Add random stuff that cause CertUtil to require https.
   //
   let PREF_KEY_URL_OVERRIDE_BACKUP =
-    Preferences.get(GMPPrefs.KEY_URL_OVERRIDE, undefined);
-  Preferences.reset(GMPPrefs.KEY_URL_OVERRIDE);
+    Preferences.get(GMPScope.GMPPrefs.KEY_URL_OVERRIDE, undefined);
+  Preferences.reset(GMPScope.GMPPrefs.KEY_URL_OVERRIDE);
 
-  let CERTS_BRANCH_DOT_ONE = GMPPrefs.CERTS_BRANCH + ".1";
+  let CERTS_BRANCH_DOT_ONE = GMPScope.GMPPrefs.KEY_CERTS_BRANCH + ".1";
   let PREF_CERTS_BRANCH_DOT_ONE_BACKUP =
     Preferences.get(CERTS_BRANCH_DOT_ONE, undefined);
   Services.prefs.setCharPref(CERTS_BRANCH_DOT_ONE, "funky value");
 
 
   overrideXHR(200, "");
   let installManager = new GMPInstallManager();
   let promise = installManager.checkForAddons();
   promise.then(() => {
     do_throw("Defensive timeout should reject");
   }, err => {
     do_check_true(err.message.contains("SSL is required and URI scheme is " +
                                        "not https."));
     installManager.uninit();
     if (PREF_KEY_URL_OVERRIDE_BACKUP) {
-      Preferences.set(GMPPrefs.KEY_URL_OVERRIDE,
+      Preferences.set(GMPScope.GMPPrefs.KEY_URL_OVERRIDE,
         PREF_KEY_URL_OVERRIDE_BACKUP);
     }
     if (PREF_CERTS_BRANCH_DOT_ONE_BACKUP) {
       Preferences.set(CERTS_BRANCH_DOT_ONE,
         PREF_CERTS_BRANCH_DOT_ONE_BACKUP);
     }
     run_next_test();
   });
@@ -478,20 +478,21 @@ function* test_checkForAddons_installAdd
     let downloadedGMPFile = FileUtils.getFile("TmpD",
       [gmpAddon.id + ".zip"]);
     do_check_true(downloadedGMPFile.exists());
     let downloadedBytes = getBinaryFileData(downloadedGMPFile);
     let sourceBytes = getBinaryFileData(zipFile);
     do_check_true(compareBinaryData(downloadedBytes, sourceBytes));
 
     // Make sure the prefs are set correctly
-    do_check_true(!!GMPPrefs.get(GMPPrefs.KEY_ADDON_LAST_UPDATE, "",
-                                 gmpAddon.id));
-    do_check_eq(GMPPrefs.get(GMPPrefs.KEY_ADDON_VERSION, "", gmpAddon.id),
-                             "1.1");
+    do_check_true(!!GMPScope.GMPPrefs.get(
+      GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, "", gmpAddon.id));
+    do_check_eq(GMPScope.GMPPrefs.get(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, "",
+                                      gmpAddon.id),
+                "1.1");
     // Make sure it reports as being installed
     do_check_true(gmpAddon.isInstalled);
 
     // Cleanup
     extractedFile.parent.remove(true);
     zipFile.remove(false);
     httpServer.stop(function() {});
     do_print("Removing downloaded GMP file: " + downloadedGMPFile.path);
@@ -513,17 +514,17 @@ function* test_checkForAddons_installAdd
 add_task(test_checkForAddons_installAddon.bind(null, "1", true, false));
 add_task(test_checkForAddons_installAddon.bind(null, "2", false, false));
 add_task(test_checkForAddons_installAddon.bind(null, "3", true, true));
 
 /**
  * Tests simpleCheckAndInstall when autoupdate is disabled for a GMP
  */
 add_task(function* test_simpleCheckAndInstall_autoUpdateDisabled() {
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_AUTOUPDATE, false, OPEN_H264_ID);
+  GMPScope.GMPPrefs.set(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, false, GMPScope.OPEN_H264_ID);
   let responseXML =
     "<?xml version=\"1.0\"?>" +
     "<updates>" +
     "    <addons>" +
     // valid openh264
     "        <addon id=\"gmp-gmpopenh264\"" +
     "               URL=\"http://127.0.0.1:8011/gmp-gmpopenh264-1.1.zip\"" +
     "               hashFunction=\"sha256\"" +
@@ -531,18 +532,18 @@ add_task(function* test_simpleCheckAndIn
     "               version=\"1.1\"/>" +
     "  </addons>" +
     "</updates>"
 
   overrideXHR(200, responseXML);
   let installManager = new GMPInstallManager();
   let result = yield installManager.simpleCheckAndInstall();
   do_check_eq(result.status, "nothing-new-to-install");
-  Preferences.reset(GMPPrefs.KEY_UPDATE_LAST_CHECK);
-  GMPPrefs.set(GMPPrefs.KEY_ADDON_AUTOUPDATE, true, OPEN_H264_ID);
+  Preferences.reset(GMPScope.GMPPrefs.KEY_UPDATE_LAST_CHECK);
+  GMPScope.GMPPrefs.set(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, true, GMPScope.OPEN_H264_ID);
 });
 
 /**
  * Tests simpleCheckAndInstall nothing to install
  */
 add_task(function* test_simpleCheckAndInstall_nothingToInstall() {
   let responseXML =
     "<?xml version=\"1.0\"?>" +
--- a/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
@@ -10,28 +10,25 @@ let GMPScope = Cu.import("resource://gre
 
 const TEST_DATE = new Date(2013, 0, 1, 12);
 
 let gManagerWindow;
 let gCategoryUtilities;
 let gIsEnUsLocale;
 
 let gMockAddons = [];
-let gMockEmeAddons = [];
 
 for (let plugin of GMPScope.GMP_PLUGINS) {
   let mockAddon = Object.freeze({
       id: plugin.id,
       isValid: true,
       isInstalled: false,
+      isEME: plugin.id.indexOf("gmp-eme-") == 0 ? true : false,
   });
   gMockAddons.push(mockAddon);
-  if (mockAddon.id.indexOf("gmp-eme-") == 0) {
-    gMockEmeAddons.push(mockAddon);
-  }
 }
 
 let gInstalledAddonId = "";
 let gInstallDeferred = null;
 let gPrefs = Services.prefs;
 let getKey = GMPScope.GMPPrefs.getPrefKey;
 
 function MockGMPInstallManager() {
@@ -42,17 +39,16 @@ MockGMPInstallManager.prototype = {
 
   installAddon: addon => {
     gInstalledAddonId = addon.id;
     gInstallDeferred.resolve();
     return Promise.resolve();
   },
 };
 
-
 let gOptionsObserver = {
   lastDisplayed: null,
   observe: function(aSubject, aTopic, aData) {
     if (aTopic == AddonManager.OPTIONS_NOTIFICATION_DISPLAYED) {
       this.lastDisplayed = aData;
     }
   }
 };
@@ -81,54 +77,55 @@ function openDetailsView(aId) {
   EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow);
 
   let deferred = Promise.defer();
   wait_for_view_load(gManagerWindow, deferred.resolve);
   return deferred.promise;
 }
 
 add_task(function* initializeState() {
-  gPrefs.setBoolPref(GMPScope.KEY_LOGGING_DUMP, true);
-  gPrefs.setIntPref(GMPScope.KEY_LOGGING_LEVEL, 0);
+  gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_LOGGING_DUMP, true);
+  gPrefs.setIntPref(GMPScope.GMPPrefs.KEY_LOGGING_LEVEL, 0);
 
   gManagerWindow = yield open_manager();
   gCategoryUtilities = new CategoryUtilities(gManagerWindow);
 
   registerCleanupFunction(Task.async(function*() {
     Services.obs.removeObserver(gOptionsObserver, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED);
 
     for (let addon of gMockAddons) {
-      gPrefs.clearUserPref(getKey(GMPScope.KEY_PLUGIN_ENABLED, addon.id));
-      gPrefs.clearUserPref(getKey(GMPScope.KEY_PLUGIN_LAST_UPDATE, addon.id));
-      gPrefs.clearUserPref(getKey(GMPScope.KEY_PLUGIN_AUTOUPDATE, addon.id));
-      gPrefs.clearUserPref(getKey(GMPScope.KEY_PLUGIN_VERSION, addon.id));
-      gPrefs.clearUserPref(getKey(GMPScope.KEY_PLUGIN_HIDDEN, addon.id));
+      gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id));
+      gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, addon.id));
+      gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, addon.id));
+      gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id));
+      gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCEVISIBLE, addon.id));
     }
-    gPrefs.clearUserPref(GMPScope.KEY_LOGGING_DUMP);
-    gPrefs.clearUserPref(GMPScope.KEY_LOGGING_LEVEL);
-    gPrefs.clearUserPref(GMPScope.KEY_PROVIDER_LASTCHECK);
-    gPrefs.clearUserPref(GMPScope.KEY_EME_ENABLED);
+    gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_LOGGING_DUMP);
+    gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_LOGGING_LEVEL);
+    gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_PROVIDER_LASTCHECK);
+    gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_EME_ENABLED);
     yield GMPScope.GMPProvider.shutdown();
     GMPScope.GMPProvider.startup();
   }));
 
   let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
   gIsEnUsLocale = chrome.getSelectedLocale("global") == "en-US";
 
   Services.obs.addObserver(gOptionsObserver, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, false);
 
   // Start out with plugins not being installed, disabled and automatic updates
   // disabled.
-  gPrefs.setBoolPref(GMPScope.KEY_EME_ENABLED, true);
+  gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_EME_ENABLED, true);
   for (let addon of gMockAddons) {
-    gPrefs.setBoolPref(getKey(GMPScope.KEY_PLUGIN_ENABLED, addon.id), false);
-    gPrefs.setIntPref(getKey(GMPScope.KEY_PLUGIN_LAST_UPDATE, addon.id), 0);
-    gPrefs.setBoolPref(getKey(GMPScope.KEY_PLUGIN_AUTOUPDATE, addon.id), false);
-    gPrefs.setCharPref(getKey(GMPScope.KEY_PLUGIN_VERSION, addon.id), "");
-    gPrefs.setBoolPref(getKey(GMPScope.KEY_PLUGIN_HIDDEN, addon.id), false);
+    gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id), false);
+    gPrefs.setIntPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, addon.id), 0);
+    gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, addon.id), false);
+    gPrefs.setCharPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id), "");
+    gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCEVISIBLE, addon.id),
+                       true);
   }
   yield GMPScope.GMPProvider.shutdown();
   GMPScope.GMPProvider.startup();
 });
 
 add_task(function* testNotInstalledDisabled() {
   Assert.ok(gCategoryUtilities.isTypeVisible("plugin"), "Plugin tab visible.");
   yield gCategoryUtilities.openType("plugin");
@@ -171,17 +168,17 @@ add_task(function* testNotInstalledDisab
   }
 });
 
 add_task(function* testNotInstalled() {
   Assert.ok(gCategoryUtilities.isTypeVisible("plugin"), "Plugin tab visible.");
   yield gCategoryUtilities.openType("plugin");
 
   for (let addon of gMockAddons) {
-    gPrefs.setBoolPref(getKey(GMPScope.KEY_PLUGIN_ENABLED, addon.id), true);
+    gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id), true);
     let item = get_addon_element(gManagerWindow, addon.id);
     Assert.ok(item, "Got add-on element:" + addon.id);
     item.parentNode.ensureElementIsVisible(item);
     is(item.getAttribute("active"), "true");
 
     let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning");
     is_element_visible(el, "Warning notification is visible.");
     el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
@@ -211,20 +208,20 @@ add_task(function* testNotInstalledDetai
     el = doc.getElementById("detail-warning");
     is_element_visible(el, "Warning notification is visible.");
     el = doc.getElementsByTagName("setting")[0];
   }
 });
 
 add_task(function* testInstalled() {
   for (let addon of gMockAddons) {
-    gPrefs.setIntPref(getKey(GMPScope.KEY_PLUGIN_LAST_UPDATE, addon.id),
+    gPrefs.setIntPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, addon.id),
                       TEST_DATE.getTime());
-    gPrefs.setBoolPref(getKey(GMPScope.KEY_PLUGIN_AUTOUPDATE, addon.id), false);
-    gPrefs.setCharPref(getKey(GMPScope.KEY_PLUGIN_VERSION, addon.id), "1.2.3.4");
+    gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, addon.id), false);
+    gPrefs.setCharPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id), "1.2.3.4");
 
     yield gCategoryUtilities.openType("plugin");
 
     let item = get_addon_element(gManagerWindow, addon.id);
     Assert.ok(item, "Got add-on element.");
     item.parentNode.ensureElementIsVisible(item);
     is(item.getAttribute("active"), "true");
 
@@ -271,73 +268,28 @@ add_task(function* testInstalledDetails(
     yield deferred.promise;
     let menuSep = doc.getElementById("addonitem-menuseparator");
     is_element_hidden(menuSep, "Menu separator is hidden.");
     contextMenu.hidePopup();
   }
 });
 
 add_task(function* testInstalledGlobalEmeDisabled() {
-  gPrefs.setBoolPref(GMPScope.KEY_EME_ENABLED, false);
-  for (let addon of gMockEmeAddons) {
+  gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_EME_ENABLED, false);
+  for (let addon of gMockAddons) {
     yield gCategoryUtilities.openType("plugin");
 
     let item = get_addon_element(gManagerWindow, addon.id);
-    Assert.ok(item, "Got add-on element.");
-    item.parentNode.ensureElementIsVisible(item);
-    is(item.getAttribute("active"), "false");
-
-    let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning");
-    is_element_hidden(el, "Warning notification is hidden.");
-    el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
-    is_element_visible(el, "disabled-postfix is visible.");
-    el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
-    is_element_hidden(el, "Disable button not visible.");
-    el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
-    is_element_hidden(el, "Enable button not visible.");
-
-    let menu = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "state-menulist");
-    is_element_visible(menu, "State menu should be visible.");
-
-    let neverActivate = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "never-activate-menuitem");
-    is(menu.selectedItem, neverActivate, "Plugin state should be never-activate.");
+    if (addon.isEME) {
+      Assert.ok(!item, "Couldn't get add-on element.");
+    } else {
+      Assert.ok(item, "Got add-on element.");
+    }
   }
-  gPrefs.setBoolPref(GMPScope.KEY_EME_ENABLED, true);
-});
-
-add_task(function* testInstalledGlobalEmeDisabledDetails() {
-  gPrefs.setBoolPref(GMPScope.KEY_EME_ENABLED, false);
-  for (let addon of gMockEmeAddons) {
-    yield openDetailsView(addon.id);
-    let doc = gManagerWindow.document;
-
-    let el = doc.getElementsByClassName("disabled-postfix")[0];
-    is_element_visible(el, "disabled-postfix is visible.");
-    el = doc.getElementById("detail-findUpdates-btn");
-    is_element_hidden(el, "Find updates link is hidden.");
-    el = doc.getElementById("detail-warning");
-    is_element_hidden(el, "Warning notification is hidden.");
-    el = doc.getElementsByTagName("setting")[0];
-
-    let contextMenu = doc.getElementById("addonitem-popup");
-    let deferred = Promise.defer();
-    let listener = () => {
-      contextMenu.removeEventListener("popupshown", listener, false);
-      deferred.resolve();
-    };
-    contextMenu.addEventListener("popupshown", listener, false);
-    el = doc.getElementsByClassName("detail-view-container")[0];
-    EventUtils.synthesizeMouse(el, 4, 4, { }, gManagerWindow);
-    EventUtils.synthesizeMouse(el, 4, 4, { type: "contextmenu", button: 2 }, gManagerWindow);
-    yield deferred.promise;
-    let menuSep = doc.getElementById("addonitem-menuseparator");
-    is_element_hidden(menuSep, "Menu separator is hidden.");
-    contextMenu.hidePopup();
-  }
-  gPrefs.setBoolPref(GMPScope.KEY_EME_ENABLED, true);
+  gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_EME_ENABLED, true);
 });
 
 add_task(function* testPreferencesButton() {
 
   let prefValues = [
     { enabled: false, version: "" },
     { enabled: false, version: "1.2.3.4" },
     { enabled: true, version: "" },
@@ -346,19 +298,19 @@ add_task(function* testPreferencesButton
 
   for (let preferences of prefValues) {
     dump("Testing preferences button with pref settings: " +
          JSON.stringify(preferences) + "\n");
     for (let addon of gMockAddons) {
       yield close_manager(gManagerWindow);
       gManagerWindow = yield open_manager();
       gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-      gPrefs.setCharPref(getKey(GMPScope.KEY_PLUGIN_VERSION, addon.id),
+      gPrefs.setCharPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id),
                          preferences.version);
-      gPrefs.setBoolPref(getKey(GMPScope.KEY_PLUGIN_ENABLED, addon.id),
+      gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id),
                          preferences.enabled);
 
       yield gCategoryUtilities.openType("plugin");
       let doc = gManagerWindow.document;
       let item = get_addon_element(gManagerWindow, addon.id);
 
       let button = doc.getAnonymousElementByAttribute(item, "anonid", "preferences-btn");
       EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
@@ -367,17 +319,17 @@ add_task(function* testPreferencesButton
       yield deferred.promise;
 
       is(gOptionsObserver.lastDisplayed, addon.id);
     }
   }
 });
 
 add_task(function* testUpdateButton() {
-  gPrefs.clearUserPref(GMPScope.KEY_PROVIDER_LASTCHECK);
+  gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_PROVIDER_LASTCHECK);
 
   let originalInstallManager = GMPScope.GMPInstallManager;
   Object.defineProperty(GMPScope, "GMPInstallManager", {
     value: MockGMPInstallManager,
     writable: true,
     enumerable: true,
     configurable: true
   });
@@ -406,30 +358,44 @@ add_task(function* testUpdateButton() {
   Object.defineProperty(GMPScope, "GMPInstallManager", {
     value: originalInstallManager,
     writable: true,
     enumerable: true,
     configurable: true
   });
 });
 
-add_task(function* testHidden() {
-  gPrefs.clearUserPref(GMPScope.KEY_PROVIDER_LASTCHECK);
-
+add_task(function* testEmeSupport() {
   for (let addon of gMockAddons) {
-    gPrefs.setBoolPref(getKey(GMPScope.KEY_PLUGIN_HIDDEN, addon.id), true);
+    gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCEVISIBLE, addon.id));
   }
-
-  // Hiding of plugins requires a restart of the GMP provider.
   yield GMPScope.GMPProvider.shutdown();
   GMPScope.GMPProvider.startup();
 
   for (let addon of gMockAddons) {
     yield gCategoryUtilities.openType("plugin");
     let doc = gManagerWindow.document;
     let item = get_addon_element(gManagerWindow, addon.id);
-    Assert.equal(item, null);
+    if (addon.id == GMPScope.EME_ADOBE_ID) {
+      if (Services.appinfo.OS == "WINNT" &&
+          Services.sysinfo.getPropertyAsInt32("version") >= 6) {
+        Assert.ok(item, "Adobe EME supported, found add-on element.");
+      } else {
+        Assert.ok(!item,
+                  "Adobe EME not supported, couldn't find add-on element.");
+      }
+    } else {
+      Assert.ok(item, "Found add-on element.");
+    }
   }
+
+  for (let addon of gMockAddons) {
+    gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCEVISIBLE, addon.id),
+                       true);
+  }
+  yield GMPScope.GMPProvider.shutdown();
+  GMPScope.GMPProvider.startup();
+
 });
 
 add_task(function* test_cleanup() {
   yield close_manager(gManagerWindow);
 });
--- a/toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
@@ -42,32 +42,33 @@ MockGMPInstallManager.prototype = {
   },
 };
 
 
 function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
   startupManager();
 
-  gPrefs.setBoolPref(GMPScope.KEY_LOGGING_DUMP, true);
-  gPrefs.setIntPref(GMPScope.KEY_LOGGING_LEVEL, 0);
-  gPrefs.setBoolPref(GMPScope.KEY_EME_ENABLED, true);
+  gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_LOGGING_DUMP, true);
+  gPrefs.setIntPref(GMPScope.GMPPrefs.KEY_LOGGING_LEVEL, 0);
+  gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_EME_ENABLED, true);
   for (let addon of gMockAddons.values()) {
-    gPrefs.setBoolPref(gGetKey(GMPScope.KEY_PLUGIN_HIDDEN, addon.id), false);
+    gPrefs.setBoolPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCEVISIBLE, addon.id),
+                       true);
   }
   GMPScope.GMPProvider.shutdown();
   GMPScope.GMPProvider.startup();
 
   run_next_test();
 }
 
 add_task(function* test_notInstalled() {
   for (let addon of gMockAddons.values()) {
-    gPrefs.setCharPref(gGetKey(GMPScope.KEY_PLUGIN_VERSION, addon.id), "");
-    gPrefs.setBoolPref(gGetKey(GMPScope.KEY_PLUGIN_ENABLED, addon.id), false);
+    gPrefs.setCharPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id), "");
+    gPrefs.setBoolPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id), false);
   }
 
   let addons = yield promiseAddonsByIDs([...gMockAddons.keys()]);
   Assert.equal(addons.length, gMockAddons.size);
 
   for (let addon of addons) {
     Assert.ok(!addon.isInstalled);
     Assert.equal(addon.type, "plugin");
@@ -121,20 +122,20 @@ add_task(function* test_installed() {
 
   for (let addon of addons) {
     let mockAddon = gMockAddons.get(addon.id);
     Assert.notEqual(mockAddon, null);
 
     let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
     file.append(addon.id);
     file.append(TEST_VERSION);
-    gPrefs.setBoolPref(gGetKey(GMPScope.KEY_PLUGIN_ENABLED, mockAddon.id), false);
-    gPrefs.setCharPref(gGetKey(GMPScope.KEY_PLUGIN_LAST_UPDATE, mockAddon.id),
+    gPrefs.setBoolPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, mockAddon.id), false);
+    gPrefs.setCharPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, mockAddon.id),
                       "" + TEST_TIME_SEC);
-    gPrefs.setCharPref(gGetKey(GMPScope.KEY_PLUGIN_VERSION, mockAddon.id),
+    gPrefs.setCharPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, mockAddon.id),
                       TEST_VERSION);
 
     Assert.ok(addon.isInstalled);
     Assert.equal(addon.type, "plugin");
     Assert.ok(!addon.isActive);
     Assert.ok(!addon.appDisabled);
     Assert.ok(addon.userDisabled);
 
@@ -160,52 +161,52 @@ add_task(function* test_installed() {
   }
 });
 
 add_task(function* test_enable() {
   let addons = yield promiseAddonsByIDs([...gMockAddons.keys()]);
   Assert.equal(addons.length, gMockAddons.size);
 
   for (let addon of addons) {
-    gPrefs.setBoolPref(gGetKey(GMPScope.KEY_PLUGIN_ENABLED, addon.id), true);
+    gPrefs.setBoolPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id), true);
 
     Assert.ok(addon.isActive);
     Assert.ok(!addon.appDisabled);
     Assert.ok(!addon.userDisabled);
 
     Assert.equal(addon.permissions, AddonManager.PERM_CAN_UPGRADE |
                                     AddonManager.PERM_CAN_DISABLE);
   }
 });
 
 add_task(function* test_globalEmeDisabled() {
   let addons = yield promiseAddonsByIDs([...gMockEmeAddons.keys()]);
   Assert.equal(addons.length, gMockEmeAddons.size);
 
-  gPrefs.setBoolPref(GMPScope.KEY_EME_ENABLED, false);
+  gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_EME_ENABLED, false);
   GMPScope.GMPProvider.shutdown();
   GMPScope.GMPProvider.startup();
   for (let addon of addons) {
     Assert.ok(!addon.isActive);
     Assert.ok(addon.appDisabled);
     Assert.ok(!addon.userDisabled);
 
     Assert.equal(addon.permissions, 0);
   }
-  gPrefs.setBoolPref(GMPScope.KEY_EME_ENABLED, true);
+  gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_EME_ENABLED, true);
   GMPScope.GMPProvider.shutdown();
   GMPScope.GMPProvider.startup();
 });
 
 add_task(function* test_autoUpdatePrefPersistance() {
   let addons = yield promiseAddonsByIDs([...gMockAddons.keys()]);
   Assert.equal(addons.length, gMockAddons.size);
 
   for (let addon of addons) {
-    let autoupdateKey = gGetKey(GMPScope.KEY_PLUGIN_AUTOUPDATE, addon.id);
+    let autoupdateKey = gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, addon.id);
     gPrefs.clearUserPref(autoupdateKey);
 
     addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
     Assert.ok(!gPrefs.getBoolPref(autoupdateKey));
 
     addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_ENABLE;
     Assert.equal(addon.applyBackgroundUpdates, AddonManager.AUTOUPDATE_ENABLE);
     Assert.ok(gPrefs.getBoolPref(autoupdateKey));
@@ -228,68 +229,68 @@ add_task(function* test_pluginRegistrati
     let clearPaths = () => { addedPaths = []; removedPaths = []; }
 
     let MockGMPService = {
       addPluginDirectory: path => addedPaths.push(path),
       removePluginDirectory: path => removedPaths.push(path),
     };
 
     GMPScope.gmpService = MockGMPService;
-    gPrefs.setBoolPref(gGetKey(GMPScope.KEY_PLUGIN_ENABLED, addon.id), true);
+    gPrefs.setBoolPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id), true);
 
     // Check that the plugin gets registered after startup.
-    gPrefs.setCharPref(gGetKey(GMPScope.KEY_PLUGIN_VERSION, addon.id),
+    gPrefs.setCharPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id),
                       TEST_VERSION);
     clearPaths();
     yield promiseRestartManager();
     Assert.notEqual(addedPaths.indexOf(file.path), -1);
     Assert.deepEqual(removedPaths, []);
 
     // Check that clearing the version doesn't trigger registration.
     clearPaths();
-    gPrefs.clearUserPref(gGetKey(GMPScope.KEY_PLUGIN_VERSION, addon.id));
+    gPrefs.clearUserPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id));
     Assert.deepEqual(addedPaths, []);
     Assert.deepEqual(removedPaths, [file.path]);
 
     // Restarting with no version set should not trigger registration.
     clearPaths();
     yield promiseRestartManager();
     Assert.equal(addedPaths.indexOf(file.path), -1);
     Assert.equal(removedPaths.indexOf(file.path), -1);
 
     // Changing the pref mid-session should cause unregistration and registration.
-    gPrefs.setCharPref(gGetKey(GMPScope.KEY_PLUGIN_VERSION, addon.id),
+    gPrefs.setCharPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id),
                       TEST_VERSION);
     clearPaths();
     const TEST_VERSION_2 = "5.6.7.8";
     let file2 = Services.dirsvc.get("ProfD", Ci.nsIFile);
     file2.append(addon.id);
     file2.append(TEST_VERSION_2);
-    gPrefs.setCharPref(gGetKey(GMPScope.KEY_PLUGIN_VERSION, addon.id),
+    gPrefs.setCharPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id),
                       TEST_VERSION_2);
     Assert.deepEqual(addedPaths, [file2.path]);
     Assert.deepEqual(removedPaths, [file.path]);
 
     // Disabling the plugin should cause unregistration.
-    gPrefs.setCharPref(gGetKey(GMPScope.KEY_PLUGIN_VERSION, addon.id),
+    gPrefs.setCharPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id),
                       TEST_VERSION);
     clearPaths();
-    gPrefs.setBoolPref(gGetKey(GMPScope.KEY_PLUGIN_ENABLED, addon.id), false);
+    gPrefs.setBoolPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id), false);
     Assert.deepEqual(addedPaths, []);
     Assert.deepEqual(removedPaths, [file.path]);
 
     // Restarting with the plugin disabled should not cause registration.
     clearPaths();
     yield promiseRestartManager();
     Assert.equal(addedPaths.indexOf(file.path), -1);
     Assert.equal(removedPaths.indexOf(file.path), -1);
 
     // Re-enabling the plugin should cause registration.
     clearPaths();
-    gPrefs.setBoolPref(gGetKey(GMPScope.KEY_PLUGIN_ENABLED, addon.id), true);
+    gPrefs.setBoolPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id), true);
     Assert.deepEqual(addedPaths, [file.path]);
     Assert.deepEqual(removedPaths, []);
     GMPScope = Cu.import("resource://gre/modules/addons/GMPProvider.jsm");
   }
 });
 
 add_task(function* test_periodicUpdate() {
   Object.defineProperty(GMPScope, "GMPInstallManager", {
@@ -298,31 +299,31 @@ add_task(function* test_periodicUpdate()
     enumerable: true,
     configurable: true
   });
 
   let addons = yield promiseAddonsByIDs([...gMockAddons.keys()]);
   Assert.equal(addons.length, gMockAddons.size);
 
   for (let addon of addons) {
-    gPrefs.clearUserPref(gGetKey(GMPScope.KEY_PLUGIN_AUTOUPDATE, addon.id));
+    gPrefs.clearUserPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, addon.id));
 
     addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
-    gPrefs.setIntPref(GMPScope.KEY_PROVIDER_LASTCHECK, 0);
+    gPrefs.setIntPref(GMPScope.GMPPrefs.KEY_PROVIDER_LASTCHECK, 0);
     let result =
       yield addon.findUpdates({}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
     Assert.strictEqual(result, false);
 
     addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_ENABLE;
-    gPrefs.setIntPref(GMPScope.KEY_PROVIDER_LASTCHECK, Date.now() / 1000 - 60);
+    gPrefs.setIntPref(GMPScope.GMPPrefs.KEY_PROVIDER_LASTCHECK, Date.now() / 1000 - 60);
     result =
       yield addon.findUpdates({}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
     Assert.strictEqual(result, false);
 
-    gPrefs.setIntPref(GMPScope.KEY_PROVIDER_LASTCHECK,
+    gPrefs.setIntPref(GMPScope.GMPPrefs.KEY_PROVIDER_LASTCHECK,
                      Date.now() / 1000 - 2 * GMPScope.SEC_IN_A_DAY);
     gInstalledAddonId = "";
     result =
       yield addon.findUpdates({}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
     Assert.strictEqual(result, true);
     Assert.equal(gInstalledAddonId, addon.id);
   }