diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/plugins/test/unit/test_plugin_default_state.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/plugins/test/unit/test_plugin_default_state.js')
-rw-r--r-- | dom/plugins/test/unit/test_plugin_default_state.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/dom/plugins/test/unit/test_plugin_default_state.js b/dom/plugins/test/unit/test_plugin_default_state.js new file mode 100644 index 000000000..cb68c61e7 --- /dev/null +++ b/dom/plugins/test/unit/test_plugin_default_state.js @@ -0,0 +1,31 @@ +Components.utils.import("resource://gre/modules/Services.jsm"); + +function run_test() { + allow_all_plugins(); + let pluginDefaultState = Services.prefs.getIntPref("plugin.default.state"); + // if this fails, we just have to switch around the values we're testing + do_check_neq(pluginDefaultState, Ci.nsIPluginTag.STATE_DISABLED); + let nonDefaultState = (pluginDefaultState != Ci.nsIPluginTag.STATE_ENABLED ? + Ci.nsIPluginTag.STATE_ENABLED : + Ci.nsIPluginTag.STATE_CLICKTOPLAY); + let ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost); + let testPlugin = get_test_plugintag(); + // the test plugin should have the default enabledState + do_check_eq(testPlugin.enabledState, pluginDefaultState); + + let secondTestPlugin = get_test_plugintag("Second Test Plug-in"); + // set an enabledState for the second test plugin + secondTestPlugin.enabledState = Ci.nsIPluginTag.STATE_DISABLED; + // change what the default enabledState is + Services.prefs.setIntPref("plugin.default.state", nonDefaultState); + // the test plugin should follow the default (it has no individual pref yet) + do_check_eq(testPlugin.enabledState, nonDefaultState); + // the second test plugin should retain its preferred state + do_check_eq(secondTestPlugin.enabledState, Ci.nsIPluginTag.STATE_DISABLED); + + // clean up + testPlugin.enabledState = pluginDefaultState; + secondTestPlugin.enabledState = pluginDefaultState; + Services.prefs.clearUserPref("plugin.default.state"); + Services.prefs.clearUserPref("plugin.importedState"); +} |