From 3b5c4e36d3341a4171595dbced1191e2be0f5391 Mon Sep 17 00:00:00 2001 From: Joel Maher Date: Wed, 19 Oct 2011 05:35:05 -0400 Subject: [PATCH] Bug 675245 - cleanup pluginutils and SimpleTest.executeSoon() to utilize specialpowers. r=ted --- content/base/test/chrome/test_bug391728.html | 2 +- .../test/mochitest/test_clear_site_data.html | 2 +- testing/mochitest/chrome/Makefile.in | 1 + .../test_sanityPluginUtils.html | 7 ++--- testing/mochitest/jar.mn | 1 - testing/mochitest/tests/Makefile.in | 2 +- .../mochitest/tests/SimpleTest/ChromeUtils.js | 30 ++++++++++++++++++- .../mochitest/tests/SimpleTest/Makefile.in | 1 - .../mochitest/tests/SimpleTest/PluginUtils.js | 28 ----------------- 9 files changed, 36 insertions(+), 38 deletions(-) rename testing/mochitest/{tests => chrome}/test_sanityPluginUtils.html (77%) delete mode 100644 testing/mochitest/tests/SimpleTest/PluginUtils.js diff --git a/content/base/test/chrome/test_bug391728.html b/content/base/test/chrome/test_bug391728.html index 0fcad1e97f97..aa745105ed8c 100644 --- a/content/base/test/chrome/test_bug391728.html +++ b/content/base/test/chrome/test_bug391728.html @@ -6,7 +6,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=391728 Test for Bug 391728 - + diff --git a/dom/plugins/test/mochitest/test_clear_site_data.html b/dom/plugins/test/mochitest/test_clear_site_data.html index bd5d8dbc9562..564a1db668e1 100644 --- a/dom/plugins/test/mochitest/test_clear_site_data.html +++ b/dom/plugins/test/mochitest/test_clear_site_data.html @@ -2,7 +2,7 @@ NPAPI ClearSiteData/GetSitesWithData Functionality - + diff --git a/testing/mochitest/chrome/Makefile.in b/testing/mochitest/chrome/Makefile.in index 029fd045a4b2..e7018f2831f7 100644 --- a/testing/mochitest/chrome/Makefile.in +++ b/testing/mochitest/chrome/Makefile.in @@ -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 \ diff --git a/testing/mochitest/tests/test_sanityPluginUtils.html b/testing/mochitest/chrome/test_sanityPluginUtils.html similarity index 77% rename from testing/mochitest/tests/test_sanityPluginUtils.html rename to testing/mochitest/chrome/test_sanityPluginUtils.html index f23f70a3e5d2..b236c87090b8 100644 --- a/testing/mochitest/tests/test_sanityPluginUtils.html +++ b/testing/mochitest/chrome/test_sanityPluginUtils.html @@ -1,16 +1,15 @@ - Profiling test suite for PluginUtils - + - - + + diff --git a/testing/mochitest/jar.mn b/testing/mochitest/jar.mn index 3082e27cd133..64aac8246335 100644 --- a/testing/mochitest/jar.mn +++ b/testing/mochitest/jar.mn @@ -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) diff --git a/testing/mochitest/tests/Makefile.in b/testing/mochitest/tests/Makefile.in index 254d30c62a8a..2e110a83e9b7 100644 --- a/testing/mochitest/tests/Makefile.in +++ b/testing/mochitest/tests/Makefile.in @@ -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 diff --git a/testing/mochitest/tests/SimpleTest/ChromeUtils.js b/testing/mochitest/tests/SimpleTest/ChromeUtils.js index 73a1a544f4ab..41e53257dbcc 100644 --- a/testing/mochitest/tests/SimpleTest/ChromeUtils.js +++ b/testing/mochitest/tests/SimpleTest/ChromeUtils.js @@ -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; + } +}; diff --git a/testing/mochitest/tests/SimpleTest/Makefile.in b/testing/mochitest/tests/SimpleTest/Makefile.in index 2900692b7606..87502e97b66a 100644 --- a/testing/mochitest/tests/SimpleTest/Makefile.in +++ b/testing/mochitest/tests/SimpleTest/Makefile.in @@ -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 \ diff --git a/testing/mochitest/tests/SimpleTest/PluginUtils.js b/testing/mochitest/tests/SimpleTest/PluginUtils.js deleted file mode 100644 index d6535759e091..000000000000 --- a/testing/mochitest/tests/SimpleTest/PluginUtils.js +++ /dev/null @@ -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; - } -};