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 import sys | 10 import sys |
11 | 11 |
12 from telemetry.core import browser | 12 from telemetry.core import browser |
13 from telemetry.core import possible_browser | 13 from telemetry.core import possible_browser |
14 from telemetry.core.chrome import adb_commands | 14 from telemetry.core.chrome import adb_commands |
15 from telemetry.core.chrome import android_browser_backend | 15 from telemetry.core.chrome import android_browser_backend |
16 from telemetry.core.chrome import android_platform | 16 from telemetry.core.chrome import android_platform_backend |
| 17 from telemetry.core.chrome import platform |
17 | 18 |
18 CHROME_PACKAGE_NAMES = { | 19 CHROME_PACKAGE_NAMES = { |
19 'android-chrome': 'com.google.android.apps.chrome', | 20 'android-chrome': 'com.google.android.apps.chrome', |
20 'android-chrome-beta': 'com.chrome.beta', | 21 'android-chrome-beta': 'com.chrome.beta', |
21 'android-chrome-dev': 'com.google.android.apps.chrome_dev', | 22 'android-chrome-dev': 'com.google.android.apps.chrome_dev', |
22 'android-jb-system-chrome': 'com.android.chrome' | 23 'android-jb-system-chrome': 'com.android.chrome' |
23 } | 24 } |
24 | 25 |
25 ALL_BROWSER_TYPES = ','.join(['android-content-shell'] + | 26 ALL_BROWSER_TYPES = ','.join(['android-content-shell'] + |
26 CHROME_PACKAGE_NAMES.keys()) | 27 CHROME_PACKAGE_NAMES.keys()) |
(...skipping 19 matching lines...) Expand all Loading... |
46 def __init__(self, browser_type, options, *args): | 47 def __init__(self, browser_type, options, *args): |
47 super(PossibleAndroidBrowser, self).__init__(browser_type, options) | 48 super(PossibleAndroidBrowser, self).__init__(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[4]) | 59 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 SupportsOptions(self, options): | 64 def SupportsOptions(self, options): |
64 if len(options.extensions_to_load) != 0: | 65 if len(options.extensions_to_load) != 0: |
65 return False | 66 return False |
66 return True | 67 return True |
67 | 68 |
68 def FindAllAvailableBrowsers(options, logging=real_logging): | 69 def FindAllAvailableBrowsers(options, logging=real_logging): |
69 """Finds all the desktop browsers available on this machine.""" | 70 """Finds all the desktop browsers available on this machine.""" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 # but make it accessible to the device. | 142 # but make it accessible to the device. |
142 if len(possible_browsers) and not adb_commands.HasForwarder(): | 143 if len(possible_browsers) and not adb_commands.HasForwarder(): |
143 logging.warn('telemetry detected an android device. However,') | 144 logging.warn('telemetry detected an android device. However,') |
144 logging.warn('Chrome\'s port-forwarder app is not available.') | 145 logging.warn('Chrome\'s port-forwarder app is not available.') |
145 logging.warn('To build:') | 146 logging.warn('To build:') |
146 logging.warn(' make -j16 host_forwarder device_forwarder') | 147 logging.warn(' make -j16 host_forwarder device_forwarder') |
147 logging.warn('') | 148 logging.warn('') |
148 logging.warn('') | 149 logging.warn('') |
149 return [] | 150 return [] |
150 return possible_browsers | 151 return possible_browsers |
OLD | NEW |