mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
740c10c2f8
--HG-- rename : browser/base/content/test/test_bug787619.html => browser/base/content/test/browser_bug787619.js rename : browser/base/content/test/test_bug787619.html => browser/base/content/test/plugin_bug787619.html
47 lines
1.9 KiB
JavaScript
47 lines
1.9 KiB
JavaScript
var gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
|
|
var gTestBrowser = null;
|
|
|
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
|
|
|
function test() {
|
|
waitForExplicitFinish();
|
|
registerCleanupFunction(function() {
|
|
Services.prefs.clearUserPref("plugins.click_to_play");
|
|
var plugin = getTestPlugin();
|
|
plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
|
|
gTestBrowser.removeEventListener("load", pageLoad, true);
|
|
});
|
|
|
|
Services.prefs.setBoolPref("plugins.click_to_play", true);
|
|
var plugin = getTestPlugin();
|
|
plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
|
|
|
|
gBrowser.selectedTab = gBrowser.addTab();
|
|
gTestBrowser = gBrowser.selectedBrowser;
|
|
gTestBrowser.addEventListener("load", pageLoad, true);
|
|
gTestBrowser.contentWindow.location = gHttpTestRoot + "plugin_both.html";
|
|
}
|
|
|
|
function pageLoad(aEvent) {
|
|
// The plugin events are async dispatched and can come after the load event
|
|
// This just allows the events to fire before we then go on to test the states
|
|
executeSoon(actualTest);
|
|
}
|
|
|
|
function actualTest() {
|
|
var popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
|
ok(popupNotification, "should have a click-to-play notification");
|
|
var plugin = gTestBrowser.contentDocument.getElementById("test");
|
|
ok(plugin, "should have known plugin in page");
|
|
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
|
is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY, "plugin fallback type should be PLUGIN_CLICK_TO_PLAY");
|
|
ok(!objLoadingContent.activated, "plugin should not be activated");
|
|
|
|
var unknown = gTestBrowser.contentDocument.getElementById("unknown");
|
|
ok(unknown, "should have unknown plugin in page");
|
|
|
|
gBrowser.removeCurrentTab();
|
|
window.focus();
|
|
finish();
|
|
}
|