Bug 1377036 part 2 - test fixup to set correct prefs for infobar tests, r?felipe
MozReview-Commit-ID: FMCP2Vecl3F
--- a/browser/base/content/test/plugins/browser_CTP_notificationBar.js
+++ b/browser/base/content/test/plugins/browser_CTP_notificationBar.js
@@ -1,33 +1,34 @@
var rootDir = getRootDirectory(gTestPath);
const gTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
var gTestBrowser = null;
add_task(async function() {
+ await SpecialPowers.pushPrefEnv({ set: [
+ ["plugins.show_infobar", true],
+ ["plugins.click_to_play", true],
+ ["extensions.blocklist.supressUI", true],
+ ]});
+
registerCleanupFunction(function() {
clearAllPluginPermissions();
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
- Services.prefs.clearUserPref("plugins.click_to_play");
- Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
gBrowser.removeCurrentTab();
window.focus();
gTestBrowser = null;
});
- Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
-
let newTab = BrowserTestUtils.addTab(gBrowser);
gBrowser.selectedTab = newTab;
gTestBrowser = gBrowser.selectedBrowser;
});
add_task(async function() {
- Services.prefs.setBoolPref("plugins.click_to_play", true);
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
await promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_small.html");
// Work around for delayed PluginBindingAttached
await promiseUpdatePluginBindings(gTestBrowser);
await promisePopupNotification("click-to-play-plugins");
--- a/browser/base/content/test/plugins/browser_CTP_remove_navigate.js
+++ b/browser/base/content/test/plugins/browser_CTP_remove_navigate.js
@@ -1,25 +1,26 @@
const gTestRoot = getRootDirectory(gTestPath);
const gHttpTestRoot = gTestRoot.replace("chrome://mochitests/content/",
"http://127.0.0.1:8888/");
add_task(async function() {
+ await SpecialPowers.pushPrefEnv({ set: [
+ ["plugins.click_to_play", true],
+ ["extensions.blocklist.suppressUI", true],
+ ["plugins.show_infobar", true],
+ ]});
registerCleanupFunction(function() {
clearAllPluginPermissions();
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
- Services.prefs.clearUserPref("plugins.click_to_play");
- Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
gBrowser.removeCurrentTab();
window.focus();
});
- Services.prefs.setBoolPref("plugins.click_to_play", true);
- Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Second Test Plug-in");
});
/**
* Tests that if a plugin is removed just as we transition to
* a different page, that we don't show the hidden plugin
* notification bar on the new page.
--- a/browser/base/content/test/plugins/browser_iterate_hidden_plugins.js
+++ b/browser/base/content/test/plugins/browser_iterate_hidden_plugins.js
@@ -16,18 +16,21 @@ add_task(async function setup() {
let originalPluginState = getTestPluginEnabledState();
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
registerCleanupFunction(() => {
setTestPluginEnabledState(originalPluginState);
});
// And then make the plugin hidden.
await SpecialPowers.pushPrefEnv({
- set: [[HIDDEN_CTP_PLUGIN_PREF, TEST_PLUGIN_NAME]],
- })
+ set: [
+ [HIDDEN_CTP_PLUGIN_PREF, TEST_PLUGIN_NAME],
+ ["plugins.show_infobar", true],
+ ],
+ });
});
/**
* Tests that if a plugin is click-to-play and in the
* HIDDEN_CTP_PLUGIN_PREF list, then it shouldn't be visible
* when iterating navigator.plugins.
*/
add_task(async function test_plugin_is_hidden_on_iteration() {