Bug 613109 - Make it possible to run a mochitest-* test suite with an extension installed; r=ted

This commit is contained in:
Ehsan Akhgari 2010-11-18 17:15:54 -05:00
parent 56e6f8182f
commit be77af5b37
2 changed files with 30 additions and 0 deletions

View File

@ -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 <id>.xpi where <id> is"
"the extension's id as indicated in its install.rdf.")
defaults["extensionsToInstall"] = []
self.set_defaults(**defaults)
def main():

View File

@ -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 <id>.xpi where <id> 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)