| 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 """Finds android browsers that can be controlled by telemetry.""" | 4 """Finds android browsers that can be controlled by telemetry.""" |
| 5 | 5 |
| 6 import os | 6 import os |
| 7 import logging as real_logging | 7 import logging as real_logging |
| 8 import re | 8 import re |
| 9 import subprocess | 9 import subprocess |
| 10 | 10 |
| 11 from telemetry import adb_commands | 11 from telemetry import adb_commands |
| 12 from telemetry import android_browser_backend | 12 from telemetry import android_browser_backend |
| 13 from telemetry import android_platform | 13 from telemetry import android_platform_backend |
| 14 from telemetry import browser | 14 from telemetry import browser |
| 15 from telemetry import platform |
| 15 from telemetry import possible_browser | 16 from telemetry import possible_browser |
| 16 | 17 |
| 17 ALL_BROWSER_TYPES = ','.join([ | 18 ALL_BROWSER_TYPES = ','.join([ |
| 18 'android-content-shell', | 19 'android-content-shell', |
| 19 'android-chrome', | 20 'android-chrome', |
| 20 'android-jb-system-chrome', | 21 'android-jb-system-chrome', |
| 21 ]) | 22 ]) |
| 22 | 23 |
| 23 CHROME_PACKAGE = 'com.google.android.apps.chrome' | 24 CHROME_PACKAGE = 'com.google.android.apps.chrome' |
| 24 CHROME_ACTIVITY = '.Main' | 25 CHROME_ACTIVITY = '.Main' |
| (...skipping 21 matching lines...) Expand all Loading... |
| 46 super(PossibleAndroidBrowser, self).__init__( | 47 super(PossibleAndroidBrowser, self).__init__( |
| 47 browser_type, options) | 48 browser_type, options) |
| 48 self._args = args | 49 self._args = args |
| 49 | 50 |
| 50 def __repr__(self): | 51 def __repr__(self): |
| 51 return 'PossibleAndroidBrowser(browser_type=%s)' % self.browser_type | 52 return 'PossibleAndroidBrowser(browser_type=%s)' % self.browser_type |
| 52 | 53 |
| 53 def Create(self): | 54 def Create(self): |
| 54 backend = android_browser_backend.AndroidBrowserBackend( | 55 backend = android_browser_backend.AndroidBrowserBackend( |
| 55 self._options, *self._args) | 56 self._options, *self._args) |
| 56 platform = android_platform.AndroidPlatform( | 57 platform_backend = android_platform_backend.AndroidPlatformBackend( |
| 57 self._args[0].Adb(), self._args[1], | 58 self._args[0].Adb(), self._args[1], |
| 58 self._args[1] + self._args[4]) | 59 self._args[1] + self._args[4]) |
| 59 b = browser.Browser(backend, platform) | 60 b = browser.Browser(backend, platform.Platform(platform_backend)) |
| 60 backend.SetBrowser(b) | 61 backend.SetBrowser(b) |
| 61 return b | 62 return b |
| 62 | 63 |
| 63 def FindAllAvailableBrowsers(options, logging=real_logging): | 64 def FindAllAvailableBrowsers(options, logging=real_logging): |
| 64 """Finds all the desktop browsers available on this machine.""" | 65 """Finds all the desktop browsers available on this machine.""" |
| 65 if not adb_commands.IsAndroidSupported(): | 66 if not adb_commands.IsAndroidSupported(): |
| 66 return [] | 67 return [] |
| 67 | 68 |
| 68 # See if adb even works. | 69 # See if adb even works. |
| 69 try: | 70 try: |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 # but make it accessible to the device. | 143 # but make it accessible to the device. |
| 143 if len(possible_browsers) and not adb_commands.HasForwarder(): | 144 if len(possible_browsers) and not adb_commands.HasForwarder(): |
| 144 logging.warn('telemetry detected an android device. However,') | 145 logging.warn('telemetry detected an android device. However,') |
| 145 logging.warn('Chrome\'s port-forwarder app is not available.') | 146 logging.warn('Chrome\'s port-forwarder app is not available.') |
| 146 logging.warn('To build:') | 147 logging.warn('To build:') |
| 147 logging.warn(' make -j16 host_forwarder device_forwarder') | 148 logging.warn(' make -j16 host_forwarder device_forwarder') |
| 148 logging.warn('') | 149 logging.warn('') |
| 149 logging.warn('') | 150 logging.warn('') |
| 150 return [] | 151 return [] |
| 151 return possible_browsers | 152 return possible_browsers |
| OLD | NEW |