Chromium Code Reviews| Index: tools/chrome_remote_control/chrome_remote_control/adb_commands.py |
| diff --git a/tools/chrome_remote_control/chrome_remote_control/adb_commands.py b/tools/chrome_remote_control/chrome_remote_control/adb_commands.py |
| index 2cdea47934d2a3e07d4759cf1bd07e09575d35de..0763fab5fa32d1d2a1ba565423513d598f2b9a1f 100644 |
| --- a/tools/chrome_remote_control/chrome_remote_control/adb_commands.py |
| +++ b/tools/chrome_remote_control/chrome_remote_control/adb_commands.py |
| @@ -119,42 +119,33 @@ class AdbCommands(object): |
| def IsRootEnabled(self): |
| return self._adb.IsRootEnabled() |
| -def HasForwarder(adb): |
| - return adb.FileExistsOnDevice('/data/local/tmp/forwarder') |
| + |
| +def HasForwarder(adb, buildtype=None): |
| + if not buildtype: |
| + return (HasForwarder(adb, buildtype='Release') or |
| + HasForwarder(adb, buildtype='Debug')) |
| + return (os.path.exists(os.path.join('out', buildtype, 'device_forwarder')) and |
| + os.path.exists(os.path.join('out', buildtype, 'host_forwarder'))) |
| + |
| def HowToInstallForwarder(): |
| - return 'adb push out/$BUILD_TYPE/forwarder %s' % ( |
| - '/data/local/tmp/forwarder') |
| + return 'adb push out/$BUILD_TYPE/device_forwarder %s' % ( |
| + '/data/local/tmp/device_forwarder') |
| class Forwarder(object): |
| def __init__(self, adb, host_port): |
| assert HasForwarder(adb) |
| - port_pairs = [(host_port, host_port), ] |
| + port_pairs = [(0, host_port), ] |
|
tonyg
2012/10/19 00:47:19
Why the 0? I didn't need this in my patch.
bulach
2012/10/22 15:57:14
0 means dynamically allocating the device port. si
|
| tool = valgrind_tools.BaseTool() |
| self._host_port = host_port |
| - |
| - # Currently, Forwarder requires that ../out/Debug/forwarder exists, |
| - # in case it needs to push it to the device. However, to get to here, |
| - # android_browser_finder has ensured that device HasForwarder, above. |
| - # |
| - # Therefore, here, we just need to instantiate the forwarder, no push |
| - # needed. |
| - # |
| - # To do this, we monkey patch adb.PushIfNeeded to a noop. |
| - # |
| - # TODO(nduca): Fix build.android.pylib.Forwarder to not need this. |
| - real_push_if_needed = adb.Adb().PushIfNeeded |
| - def FakePush(_, device_path): |
| - assert adb.FileExistsOnDevice(device_path) |
| - try: |
| - adb.Adb().PushIfNeeded = FakePush |
| - self._forwarder = forwarder.Forwarder( |
| + buildtype = 'Debug' |
| + if HasForwarder(adb, 'Release'): |
| + buildtype = 'Release' |
| + self._forwarder = forwarder.Forwarder( |
| adb.Adb(), port_pairs, |
| - tool, 'localhost', 'unused') |
| - finally: |
| - adb.Adb().PushIfNeeded = real_push_if_needed |
| + tool, '127.0.0.1', buildtype) |
| self._device_port = self._forwarder.DevicePortForHostPort(self._host_port) |
| @property |