Bug 787203 - [mozdevice] Add remove_forward method to DeviceManagerADB; r?ahal draft
authorMaja Frydrychowicz <mjzffr@gmail.com>
Tue, 28 Jun 2016 23:41:30 -0400
changeset 384164 35b9e271b1a5c7161d0981d0aa61fb7607f56d94
parent 384163 690640b663de9c1afb5e5d9a3ac059b2fcfcbd6d
child 384165 8a46ec066ec3223ec3d9aa60ddcadb00772180e9
push id22185
push usermjzffr@gmail.com
push dateTue, 05 Jul 2016 18:12:09 +0000
reviewersahal
bugs787203
milestone50.0a1
Bug 787203 - [mozdevice] Add remove_forward method to DeviceManagerADB; r?ahal For adb forward --remove|remove-all MozReview-Commit-ID: FrfFOCSQl6q
testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py
--- a/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py
+++ b/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py
@@ -179,16 +179,29 @@ class DeviceManagerADB(DeviceManager):
           localreserved:<unix domain socket name>
           localfilesystem:<unix domain socket name>
           dev:<character device name>
           jdwp:<process pid> (remote only)
         """
         if not self._checkCmd(['forward', local, remote], timeout=self.short_timeout) == 0:
             raise DMError("Failed to forward socket connection.")
 
+    def remove_forward(self, local=None):
+        """
+        Turn off forwarding of socket connection.
+        """
+        cmd = ['forward']
+        if local is None:
+            cmd.extend(['--remove-all'])
+        else:
+            cmd.extend(['--remove', local])
+        if not self._checkCmd(cmd, timeout=self.short_timeout) == 0:
+            raise DMError("Failed to remove connection forwarding.")
+
+
     def remount(self):
         "Remounts the /system partition on the device read-write."
         return self._checkCmd(['remount'], timeout=self.short_timeout)
 
     def devices(self):
         "Return a list of connected devices as (serial, status) tuples."
         proc = self._runCmd(['devices'])
         proc.output.pop(0) # ignore first line of output