diff options
Diffstat (limited to 'dom/plugins/test/mochitest/test_plugin_tag_clicktoplay.html')
-rw-r--r-- | dom/plugins/test/mochitest/test_plugin_tag_clicktoplay.html | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/dom/plugins/test/mochitest/test_plugin_tag_clicktoplay.html b/dom/plugins/test/mochitest/test_plugin_tag_clicktoplay.html new file mode 100644 index 000000000..0679e6795 --- /dev/null +++ b/dom/plugins/test/mochitest/test_plugin_tag_clicktoplay.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> + <head> + <meta><charset="utf-8"/> + <title>Test Modifying Plugin click-to-play Flag</title> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <script type="application/javascript" src="plugin-utils.js"></script> + </head> + <body> + <script class="testbody" type="application/javascript"> + Components.utils.import("resource://gre/modules/Services.jsm"); + Services.prefs.setBoolPref("plugins.click_to_play", true); + var pluginHost = Components.classes["@mozilla.org/plugin/host;1"] + .getService(Components.interfaces.nsIPluginHost); + + var testPlugin = getTestPlugin(); + var secondTestPlugin = getTestPlugin("Second Test Plug-in"); + ok(testPlugin, "Should have Test Plug-in"); + ok(secondTestPlugin, "Should have Second Test Plug-in"); + + // make sure both start off as click-to-play + setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_CLICKTOPLAY); + setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Second Test Plug-in"); + + testPlugin.enabledState = Components.interfaces.nsIPluginTag.STATE_ENABLED; + is(pluginHost.getStateForType("application/x-test"), Components.interfaces.nsIPluginTag.STATE_ENABLED, "click-to-play should be off for Test Plug-in now"); + is(pluginHost.getStateForType("application/x-second-test"), Components.interfaces.nsIPluginTag.STATE_CLICKTOPLAY, "click-to-play should still be on for the Second Test Plug-in"); + + testPlugin.enabledState = Components.interfaces.nsIPluginTag.STATE_CLICKTOPLAY; + is(pluginHost.getStateForType("application/x-test"), Components.interfaces.nsIPluginTag.STATE_CLICKTOPLAY, "click-to-play should be on for Test Plug-in now"); + + Services.prefs.clearUserPref("plugins.click_to_play"); + </script> + </body> +</html> |