Skip to content
Snippets Groups Projects
Commit 613349b0 authored by Georg Fritzsche's avatar Georg Fritzsche
Browse files

Bug 899080 - Test fixup part 1 - Always enable test-plugins for reftests. r=jmaher

parent 63d2cabd
No related branches found
No related tags found
No related merge requests found
......@@ -109,6 +109,9 @@ var gUnexpectedCrashDumpFiles = { };
var gCrashDumpDir;
var gFailedNoPaint = false;
// The enabled-state of the test-plugins, stored so they can be reset later
var gTestPluginEnabledStates = null;
const TYPE_REFTEST_EQUAL = '==';
const TYPE_REFTEST_NOTEQUAL = '!=';
const TYPE_LOAD = 'load'; // test without a reference (just test that it does
......@@ -208,6 +211,20 @@ function IDForEventTarget(event)
}
}
function getTestPlugin(aName) {
var ph = CC["@mozilla.org/plugin/host;1"].getService(CI.nsIPluginHost);
var tags = ph.getPluginTags();
// Find the test plugin
for (var i = 0; i < tags.length; i++) {
if (tags[i].name == aName)
return tags[i];
}
LogWarning("Failed to find the test-plugin.");
return null;
}
this.OnRefTestLoad = function OnRefTestLoad(win)
{
gCrashDumpDir = CC[NS_DIRECTORY_SERVICE_CONTRACTID]
......@@ -267,6 +284,17 @@ this.OnRefTestLoad = function OnRefTestLoad(win)
document.getElementById("reftest-window").appendChild(gBrowser);
#endif
// reftests should have the test plugins enabled, not click-to-play
let plugin1 = getTestPlugin("Test Plug-in");
let plugin2 = getTestPlugin("Second Test Plug-in");
if (plugin1 && plugin2) {
gTestPluginEnabledStates = [plugin1.enabledState, plugin2.enabledState];
plugin1.enabledState = CI.nsIPluginTag.STATE_ENABLED;
plugin2.enabledState = CI.nsIPluginTag.STATE_ENABLED;
} else {
LogWarning("Could not get test plugin tags.");
}
gBrowserMessageManager = gBrowser.QueryInterface(CI.nsIFrameLoaderOwner)
.frameLoader.messageManager;
// The content script waits for the initial onload, then notifies
......@@ -498,6 +526,14 @@ function StartTests()
function OnRefTestUnload()
{
let plugin1 = getTestPlugin("Test Plug-in");
let plugin2 = getTestPlugin("Second Test Plug-in");
if (plugin1 && plugin2) {
plugin1.enabledState = gTestPluginEnabledStates[0];
plugin2.enabledState = gTestPluginEnabledStates[1];
} else {
LogWarning("Failed to get test plugin tags.");
}
}
// Read all available data from an input stream and return it
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment