bug 798237 - add test for bug 797677 r=jaws

This commit is contained in:
David Keeler 2012-10-08 10:01:19 -07:00
parent 00695ab541
commit ee551a86c7
3 changed files with 54 additions and 0 deletions

View File

@ -158,6 +158,7 @@ _BROWSER_FILES = \
browser_bug763468.js \
browser_bug767836.js \
browser_bug783614.js \
browser_bug797677.js \
browser_canonizeURL.js \
browser_customize.js \
browser_findbarClose.js \
@ -240,6 +241,7 @@ _BROWSER_FILES = \
plugin_clickToPlayAllow.html \
plugin_clickToPlayDeny.html \
plugin_bug749455.html \
plugin_bug797677.html \
plugin_hidden_to_visible.html \
plugin_two_types.html \
alltabslistener.html \

View File

@ -0,0 +1,47 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var rootDir = getRootDirectory(gTestPath);
const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
const Cc = Components.classes;
const Ci = Components.interfaces;
var gTestBrowser = null;
var gConsoleErrors = 0;
function test() {
waitForExplicitFinish();
var newTab = gBrowser.addTab();
gBrowser.selectedTab = newTab;
gTestBrowser = gBrowser.selectedBrowser;
gTestBrowser.addEventListener("PluginNotFound", pluginNotFound, true);
var consoleService = Cc["@mozilla.org/consoleservice;1"]
.getService(Ci.nsIConsoleService);
var errorListener = {
observe: function(aMessage) {
if (aMessage.message.contains("NS_ERROR"))
gConsoleErrors++;
}
};
consoleService.registerListener(errorListener);
registerCleanupFunction(function() {
gTestBrowser.removeEventListener("PluginNotFound", pluginNotFound, true);
consoleService.unregisterListener(errorListener);
gBrowser.removeCurrentTab();
window.focus();
});
gTestBrowser.contentWindow.location = gHttpTestRoot + "plugin_bug797677.html";
}
function pluginNotFound() {
// Let browser-plugins.js handle the PluginNotFound event, then run the test
executeSoon(runTest);
}
function runTest() {
var doc = gTestBrowser.contentDocument;
var plugin = doc.getElementById("plugin");
ok(plugin, "plugin should be in the page");
is(gConsoleErrors, 0, "should have no console errors");
finish();
}

View File

@ -0,0 +1,5 @@
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"/></head>
<body><embed id="plugin" type="9000"></embed></body>
</html>