Bug 787203 - [mozrunner] Pass application arguments to FennecRunner; r?ahal draft
authorMaja Frydrychowicz <mjzffr@gmail.com>
Thu, 30 Jun 2016 17:20:54 -0400
changeset 384163 690640b663de9c1afb5e5d9a3ac059b2fcfcbd6d
parent 384162 5740f34d24d9af7ea531de2d8af2f63dad751cdf
child 384164 35b9e271b1a5c7161d0981d0aa61fb7607f56d94
push id22185
push usermjzffr@gmail.com
push dateTue, 05 Jul 2016 18:12:09 +0000
reviewersahal
bugs787203
milestone50.0a1
Bug 787203 - [mozrunner] Pass application arguments to FennecRunner; r?ahal MozReview-Commit-ID: KGPOL2P94ED
testing/mozbase/mozrunner/mozrunner/base/device.py
testing/mozbase/mozrunner/mozrunner/runners.py
--- a/testing/mozbase/mozrunner/mozrunner/base/device.py
+++ b/testing/mozbase/mozrunner/mozrunner/base/device.py
@@ -156,24 +156,28 @@ class DeviceRunner(BaseRunner):
         return crashed
 
     def cleanup(self, *args, **kwargs):
         BaseRunner.cleanup(self, *args, **kwargs)
         self.device.cleanup()
 
 
 class FennecRunner(DeviceRunner):
+    def __init__(self, cmdargs=None, **kwargs):
+        super(FennecRunner, self).__init__(**kwargs)
+        self.cmdargs = cmdargs or []
 
     @property
     def command(self):
         cmd = [self.app_ctx.adb]
         if self.app_ctx.dm._deviceSerial:
             cmd.extend(['-s', self.app_ctx.dm._deviceSerial])
         cmd.append('shell')
         app = "%s/org.mozilla.gecko.BrowserApp" % self.app_ctx.remote_process
         cmd.extend(['am', 'start', '-a', 'android.activity.MAIN', '-n', app])
         params = ['-no-remote', '-profile', self.app_ctx.remote_profile]
+        params.extend(self.cmdargs)
         cmd.extend(['--es', 'args', '"%s"' % ' '.join(params)])
         # Append env variables in the form "--es env0 MOZ_CRASHREPORTER=1"
         for (count, (k, v)) in enumerate(self._device_env.iteritems()):
             cmd.extend(["--es", "env" + str(count), k + "=" + v])
 
         return cmd
--- a/testing/mozbase/mozrunner/mozrunner/runners.py
+++ b/testing/mozbase/mozrunner/mozrunner/runners.py
@@ -109,16 +109,17 @@ def FennecEmulatorRunner(avd='mozemulato
     :param avd_home: Path to avd parent directory
     :param logdir: Path to save logfiles such as logcat and qemu output.
     :param serial: Serial of emulator to connect to as seen in `adb devices`.
         Defaults to the first entry in `adb devices`.
     :param binary: Path to emulator binary.
         Defaults to None, which causes the device_class to guess based on PATH.
     :param app: Name of Fennec app (often org.mozilla.fennec_$USER)
         Defaults to 'org.mozilla.fennec'
+    :param cmdargs: Arguments to pass into binary.
     :returns: A DeviceRunner for Android emulators.
     """
     kwargs['app_ctx'] = get_app_context('fennec')(app, adb_path=adb_path,
                                                   avd_home=avd_home)
     device_args = { 'app_ctx': kwargs['app_ctx'],
                     'avd': avd,
                     'binary': binary,
                     'serial': serial,