mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-10-09 16:55:15 +00:00
39 lines
1.5 KiB
JavaScript
39 lines
1.5 KiB
JavaScript
var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
|
|
var gTestBrowser = null;
|
|
|
|
add_task(function* () {
|
|
registerCleanupFunction(function () {
|
|
clearAllPluginPermissions();
|
|
Services.prefs.clearUserPref("plugins.click_to_play");
|
|
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
|
|
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
|
|
gBrowser.removeCurrentTab();
|
|
window.focus();
|
|
gTestBrowser = null;
|
|
});
|
|
});
|
|
|
|
add_task(function* () {
|
|
Services.prefs.setBoolPref("plugins.click_to_play", true);
|
|
|
|
gBrowser.selectedTab = gBrowser.addTab();
|
|
gTestBrowser = gBrowser.selectedBrowser;
|
|
|
|
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
|
|
|
|
yield promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_both.html");
|
|
|
|
// Work around for delayed PluginBindingAttached
|
|
yield promiseUpdatePluginBindings(gTestBrowser);
|
|
|
|
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
|
ok(popupNotification, "should have a click-to-play notification");
|
|
|
|
let pluginInfo = yield promiseForPluginInfo("test");
|
|
is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "plugin should be click to play");
|
|
ok(!pluginInfo.activated, "plugin should not be activated");
|
|
|
|
let unknown = gTestBrowser.contentDocument.getElementById("unknown");
|
|
ok(unknown, "should have unknown plugin in page");
|
|
});
|