Bug 904812 - "Make resources 'testing-common' and 'testing' available in Mozmill tests" r=Fallen, a=jcranmer

--HG--
extra : commitid : FT5wR9BclwZ
extra : rebase_source : d688a14fe48af31075bb292fb14bdfa604e812d0
extra : amend_source : 4fef6765e44c4f514b16c6549ffd164ea7a44219
This commit is contained in:
Joshua Cranmer 2015-04-17 15:38:00 -05:00
Родитель 9268a74662
Коммит 8f8cf84ffe
4 изменённых файлов: 29 добавлений и 1 удалений

Просмотреть файл

@ -38,6 +38,7 @@ PLUGINS_PATH = None
# because we know that we run MozMill only once per process. This needs to be
# fixed if that ever changes.
TEST_NAME = None
TESTING_MODULES_DIR = None
# The name of the (optional) module that tests can define as a wrapper (e.g. to
# run before Thunderbird is started)
@ -312,6 +313,8 @@ def monkeypatched_15_run_tests(self, tests, sleeptime=0):
# transfer persisted data
frame.persisted = self.persisted
frame.registerModule("testing-common", TESTING_MODULES_DIR)
if len(tests) == 1 and not os.path.isdir(tests[0]):
# tests[0] isn't necessarily an abspath'd path, so do that now
test = os.path.abspath(tests[0])
@ -337,9 +340,12 @@ class ThunderTestCLI(mozmill.CLI):
help="The path to the symbol files from build_symbols")
parser.add_option('--plugins-path', default=None, dest="plugins",
help="The path to the plugins directory for the created profile")
parser.add_option('--testing-modules-dir', default=None,
dest="testingmodules",
help="The path to the testing modules directory")
def __init__(self, *args, **kwargs):
global SYMBOLS_PATH, PLUGINS_PATH, TEST_NAME
global SYMBOLS_PATH, PLUGINS_PATH, TEST_NAME, TESTING_MODULES_DIR
# note: we previously hardcoded a JS bridge timeout of 300 seconds,
# but the default is now 60 seconds...
@ -359,6 +365,7 @@ class ThunderTestCLI(mozmill.CLI):
SYMBOLS_PATH = self.options.symbols
PLUGINS_PATH = self.options.plugins
TESTING_MODULES_DIR = self.options.testingmodules
if isinstance(self.options.test, basestring):
test_paths = [self.options.test]
else:

Просмотреть файл

@ -42,6 +42,11 @@ class RunTestListOptions(optparse.OptionParser):
action = "store", type = "string", dest = "plugins",
help = "The path to the plugins folder for the test profiles")
self.add_option("--testing-modules-dir",
action="store", type="string", dest="testingmodules",
help="The path to the testing modules directory")
defaults["testingmodules"] = ""
self.set_defaults(**defaults);
usage = """\
@ -80,6 +85,10 @@ for directory in f:
args.append("--plugins-path")
args.append(options.plugins)
if options.testingmodules:
args.append("--testing-modules-dir")
args.append(os.path.abspath(options.testingmodules))
print args
outputPipe = subprocess.PIPE

Просмотреть файл

@ -718,3 +718,13 @@ var runTestFile = function (filename, invokedFromIDE) {
var getThread = function () {
return thread;
}
function registerModule(name, path) {
let protocolHandler = Services.io.getProtocolHandler("resource")
.QueryInterface(Components.interfaces.nsIResProtocolHandler);
let modulesFile = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
modulesFile.initWithPath(path);
protocolHandler.setSubstitution(name, ios.newFileURI(modulesFile));
}

Просмотреть файл

@ -34,6 +34,7 @@ mozmill:
--dir=$(abspath $(topsrcdir))/../mail/test/mozmill \
--symbols-path=$(abspath $(DIST)/crashreporter-symbols) \
--plugins-path=$(abspath $(DIST)/plugins) \
--testing-modules-dir=$(abspath $(DEPTH)/_tests/modules) \
$(MOZMILL_EXTRA)
mozmill-one: solo-test = $(find-solo-test)
@ -44,6 +45,7 @@ mozmill-one:
--binary=$(abspath $(BINARY)) \
--symbols-path=$(abspath $(DIST)/crashreporter-symbols) \
--plugins-path=$(abspath $(DIST)/plugins) \
--testing-modules-dir=$(abspath $(DEPTH)/_tests/modules) \
$(MOZMILL_EXTRA)
# We need to add the mozmill tests to the package for tests.