Bug 1320643 - Remove Device.setup_port_forward from mozrunner; r?jmaher
The only consumer of `mozrunner.devices.base.Device.setup_port_forward`
was Marionette, which now uses `mozdevice.DeviceManagerADB.forward`
directly.
MozReview-Commit-ID: 72ROrOixKvM
--- a/testing/mozbase/mozrunner/mozrunner/devices/base.py
+++ b/testing/mozbase/mozrunner/mozrunner/devices/base.py
@@ -181,35 +181,16 @@ class Device(object):
# while calling adb shell directly does.
args = [self.app_ctx.adb, '-s', self.dm._deviceSerial,
'shell', 'cd /system/bin; chmod 555 busybox;'
'for x in `./busybox --list`; do ln -s ./busybox $x; done']
adb = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
adb.wait()
self.dm._verifyZip()
- def setup_port_forwarding(self, local_port=None, remote_port=2828):
- """
- Set up TCP port forwarding to the specified port on the device,
- using any availble local port (if none specified), and return the local port.
-
- :param local_port: The local port to forward from, if unspecified a
- random port is chosen.
- :param remote_port: The remote port to forward to, defaults to 2828.
- :returns: The local_port being forwarded.
- """
- if not local_port:
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.bind(("", 0))
- local_port = s.getsockname()[1]
- s.close()
-
- self.dm.forward('tcp:%d' % int(local_port), 'tcp:%d' % int(remote_port))
- return local_port
-
def wait_for_net(self):
active = False
time_out = 0
while not active and time_out < 40:
proc = subprocess.Popen([self.app_ctx.adb, 'shell', '/system/bin/netcfg'],
stdout=subprocess.PIPE)
proc.stdout.readline() # ignore first line
line = proc.stdout.readline()