From 70d89f064ffe19fe63bafc49a3f00971f4e5a185 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Tue, 14 Jan 2014 15:20:26 +1300 Subject: [PATCH] Bug 946065. Part 5.1: Enable test plugin for test_object_plugin_nav.html. r=smaug --HG-- rename : layout/base/tests/enableTestPlugin.js => content/html/content/test/enableTestPlugin.js extra : rebase_source : cd567303771e837981bb37cfcd1a2005ecdb6fc1 --- content/html/content/test/enableTestPlugin.js | 25 +++++++++++++++++++ .../content/test/test_object_plugin_nav.html | 1 + 2 files changed, 26 insertions(+) create mode 100644 content/html/content/test/enableTestPlugin.js diff --git a/content/html/content/test/enableTestPlugin.js b/content/html/content/test/enableTestPlugin.js new file mode 100644 index 00000000000..63c481807e0 --- /dev/null +++ b/content/html/content/test/enableTestPlugin.js @@ -0,0 +1,25 @@ +// this automatically sets the test plugin to be enabled (not e.g. click-to-play) +// and resets this afterwards + +(function() { + function getTestPlugin(aPluginName) { + var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"] + .getService(SpecialPowers.Ci.nsIPluginHost); + var tags = ph.getPluginTags(); + for (var tag of tags) { + if (tag.name == aPluginName) { + return tag; + } + } + + ok(false, "Could not find plugin tag with plugin name '" + name + "'"); + return null; + } + + var plugin = getTestPlugin("Test Plug-in"); + var oldEnabledState = plugin.enabledState; + plugin.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED; + SimpleTest.registerCleanupFunction(function() { + getTestPlugin("Test Plug-in").enabledState = oldEnabledState; + }); +})(); diff --git a/content/html/content/test/test_object_plugin_nav.html b/content/html/content/test/test_object_plugin_nav.html index 7d6f021ef94..05b52992e92 100644 --- a/content/html/content/test/test_object_plugin_nav.html +++ b/content/html/content/test/test_object_plugin_nav.html @@ -8,6 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=720130 Test for Bug 720130 +