Bug 887291 - Allow marionette test runner to pass command line arguments onto the application, r=jgriffin

This commit is contained in:
Andrew Halberstadt 2013-08-07 11:46:25 -04:00
parent 8ae4ae4db0
commit 577e34919d
3 changed files with 14 additions and 7 deletions

View File

@ -18,11 +18,12 @@ class GeckoInstance(object):
"browser.sessionstore.resume_from_crash": False,
"browser.warnOnQuit": False}
def __init__(self, host, port, bin, profile):
def __init__(self, host, port, bin, profile, app_args=None):
self.marionette_host = host
self.marionette_port = port
self.bin = bin
self.profile = profile
self.app_args = app_args or []
self.runner = None
def start(self):
@ -41,7 +42,7 @@ class GeckoInstance(object):
self.runner = runner_class.create(
binary=self.bin,
profile_args=profile_args,
cmdargs=['-no-remote', '-marionette'],
cmdargs=['-no-remote', '-marionette'] + self.app_args,
kp_kwargs={
'processOutputLine': [NullOutput()],
'logfile': self.gecko_log})

View File

@ -198,14 +198,13 @@ class Marionette(object):
TIMEOUT_SCRIPT = 'script'
TIMEOUT_PAGE = 'page load'
def __init__(self, host='localhost', port=2828, app=None, bin=None,
def __init__(self, host='localhost', port=2828, app=None, app_args=None, bin=None,
profile=None, emulator=None, sdcard=None, emulatorBinary=None,
emulatorImg=None, emulator_res=None, gecko_path=None,
connectToRunningEmulator=False, homedir=None, baseurl=None,
noWindow=False, logcat_dir=None, busybox=None, symbols_path=None, timeout=None):
self.host = host
self.port = self.local_port = port
self.app = app
self.bin = bin
self.instance = None
self.profile = profile
@ -236,7 +235,7 @@ class Marionette(object):
else:
instance_class = geckoinstance.GeckoInstance
self.instance = instance_class(host=self.host, port=self.port,
bin=self.bin, profile=self.profile)
bin=self.bin, profile=self.profile, app_args=app_args)
self.instance.start()
assert(self.wait_for_port())

View File

@ -210,8 +210,8 @@ class MarionetteTestRunner(object):
def __init__(self, address=None, emulator=None, emulatorBinary=None,
emulatorImg=None, emulator_res='480x800', homedir=None,
app=None, bin=None, profile=None, autolog=False, revision=None,
logger=None, testgroup="marionette", noWindow=False,
app=None, app_args=None, bin=None, profile=None, autolog=False,
revision=None, logger=None, testgroup="marionette", noWindow=False,
logcat_dir=None, xml_output=None, repeat=0, gecko_path=None,
testvars=None, tree=None, type=None, device_serial=None,
symbols_path=None, timeout=None, es_servers=None, **kwargs):
@ -222,6 +222,7 @@ class MarionetteTestRunner(object):
self.emulator_res = emulator_res
self.homedir = homedir
self.app = app
self.app_args = app_args or []
self.bin = bin
self.profile = profile
self.autolog = autolog
@ -327,6 +328,7 @@ class MarionetteTestRunner(object):
self.marionette = Marionette(host=host,
port=int(port),
app=self.app,
app_args=self.app_args,
bin=self.bin,
profile=self.profile,
baseurl=self.baseurl,
@ -696,6 +698,11 @@ class MarionetteTestOptions(OptionParser):
dest='app',
action='store',
help='application to use')
self.add_option('--app-arg',
dest='app_args',
action='append',
default=[],
help='specify a command line argument to be passed onto the application')
self.add_option('--binary',
dest='bin',
action='store',