Bug 1320643 - Use device manager directly when forwarding Marionette port; r=whimboo
authorAndreas Tolfsen <ato@mozilla.com>
Fri, 02 Dec 2016 17:30:00 +0000
changeset 325359 29e885d1bf97f479c2719d31ac60f4e2816ceb29
parent 325358 1acac2205dc39c31965f5386b3ad4da445b5f920
child 325360 d4657cdb08125a7daab950a72066df1332f25f21
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +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()