diff --git a/layout/tools/reftest/runreftest.py b/layout/tools/reftest/runreftest.py index cc3266dde87..c9815bc3256 100644 --- a/layout/tools/reftest/runreftest.py +++ b/layout/tools/reftest/runreftest.py @@ -139,6 +139,7 @@ class RefTest(object): profileDir = mkdtemp() self.createReftestProfile(options, profileDir) self.copyExtraFilesToProfile(options, profileDir) + self.installExtensionsToProfile(options, profileDir) # browser environment browserEnv = self.buildBrowserEnv(options, profileDir) @@ -173,6 +174,13 @@ class RefTest(object): else: shutil.copy(abspath, dest) + def installExtensionsToProfile(self, options, profileDir): + "Install the specified extensions on the command line to the testing profile." + for f in options.extensionsToInstall: + abspath = self.getFullPath(f) + extensionID = f[:f.rfind(".")] + self.automation.installExtension(abspath, profileDir, extensionID) + class ReftestOptions(OptionParser): @@ -233,6 +241,13 @@ class ReftestOptions(OptionParser): help = "skip tests marked as slow when running") defaults["skipSlowTests"] = False + self.add_option("--install-extension", + action = "append", dest = "extensionsToInstall", + help = "install the specified extension in the testing profile." + "The extension file's name should be .xpi where is" + "the extension's id as indicated in its install.rdf.") + defaults["extensionsToInstall"] = [] + self.set_defaults(**defaults) def main(): diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index eda1f6b5986..61eac0461fc 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -207,6 +207,13 @@ class MochitestOptions(optparse.OptionParser): help = "copy specified files/dirs to testing profile") defaults["extraProfileFiles"] = [] + self.add_option("--install-extension", + action = "append", dest = "extensionsToInstall", + help = "install the specified extension in the testing profile." + "The extension file's name should be .xpi where is" + "the extension's id as indicated in its install.rdf.") + defaults["extensionsToInstall"] = [] + self.add_option("--profile-path", action = "store", type = "string", dest = "profilePath", help = "Directory where the profile will be stored." @@ -493,6 +500,7 @@ class Mochitest(object): not options.a11y): self.installSpecialPowersExtension(options) + self.installExtensionsToProfile(options) return manifest def buildBrowserEnv(self, options): @@ -760,6 +768,13 @@ overlay chrome://browser/content/browser.xul chrome://mochikit/content/browser-t else: shutil.copy(abspath, dest) + def installExtensionsToProfile(self, options): + "Install the specified extensions on the command line to the testing profile." + for f in options.extensionsToInstall: + abspath = self.getFullPath(f) + extensionID = f[:f.rfind(".")] + self.automation.installExtension(abspath, options.profilePath, extensionID) + def main(): automation = Automation() mochitest = Mochitest(automation)