Bug 675245 - cleanup pluginutils and SimpleTest.executeSoon() to utilize specialpowers. r=ted

This commit is contained in:
Joel Maher 2011-10-19 05:35:05 -04:00
parent cf20256c8d
commit 3b5c4e36d3
9 changed files with 36 additions and 38 deletions

View File

@ -6,7 +6,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=391728
<head>
<title>Test for Bug 391728</title>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/PluginUtils.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body>

View File

@ -2,7 +2,7 @@
<head>
<title>NPAPI ClearSiteData/GetSitesWithData Functionality</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/PluginUtils.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script>
</head>
<body>
<embed id="plugin1" type="application/x-test" width="200" height="200"></embed>

View File

@ -46,6 +46,7 @@ include $(topsrcdir)/config/rules.mk
_STATIC_FILES = test_sample.xul \
test_sanityChromeUtils.xul \
test_sanityPluginUtils.html \
# Disabled until bug 652494 is resolved.
# test_sanityException.xul \
# test_sanityException2.xul \

View File

@ -1,16 +1,15 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Profiling test suite for PluginUtils</title>
<script type="text/javascript">
var start = new Date();
</script>
<script type="text/javascript" src="/tests/SimpleTest/PluginUtils.js"></script>
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script>
<script type="text/javascript">
var loadTime = new Date();
</script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body onload="starttest()">
<!-- load the test plugin defined at $(DIST)/bin/plugins/Test.plugin/ -->

View File

@ -18,7 +18,6 @@ mochikit.jar:
content/tests/SimpleTest/ChromeUtils.js (tests/SimpleTest/ChromeUtils.js)
content/tests/SimpleTest/MozillaLogger.js (tests/SimpleTest/MozillaLogger.js)
content/tests/SimpleTest/LogController.js (tests/SimpleTest/LogController.js)
content/tests/SimpleTest/PluginUtils.js (tests/SimpleTest/PluginUtils.js)
content/tests/SimpleTest/setup.js (tests/SimpleTest/setup.js)
content/tests/SimpleTest/SimpleTest.js (tests/SimpleTest/SimpleTest.js)
content/tests/SimpleTest/test.css (tests/SimpleTest/test.css)

View File

@ -64,7 +64,7 @@ _TEST_FILES = \
ifneq ($(OS_TARGET),Android)
# Disabled on Android for permaorange, see bug 688052
_TEST_FILES += test_sanityPluginUtils.html \
_TEST_FILES += \
test_sanityEventUtils.html \
test_sanitySimpletest.html
endif

View File

@ -275,4 +275,32 @@ function synthesizeDrop(srcElement, destElement, dragData, dropEffect, aWindow,
} finally {
ds.endDragSession(true);
}
}
};
var PluginUtils =
{
withTestPlugin : function(callback)
{
if (typeof Components == "undefined")
{
todo(false, "Not a Mozilla-based browser");
return false;
}
var ph = Components.classes["@mozilla.org/plugin/host;1"]
.getService(Components.interfaces.nsIPluginHost);
var tags = ph.getPluginTags();
// Find the test plugin
for (var i = 0; i < tags.length; i++)
{
if (tags[i].name == "Test Plug-in")
{
callback(tags[i]);
return true;
}
}
todo(false, "Need a test plugin on this platform");
return false;
}
};

View File

@ -51,7 +51,6 @@ _SIMPLETEST_FILES = MozillaLogger.js \
EventUtils.js \
ChromeUtils.js \
WindowSnapshot.js \
PluginUtils.js \
specialpowersAPI.js \
SpecialPowersObserverAPI.js \
$(DEPTH)/toolkit/content/tests/browser/common/mockObjects.js \

View File

@ -1,28 +0,0 @@
var PluginUtils =
{
withTestPlugin : function(callback)
{
if (typeof Components == "undefined")
{
todo(false, "Not a Mozilla-based browser");
return false;
}
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var ph = Components.classes["@mozilla.org/plugin/host;1"]
.getService(Components.interfaces.nsIPluginHost);
var tags = ph.getPluginTags();
// Find the test plugin
for (var i = 0; i < tags.length; i++)
{
if (tags[i].name == "Test Plug-in")
{
callback(tags[i]);
return true;
}
}
todo(false, "Need a test plugin on this platform");
return false;
}
};