diff options
author | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-18 17:46:49 +0000 |
---|---|---|
committer | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-18 17:46:49 +0000 |
commit | 3254c84298716f1c0bc5621129c41052fa594d2a (patch) | |
tree | 6d6c950330eb8ee48805a8d46b43fdd52de128ab /tools | |
parent | 357b51741519bad4cf3afc7a1603b9bb46556fe7 (diff) | |
download | chromium_src-3254c84298716f1c0bc5621129c41052fa594d2a.zip chromium_src-3254c84298716f1c0bc5621129c41052fa594d2a.tar.gz chromium_src-3254c84298716f1c0bc5621129c41052fa594d2a.tar.bz2 |
Fix chrome remote control on android after r162150.
That revision changed build/android/pylib/forwarder to use forwarder2 which
caused CRC to inherit forwarder2. This broke two things:
1. Since there is now a host_forwarder in addition to device_forwarder, we can't
pass 'unused' as the build_type to Forwarder.__init__ because it is used for
starting the host_forwarder.
2. When using the Forwarder class directly, the TEST_SERVER_PORT_FILE may not
exist. So create it if it doesn't exist rather than asserting that it does.
BUG=154412
TEST=Manual testing on linux
Review URL: https://codereview.chromium.org/11195034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162732 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
3 files changed, 14 insertions, 31 deletions
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 2cdea47..d0a3528 100644 --- a/tools/chrome_remote_control/chrome_remote_control/adb_commands.py +++ b/tools/chrome_remote_control/chrome_remote_control/adb_commands.py @@ -119,12 +119,12 @@ class AdbCommands(object): def IsRootEnabled(self): return self._adb.IsRootEnabled() -def HasForwarder(adb): - return adb.FileExistsOnDevice('/data/local/tmp/forwarder') - -def HowToInstallForwarder(): - return 'adb push out/$BUILD_TYPE/forwarder %s' % ( - '/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'))) class Forwarder(object): def __init__(self, adb, host_port): @@ -134,27 +134,12 @@ class Forwarder(object): 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 diff --git a/tools/chrome_remote_control/chrome_remote_control/android_browser_backend.py b/tools/chrome_remote_control/chrome_remote_control/android_browser_backend.py index 961501c..223b8c8 100644 --- a/tools/chrome_remote_control/chrome_remote_control/android_browser_backend.py +++ b/tools/chrome_remote_control/chrome_remote_control/android_browser_backend.py @@ -26,7 +26,7 @@ class AndroidBrowserBackend(browser_backend.BrowserBackend): # Kill old browser. self._adb.KillAll(self._package) - self._adb.KillAll('forwarder') + self._adb.KillAll('device_forwarder') self._adb.Forward('tcp:9222', self._devtools_remote_port) # Chrome Android doesn't listen to --user-data-dir. diff --git a/tools/chrome_remote_control/chrome_remote_control/android_browser_finder.py b/tools/chrome_remote_control/chrome_remote_control/android_browser_finder.py index 92c6a28..ec12c90 100644 --- a/tools/chrome_remote_control/chrome_remote_control/android_browser_finder.py +++ b/tools/chrome_remote_control/chrome_remote_control/android_browser_finder.py @@ -136,11 +136,9 @@ def FindAllAvailableBrowsers(options, logging=real_logging): # but make it accessible to the device. if len(possible_browsers) and not adb_commands.HasForwarder(adb): logging.warn('chrome_remote_control detected an android device. However,') - logging.warn('Chrome\'s port-forwarder app is not installed on the device.') + logging.warn('Chrome\'s port-forwarder app is not available.') logging.warn('To build:') - logging.warn(' make -j16 out/$BUILDTYPE/forwarder') - logging.warn('And then install it:') - logging.warn(' %s', adb_commands.HowToInstallForwarder()) + logging.warn(' make -j16 host_forwarder device_forwarder') logging.warn('') logging.warn('') return [] |