Bug 1189911 - [e10s] Enable browser_plugin_infolink test. r=gfritzsche, a=ritu
authorJared Wein <jwein@mozilla.com>
Mon, 07 Mar 2016 05:45:00 -0500
changeset 323354 699175c7b63739f5f07bc23310776046dab1e144
parent 323353 ce9a5e723e4b21ce0dac5ede64e156023bb70534
child 323355 2926f802082183857b1c4e6f3774c742be98470d
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche, ritu
bugs1189911
milestone47.0a2
Bug 1189911 - [e10s] Enable browser_plugin_infolink test. r=gfritzsche, a=ritu
browser/base/content/test/plugins/browser.ini
browser/base/content/test/plugins/browser_plugin_infolink.js
--- a/browser/base/content/test/plugins/browser.ini
+++ b/browser/base/content/test/plugins/browser.ini
@@ -61,17 +61,16 @@ skip-if = !crashreporter
 [browser_CTP_outsideScrollArea.js]
 [browser_CTP_remove_navigate.js]
 [browser_CTP_resize.js]
 [browser_CTP_zoom.js]
 [browser_blocking.js]
 [browser_plugins_added_dynamically.js]
 [browser_pluginnotification.js]
 [browser_plugin_infolink.js]
-skip-if = (os == 'win' && os_version == "6.2" && e10s) # Win8 permafail in subsequent tests
 [browser_plugin_reloading.js]
 [browser_blocklist_content.js]
 skip-if = !e10s
 [browser_globalplugin_crashinfobar.js]
 skip-if = !crashreporter
 [browser_pluginCrashCommentAndURL.js]
 skip-if = !crashreporter
 [browser_pageInfo_plugins.js]
--- a/browser/base/content/test/plugins/browser_plugin_infolink.js
+++ b/browser/base/content/test/plugins/browser_plugin_infolink.js
@@ -1,77 +1,48 @@
 var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
 var gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
-var gTestBrowser = null;
+var oldBrowserOpenAddonsMgr = window.BrowserOpenAddonsMgr;
 
-add_task(function* () {
-  registerCleanupFunction(function () {
-    clearAllPluginPermissions();
-    Services.prefs.clearUserPref("plugins.click_to_play");
-    setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
-    gTestBrowser = null;
-    gBrowser.removeCurrentTab();
-    window.focus();
-  });
+registerCleanupFunction(function* cleanup() {
+  clearAllPluginPermissions();
+  Services.prefs.clearUserPref("plugins.click_to_play");
+  setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
+  window.BrowserOpenAddonsMgr = oldBrowserOpenAddonsMgr;
+  window.focus();
 });
 
-add_task(function* () {
-  gBrowser.selectedTab = gBrowser.addTab();
-  gTestBrowser = gBrowser.selectedBrowser;
-
-  Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
+add_task(function* test_clicking_manage_link_in_plugin_overlay_should_open_about_addons() {
   Services.prefs.setBoolPref("plugins.click_to_play", true);
-
   setTestPluginEnabledState(Ci.nsIPluginTag.STATE_DISABLED, "Test Plug-in");
 
-  // Prime the blocklist service, the remote service doesn't launch on startup.
-  yield promiseTabLoadEvent(gBrowser.selectedTab, "data:text/html,<html></html>");
-  let exmsg = yield promiseInitContentBlocklistSvc(gBrowser.selectedBrowser);
-  ok(!exmsg, "exception: " + exmsg);
+  let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, gTestRoot + "plugin_test.html");
+  let browser = tab.linkedBrowser;
+  yield promiseUpdatePluginBindings(browser);
 
-  yield asyncSetAndUpdateBlocklist(gTestRoot + "blockNoPlugins.xml", gTestBrowser);
-});
+  let pluginInfo = yield promiseForPluginInfo("test", browser);
+  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_DISABLED,
+     "plugin fallback type should be PLUGIN_DISABLED");
 
-add_task(function* () {
-  yield promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_test.html");
-
-  yield promiseUpdatePluginBindings(gTestBrowser);
+  let awaitBrowserOpenAddonsMgr = new Promise(resolve => {
+    window.BrowserOpenAddonsMgr = function(view) {
+      resolve(view);
+    }
+  });
 
-  let pluginInfo = yield promiseForPluginInfo("test");
-  is(pluginInfo.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_DISABLED,
-     "Test 1a, plugin fallback type should be PLUGIN_DISABLED");
-
-  // This test opens a new tab to about:addons
-  let promise = waitForEvent(gBrowser.tabContainer, "TabOpen", null, true);
-  yield ContentTask.spawn(gTestBrowser, null, function* () {
+  yield ContentTask.spawn(browser, null, function* () {
     let pluginNode = content.document.getElementById("test");
     let manageLink = content.document.getAnonymousElementByAttribute(pluginNode, "anonid", "managePluginsLink");
     let bounds = manageLink.getBoundingClientRect();
     let left = (bounds.left + bounds.right) / 2;
     let top = (bounds.top + bounds.bottom) / 2;
     let utils = content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                        .getInterface(Components.interfaces.nsIDOMWindowUtils);
     utils.sendMouseEvent("mousedown", left, top, 0, 1, 0, false, 0, 0);
     utils.sendMouseEvent("mouseup", left, top, 0, 1, 0, false, 0, 0);
     Assert.ok(true, "click on manage link");
   });
 
-  yield promise;
-
-  promise = waitForEvent(gBrowser.tabContainer, "TabClose", null, true);
+  let requestedView = yield awaitBrowserOpenAddonsMgr;
+  is(requestedView, "addons://list/plugin", "The Add-ons Manager should open the plugin view");
 
-  // in-process page, no cpows here
-  let condition = function() {
-    let win = gBrowser.selectedBrowser.contentWindow;
-    if (!!win && !!win.wrappedJSObject && !!win.wrappedJSObject.gViewController) {
-      return win.wrappedJSObject.gViewController.currentViewId == "addons://list/plugin";
-    }
-    return false;
-  }
-
-  yield promiseForCondition(condition, "Waited too long for about:addons to display.", 40, 500);
-
-  // remove the tab containing about:addons
-  gBrowser.removeCurrentTab();
-
-  yield promise;
+  yield BrowserTestUtils.removeTab(tab);
 });
-