Bug 1335475 - Move test_refresh_navigator_plugins to a plain mochitest.r=mconley
Note that this test currently is broken/disabled in e10s mode. That's covered by
bug 1090576, but this patch doesn't make it worse because chrome mochitests run in local mode always anyway.
MozReview-Commit-ID: L4hJ8LkiSNG
--- a/dom/plugins/test/mochitest/chrome.ini
+++ b/dom/plugins/test/mochitest/chrome.ini
@@ -22,13 +22,12 @@ skip-if = !crashreporter
[test_hangui.xul]
skip-if = (!crashreporter) || (os != "win")
support-files = hangui_subpage.html hangui_common.js hangui_iface.js dialog_watcher.js
[test_idle_hang.xul]
skip-if = (!crashreporter) || (os != "win")
[test_npruntime.xul]
[test_plugin_tag_clicktoplay.html]
[test_privatemode_perwindowpb.xul]
-[test_refresh_navigator_plugins.html]
[test_xulbrowser_plugin_visibility.xul]
skip-if = (toolkit == "cocoa") || (os == "win")
support-files = xulbrowser_plugin_visibility.xul plugin_visibility_loader.html
[test_wmode.xul]
--- a/dom/plugins/test/mochitest/mochitest.ini
+++ b/dom/plugins/test/mochitest/mochitest.ini
@@ -140,16 +140,18 @@ skip-if = true # Bug 1267432
skip-if = true # disabled due to oddness, perhaps scrolling of the mochitest window?
[test_propertyAndMethod.html]
[test_queryCSSZoomFactor.html]
[test_queryContentsScaleFactor.html]
skip-if = (toolkit != "cocoa") || (os != "win")
[test_queryContentsScaleFactorWindowed.html]
skip-if = (toolkit != "cocoa") || (os != "win")
[test_redirect_handling.html]
+[test_refresh_navigator_plugins.html]
+skip-if = e10s # Bug 1090576
[test_secondPlugin.html]
[test_src_url_change.html]
[test_streamatclose.html]
[test_streamNotify.html]
[test_stringHandling.html]
[test_twostreams.html]
[test_visibility.html]
skip-if = toolkit == "cocoa"
--- a/dom/plugins/test/mochitest/test_refresh_navigator_plugins.html
+++ b/dom/plugins/test/mochitest/test_refresh_navigator_plugins.html
@@ -1,68 +1,34 @@
<!DOCTYPE html>
<!-- bug 820708 -->
<html>
<head>
<meta><charset="utf-8"/>
<title>Test Refreshing navigator.plugins (bug 820708)</title>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript"
+ src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="plugin-utils.js"></script>
+ <link rel="stylesheet" type="text/css"
+ href="/tests/SimpleTest/test.css">
</head>
<body>
+ <p id="display"></p>
<script class="testbody" type="application/javascript">
"use strict";
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
- var pluginHost = Components.classes["@mozilla.org/plugin/host;1"]
- .getService(Components.interfaces.nsIPluginHost);
- var pluginTags = pluginHost.getPluginTags();
- var nextTest = null;
- var obsService = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
- var observer = {
- observe: function(aSubject, aTopic, aData) {
- if (aTopic == "plugin-info-updated") {
- SimpleTest.executeSoon(nextTest);
- }
- }
- };
- obsService.addObserver(observer, "plugin-info-updated", false);
+ ok("Test Plug-in" in navigator.plugins, "testplugin should be present");
+ ok("application/x-test" in navigator.mimeTypes, "testplugin MIME should be present");
- var navTestPlugin1 = navigator.plugins.namedItem("Test Plug-in");
- ok(navTestPlugin1, "navigator.plugins should have Test Plug-in");
- var tagTestPlugin = null;
- for (var plugin of pluginTags) {
- if (plugin.name == navTestPlugin1.name) {
- tagTestPlugin = plugin;
- break;
- }
- }
- ok(tagTestPlugin, "plugin tags should have Test Plug-in");
- var mimeType = tagTestPlugin.getMimeTypes()[0];
- ok(mimeType, "should have a MIME type for Test Plug-in");
- ok(navigator.mimeTypes[mimeType], "navigator.mimeTypes should have an entry for '" + mimeType + "'");
- ok(!tagTestPlugin.disabled, "test plugin should not be disabled");
+ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_DISABLED);
+ ok(!("Test Plug-in" in navigator.plugins), "testplugin should not be present");
+ ok(!("application/x-test" in navigator.mimeTypes), "testplugin MIME should not be present");
- nextTest = testPart2;
- tagTestPlugin.enabledState = Components.interfaces.nsIPluginTag.STATE_DISABLED;
-
- function testPart2() {
- var navTestPlugin2 = navigator.plugins.namedItem("Test Plug-in");
- ok(!navTestPlugin2, "now navigator.plugins should not have Test Plug-in");
- ok(!navigator.mimeTypes[mimeType], "now navigator.mimeTypes should not have an entry for '" + mimeType + "'");
-
- nextTest = testPart3;
- tagTestPlugin.enabledState = Components.interfaces.nsIPluginTag.STATE_ENABLED;
- }
-
- function testPart3() {
- var navTestPlugin3 = navigator.plugins.namedItem("Test Plug-in");
- ok(navTestPlugin3, "now navigator.plugins should have Test Plug-in again");
- ok(navigator.mimeTypes[mimeType], "now navigator.mimeTypes should have an entry for '" + mimeType + "' again");
- obsService.removeObserver(observer, "plugin-info-updated");
- SimpleTest.finish();
- }
+ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
+ ok("Test Plug-in" in navigator.plugins, "testplugin should be present again");
+ ok("application/x-test" in navigator.mimeTypes, "testplugin MIME should be present again");
+ SimpleTest.finish();
</script>
</body>
</html>