Bug 941137 followup - fix xpcshell test which expects the test plugin to be click-to-activate to actually set the state it desires. a=don't-be-permaorange-on-beta
authorBenjamin Smedberg <benjamin@smedbergs.us>
Thu, 21 Nov 2013 12:37:47 -0500
changeset 175274 cc2ab73484b25cb21077d33679193d8297cc5b15
parent 175273 86e26e292344d26897b1377903405a6f17bd4a64
child 175275 75a2bbd8c4b64fa27abc5f982fb5e822015b3c4c
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdon
bugs941137
milestone28.0a2
Bug 941137 followup - fix xpcshell test which expects the test plugin to be click-to-activate to actually set the state it desires. a=don't-be-permaorange-on-beta
toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
--- a/toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_plugins.js
@@ -1,20 +1,34 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 // This verifies that plugins exist and can be enabled and disabled.
 var gID = null;
 
+function setTestPluginState(state) {
+  let tags = AM_Cc["@mozilla.org/plugin/host;1"].getService(AM_Ci.nsIPluginHost)
+    .getPluginTags();
+  for (let tag of tags) {
+    if (tag.name == "Test Plug-in") {
+      tag.enabledState = state;
+      return;
+    }
+  }
+  throw Error("No plugin tag found for the test plugin");
+}
+
 function run_test() {
   do_test_pending();
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
   Services.prefs.setBoolPref("plugins.click_to_play", true);
 
+  setTestPluginState(AM_Ci.nsIPluginTag.STATE_CLICKTOPLAY);
+
   startupManager();
   AddonManager.addAddonListener(AddonListener);
   AddonManager.addInstallListener(InstallListener);
 
   run_test_1();
 }
 
 // Finds the test plugin library