| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import pexpect | |
| 8 import re | 7 import re |
| 9 import sys | 8 import sys |
| 10 import time | 9 import time |
| 11 | 10 |
| 12 import android_commands | 11 import android_commands |
| 13 import cmd_helper | 12 import cmd_helper |
| 14 import constants | 13 import constants |
| 15 import ports | 14 import ports |
| 16 | 15 |
| 16 from pylib import pexpect |
| 17 |
| 17 class Forwarder(object): | 18 class Forwarder(object): |
| 18 """Class to manage port forwards from the device to the host.""" | 19 """Class to manage port forwards from the device to the host.""" |
| 19 | 20 |
| 20 _DEVICE_FORWARDER_PATH = constants.TEST_EXECUTABLE_DIR + '/device_forwarder' | 21 _DEVICE_FORWARDER_PATH = constants.TEST_EXECUTABLE_DIR + '/device_forwarder' |
| 21 | 22 |
| 22 # Unix Abstract socket path: | 23 # Unix Abstract socket path: |
| 23 _DEVICE_ADB_CONTROL_PORT = 'chrome_device_forwarder' | 24 _DEVICE_ADB_CONTROL_PORT = 'chrome_device_forwarder' |
| 24 _TIMEOUT_SECS = 30 | 25 _TIMEOUT_SECS = 30 |
| 25 | 26 |
| 26 def __init__(self, adb, port_pairs, tool, host_name, build_type): | 27 def __init__(self, adb, port_pairs, tool, host_name, build_type): |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 self._device_process = None | 189 self._device_process = None |
| 189 self._adb_forward_process = None | 190 self._adb_forward_process = None |
| 190 | 191 |
| 191 def DevicePortForHostPort(self, host_port): | 192 def DevicePortForHostPort(self, host_port): |
| 192 """Get the device port that corresponds to a given host port.""" | 193 """Get the device port that corresponds to a given host port.""" |
| 193 return self._host_to_device_port_map.get(host_port) | 194 return self._host_to_device_port_map.get(host_port) |
| 194 | 195 |
| 195 def Close(self): | 196 def Close(self): |
| 196 """Terminate the forwarder process.""" | 197 """Terminate the forwarder process.""" |
| 197 self._CloseProcess() | 198 self._CloseProcess() |
| OLD | NEW |