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 re | 7 import re |
8 import sys | 8 import sys |
9 import time | 9 import time |
10 | 10 |
11 import android_commands | 11 import android_commands |
12 import cmd_helper | 12 import cmd_helper |
13 import constants | 13 import constants |
14 import ports | 14 import ports |
15 | 15 |
16 from pylib import pexpect | 16 from pylib import pexpect |
17 | 17 |
18 | 18 |
19 def _MakeBinaryPath(build_type, binary_name): | 19 def _MakeBinaryPath(build_type, binary_name): |
20 return os.path.join(constants.CHROME_DIR, 'out', build_type, binary_name) | 20 return os.path.join(cmd_helper.OutDirectory(), build_type, binary_name) |
21 | 21 |
22 | 22 |
23 class Forwarder(object): | 23 class Forwarder(object): |
24 """Class to manage port forwards from the device to the host.""" | 24 """Class to manage port forwards from the device to the host.""" |
25 | 25 |
26 _DEVICE_FORWARDER_PATH = constants.TEST_EXECUTABLE_DIR + '/device_forwarder' | 26 _DEVICE_FORWARDER_PATH = constants.TEST_EXECUTABLE_DIR + '/device_forwarder' |
27 | 27 |
28 # Unix Abstract socket path: | 28 # Unix Abstract socket path: |
29 _DEVICE_ADB_CONTROL_PORT = 'chrome_device_forwarder' | 29 _DEVICE_ADB_CONTROL_PORT = 'chrome_device_forwarder' |
30 _TIMEOUT_SECS = 30 | 30 _TIMEOUT_SECS = 30 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 def DevicePortForHostPort(self, host_port): | 154 def DevicePortForHostPort(self, host_port): |
155 """Get the device port that corresponds to a given host port.""" | 155 """Get the device port that corresponds to a given host port.""" |
156 return self._host_to_device_port_map.get(host_port) | 156 return self._host_to_device_port_map.get(host_port) |
157 | 157 |
158 def Close(self): | 158 def Close(self): |
159 """Terminate the forwarder process.""" | 159 """Terminate the forwarder process.""" |
160 if self._device_process: | 160 if self._device_process: |
161 self._device_process.close() | 161 self._device_process.close() |
162 self._device_process = None | 162 self._device_process = None |
OLD | NEW |