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 |
14 from telemetry import browser | 14 from telemetry import browser |
15 from telemetry import possible_browser | 15 from telemetry import possible_browser |
16 | 16 |
17 ALL_BROWSER_TYPES = ','.join([ | 17 CHROME_PACKAGE_NAMES = { |
18 'android-content-shell', | 18 'android-chrome': 'com.google.android.apps.chrome', |
19 'android-chrome', | 19 'android-chrome-beta': 'com.chrome.beta', |
20 'android-jb-system-chrome', | 20 'android-chrome-dev': 'com.google.android.apps.chrome_dev', |
21 ]) | 21 'android-jb-system-chrome': 'com.android.chrome' |
22 } | |
22 | 23 |
23 CHROME_PACKAGE = 'com.google.android.apps.chrome' | 24 ALL_BROWSER_TYPES = ','.join(['android-content-shell'] + |
24 CHROME_ACTIVITY = '.Main' | 25 CHROME_PACKAGE_NAMES.keys()) |
26 | |
27 CHROME_ACTIVITY = 'com.google.android.apps.chrome.Main' | |
nduca
2013/01/04 19:47:08
just out of curiosity, do we have code somewhere t
| |
25 CHROME_COMMAND_LINE = '/data/local/chrome-command-line' | 28 CHROME_COMMAND_LINE = '/data/local/chrome-command-line' |
26 CHROME_DEVTOOLS_REMOTE_PORT = 'localabstract:chrome_devtools_remote' | 29 CHROME_DEVTOOLS_REMOTE_PORT = 'localabstract:chrome_devtools_remote' |
27 | 30 |
28 CHROME_JB_SYSTEM_PACKAGE = 'com.android.chrome' | |
29 CHROME_JB_SYSTEM_DEVTOOLS_REMOTE_PORT = 'localabstract:chrome_devtools_remote' | |
30 | |
31 CONTENT_SHELL_PACKAGE = 'org.chromium.content_shell' | 31 CONTENT_SHELL_PACKAGE = 'org.chromium.content_shell' |
32 CONTENT_SHELL_ACTIVITY = '.ContentShellActivity' | 32 CONTENT_SHELL_ACTIVITY = '.ContentShellActivity' |
33 CONTENT_SHELL_COMMAND_LINE = '/data/local/tmp/content-shell-command-line' | 33 CONTENT_SHELL_COMMAND_LINE = '/data/local/tmp/content-shell-command-line' |
34 CONTENT_SHELL_DEVTOOLS_REMOTE_PORT = ( | 34 CONTENT_SHELL_DEVTOOLS_REMOTE_PORT = ( |
35 'localabstract:content_shell_devtools_remote') | 35 'localabstract:content_shell_devtools_remote') |
36 | 36 |
37 # adb shell pm list packages | 37 # adb shell pm list packages |
38 # adb | 38 # adb |
39 # intents to run (pass -D url for the rest) | 39 # intents to run (pass -D url for the rest) |
40 # com.android.chrome/.Main | 40 # com.android.chrome/.Main |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 possible_browsers = [] | 113 possible_browsers = [] |
114 if 'package:' + CONTENT_SHELL_PACKAGE in packages: | 114 if 'package:' + CONTENT_SHELL_PACKAGE in packages: |
115 b = PossibleAndroidBrowser('android-content-shell', | 115 b = PossibleAndroidBrowser('android-content-shell', |
116 options, adb, | 116 options, adb, |
117 CONTENT_SHELL_PACKAGE, True, | 117 CONTENT_SHELL_PACKAGE, True, |
118 CONTENT_SHELL_COMMAND_LINE, | 118 CONTENT_SHELL_COMMAND_LINE, |
119 CONTENT_SHELL_ACTIVITY, | 119 CONTENT_SHELL_ACTIVITY, |
120 CONTENT_SHELL_DEVTOOLS_REMOTE_PORT) | 120 CONTENT_SHELL_DEVTOOLS_REMOTE_PORT) |
121 possible_browsers.append(b) | 121 possible_browsers.append(b) |
122 | 122 |
123 if 'package:' + CHROME_PACKAGE in packages: | 123 for name, package in CHROME_PACKAGE_NAMES.iteritems(): |
124 b = PossibleAndroidBrowser('android-chrome', | 124 if 'package:' + package in packages: |
125 options, adb, | 125 b = PossibleAndroidBrowser(name, |
126 CHROME_PACKAGE, False, | 126 options, adb, |
127 CHROME_COMMAND_LINE, | 127 package, False, |
128 CHROME_ACTIVITY, | 128 CHROME_COMMAND_LINE, |
129 CHROME_DEVTOOLS_REMOTE_PORT) | 129 CHROME_ACTIVITY, |
130 possible_browsers.append(b) | 130 CHROME_DEVTOOLS_REMOTE_PORT) |
131 | 131 possible_browsers.append(b) |
132 if 'package:' + CHROME_JB_SYSTEM_PACKAGE in packages: | |
133 b = PossibleAndroidBrowser('android-jb-system-chrome', | |
134 options, adb, | |
135 CHROME_JB_SYSTEM_PACKAGE, False, | |
136 CHROME_COMMAND_LINE, | |
137 CHROME_ACTIVITY, | |
138 CHROME_JB_SYSTEM_DEVTOOLS_REMOTE_PORT) | |
139 possible_browsers.append(b) | |
140 | 132 |
141 # See if the "forwarder" is installed -- we need this to host content locally | 133 # See if the "forwarder" is installed -- we need this to host content locally |
142 # but make it accessible to the device. | 134 # but make it accessible to the device. |
143 if len(possible_browsers) and not adb_commands.HasForwarder(): | 135 if len(possible_browsers) and not adb_commands.HasForwarder(): |
144 logging.warn('telemetry detected an android device. However,') | 136 logging.warn('telemetry detected an android device. However,') |
145 logging.warn('Chrome\'s port-forwarder app is not available.') | 137 logging.warn('Chrome\'s port-forwarder app is not available.') |
146 logging.warn('To build:') | 138 logging.warn('To build:') |
147 logging.warn(' make -j16 host_forwarder device_forwarder') | 139 logging.warn(' make -j16 host_forwarder device_forwarder') |
148 logging.warn('') | 140 logging.warn('') |
149 logging.warn('') | 141 logging.warn('') |
150 return [] | 142 return [] |
151 return possible_browsers | 143 return possible_browsers |
OLD | NEW |