Bug 1320643 - Use device manager directly when forwarding Marionette port; r?whimboo draft
authorAndreas Tolfsen <ato@mozilla.com>
Fri, 02 Dec 2016 17:30:00 +0000
changeset 447634 e96c6bfc1f21e5ec859ecd52ba679b63b03447cc
parent 447633 ad993783599ab2ede0cf931fdec02f4df40a7a6d
child 447635 0a9ccdb4af1ddd05b9fd5c03cc794a792359a89e
push id38095
push userbmo:ato@mozilla.com
push dateTue, 06 Dec 2016 23:17:59 +0000
reviewerswhimboo
bugs1320643
milestone53.0a1
Bug 1320643 - Use device manager directly when forwarding Marionette port; r?whimboo The `mozrunner.devices.base.setup_port_forwarding` function adds extra complexity if the `local_port` argument is undefined which we do not need here. MozReview-Commit-ID: GSAgTT9nlmK
testing/marionette/client/marionette_driver/geckoinstance.py
--- a/testing/marionette/client/marionette_driver/geckoinstance.py
+++ b/testing/marionette/client/marionette_driver/geckoinstance.py
@@ -333,20 +333,21 @@ class FennecInstance(GeckoInstance):
             "filterspec": "Gecko",
             "serial": self.runner.device.dm._deviceSerial
         }
         if self.gecko_log == "-":
             logcat_args["stream"] = sys.stdout
         else:
             logcat_args["logfile"] = self.gecko_log
         self.runner.device.start_logcat(**logcat_args)
-        self.runner.device.setup_port_forwarding(
-            local_port=self.marionette_port,
-            remote_port=self.marionette_port,
-        )
+
+        # forward marionette port (localhost:2828)
+        self.runner.device.dm.forward(
+            local="tcp:{}".format(self.marionette_port),
+            remote="tcp:{}".format(self.marionette_port))
 
     def _get_runner_args(self):
         process_args = {
             "processOutputLine": [NullOutput()],
         }
 
         runner_args = {
             "app": self.package_name,
@@ -364,18 +365,17 @@ class FennecInstance(GeckoInstance):
             runner_args["avd"] = self.avd
 
         return runner_args
 
     def close(self, restart=False):
         super(FennecInstance, self).close(restart)
         if self.runner and self.runner.device.connected:
             self.runner.device.dm.remove_forward(
-                "tcp:{}".format(int(self.marionette_port))
-            )
+                "tcp:{}".format(self.marionette_port))
 
 
 class DesktopInstance(GeckoInstance):
     desktop_prefs = {
         # Disable application updates
         "app.update.enabled": False,
 
         # Enable output of dump()