Bug 895471 - part 1: allow passing the flag to mochitest-browser, r=ted

This commit is contained in:
Gijs Kruitbosch 2013-10-21 18:12:12 +02:00
Родитель 9966968375
Коммит c821c8ff3e
3 изменённых файлов: 24 добавлений и 1 удалений

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

@ -185,7 +185,7 @@ class MochitestRunner(MozbuildObject):
def run_desktop_test(self, suite=None, test_file=None, debugger=None,
debugger_args=None, shuffle=False, keep_open=False, rerun_failures=False,
no_autorun=False, repeat=0, run_until_failure=False, slow=False,
chunk_by_dir=0, total_chunks=None, this_chunk=None):
chunk_by_dir=0, total_chunks=None, this_chunk=None, jsdebugger=False):
"""Runs a mochitest.
test_file is a path to a test file. It can be a relative path from the
@ -285,6 +285,7 @@ class MochitestRunner(MozbuildObject):
options.chunkByDir = chunk_by_dir
options.totalChunks = total_chunks
options.thisChunk = this_chunk
options.jsdebugger = jsdebugger
options.failureFile = failure_file_path
@ -404,6 +405,10 @@ def MochitestCommand(func):
help='If running tests by chunks, the number of the chunk to run.')
func = this_chunk(func)
jsdebugger = CommandArgument('--jsdebugger', action='store_true',
help='Start the browser JS debugger before running the test. Implies --no-autorun.')
func = jsdebugger(func)
path = CommandArgument('test_file', default=None, nargs='?',
metavar='TEST',
help='Test to run. Can be specified as a single file, a ' \

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

@ -320,6 +320,12 @@ class MochitestOptions(optparse.OptionParser):
"metavar": "PREF=VALUE",
"help": "defines an extra user preference",
}],
[["--jsdebugger"],
{ "action": "store_true",
"default": False,
"dest": "jsdebugger",
"help": "open the browser debugger",
}],
]
def __init__(self, **kwargs):
@ -413,6 +419,15 @@ class MochitestOptions(optparse.OptionParser):
if options.webapprtContent and options.webapprtChrome:
self.error("Only one of --webapprt-content and --webapprt-chrome may be given.")
if options.jsdebugger:
options.extraPrefs += [
"devtools.debugger.remote-enabled=true",
"devtools.debugger.chrome-enabled=true",
"devtools.chrome.enabled=true",
"devtools.debugger.prompt-connection=false"
]
options.autorun = False
# Try to guess the testing modules directory.
# This somewhat grotesque hack allows the buildbot machines to find the
# modules directory without having to configure the buildbot hosts. This

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

@ -975,6 +975,9 @@ class Mochitest(MochitestUtilsMixin):
options.browserArgs.extend(('-firefoxpath', options.app))
options.app = self.immersiveHelperPath
if options.jsdebugger:
options.browserArgs.extend(['-jsdebugger'])
# Remove the leak detection file so it can't "leak" to the tests run.
# The file is not there if leak logging was not enabled in the application build.
if os.path.exists(self.leak_report_file):