Bug 688330 - 'Make special-powers install method a little less special'. r=ted.

This commit is contained in:
Ben Turner 2011-10-14 08:53:06 -07:00
parent 448688702f
commit 778826e8f7
2 changed files with 28 additions and 28 deletions

View File

@ -515,21 +515,11 @@ class Mochitest(object):
"""
return self.getFullPath(logFile)
def installSpecialPowersExtension(self, options):
""" install the Special Powers extension for special testing capabilities """
extensionSource = os.path.normpath(os.path.join(self.SCRIPT_DIRECTORY, "specialpowers"))
self.automation.log.info("INFO | runtests.py | Installing extension at %s to %s." %
(extensionSource, options.profilePath))
self.automation.installExtension(extensionSource, options.profilePath, "special-powers@mozilla.org")
self.automation.log.info("INFO | runtests.py | Done installing extension.")
def buildProfile(self, options):
""" create the profile and add optional chrome bits and files if requested """
self.automation.initializeProfile(options.profilePath, options.extraPrefs, useServerLocations = True)
manifest = self.addChromeToProfile(options)
self.copyExtraFilesToProfile(options)
self.installSpecialPowersExtension(options)
self.installExtensionsToProfile(options)
return manifest
@ -850,24 +840,33 @@ overlay chrome://navigator/content/navigator.xul chrome://mochikit/content/brows
self.automation.log.warning("WARNING | runtests.py | Failed to copy %s to profile", abspath)
continue
def installExtensionFromPath(self, options, path, extensionID = None):
extensionPath = self.getFullPath(path)
self.automation.log.info("INFO | runtests.py | Installing extension at %s to %s." %
(extensionPath, options.profilePath))
self.automation.installExtension(extensionPath, options.profilePath,
extensionID)
def installExtensionsToProfile(self, options):
"Install application distributed extensions and specified on the command line ones to testing profile."
# Install distributed extensions, if application has any.
distExtDir = os.path.join(options.app[ : options.app.rfind(os.sep)], "distribution", "extensions")
if os.path.isdir(distExtDir):
for f in os.listdir(distExtDir):
self.automation.installExtension(os.path.join(distExtDir, f), options.profilePath)
"Install special testing extensions, application distributed extensions, and specified on the command line ones to testing profile."
extensionDirs = [
# Extensions distributed with the test harness.
os.path.normpath(os.path.join(self.SCRIPT_DIRECTORY, "extensions")),
# Extensions distributed with the application.
os.path.join(options.app[ : options.app.rfind(os.sep)], "distribution", "extensions")
]
# Install custom extensions.
for f in options.extensionsToInstall:
if f.endswith(os.sep):
f = f[:-1]
for extensionDir in extensionDirs:
if os.path.isdir(extensionDir):
for dirEntry in os.listdir(extensionDir):
path = os.path.join(extensionDir, dirEntry)
if os.path.isdir(path) or (os.path.isfile(path) and path.endswith(".xpi")):
self.installExtensionFromPath(options, path)
extensionPath = self.getFullPath(f)
self.automation.log.info("INFO | runtests.py | Installing extension at %s to %s." %
(extensionPath, options.profilePath))
self.automation.installExtension(extensionPath, options.profilePath)
# Install custom extensions passed on the command line.
for path in options.extensionsToInstall:
self.installExtensionFromPath(options, path)
def main():
automation = Automation()

View File

@ -54,12 +54,13 @@ EXTRA_COMPONENTS = components/SpecialPowersObserver.js
XPI_NAME=specialpowers
DEST_DIR=testing/mochitest
# Used in install.rdf
USE_EXTENSION_MANIFEST=1
TEST_EXTENSIONS_DIR = $(DEPTH)/_tests/testing/mochitest/extensions
include $(topsrcdir)/config/rules.mk
libs::
(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - specialpowers) | (cd $(DEPTH)/_tests/$(DEST_DIR) && tar -xf -)
$(MKDIR) -p $(TEST_EXTENSIONS_DIR)
(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - $(XPI_NAME)) | (cd $(TEST_EXTENSIONS_DIR) && tar -xf -)