Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: tools/telemetry/telemetry/core/chrome/android_browser_finder.py

Issue 12278015: [Telemetry] Reorganize everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add shebangs. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 import adb_commands 12 from telemetry.core import browser
13 from telemetry import android_browser_backend 13 from telemetry.core import possible_browser
14 from telemetry import android_platform 14 from telemetry.core.chrome import adb_commands
15 from telemetry import browser 15 from telemetry.core.chrome import android_browser_backend
16 from telemetry import possible_browser 16 from telemetry.core.chrome import android_platform
17 17
18 CHROME_PACKAGE_NAMES = { 18 CHROME_PACKAGE_NAMES = {
19 'android-chrome': 'com.google.android.apps.chrome', 19 'android-chrome': 'com.google.android.apps.chrome',
20 'android-chrome-beta': 'com.chrome.beta', 20 'android-chrome-beta': 'com.chrome.beta',
21 'android-chrome-dev': 'com.google.android.apps.chrome_dev', 21 'android-chrome-dev': 'com.google.android.apps.chrome_dev',
22 'android-jb-system-chrome': 'com.android.chrome' 22 'android-jb-system-chrome': 'com.android.chrome'
23 } 23 }
24 24
25 ALL_BROWSER_TYPES = ','.join(['android-content-shell'] + 25 ALL_BROWSER_TYPES = ','.join(['android-content-shell'] +
26 CHROME_PACKAGE_NAMES.keys()) 26 CHROME_PACKAGE_NAMES.keys())
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 stdin=devnull) 79 stdin=devnull)
80 stdout, _ = proc.communicate() 80 stdout, _ = proc.communicate()
81 if re.search(re.escape('????????????\tno permissions'), stdout) != None: 81 if re.search(re.escape('????????????\tno permissions'), stdout) != None:
82 logging.warn( 82 logging.warn(
83 ('adb devices reported a permissions error. Consider ' 83 ('adb devices reported a permissions error. Consider '
84 'restarting adb as root:')) 84 'restarting adb as root:'))
85 logging.warn(' adb kill-server') 85 logging.warn(' adb kill-server')
86 logging.warn(' sudo `which adb` devices\n\n') 86 logging.warn(' sudo `which adb` devices\n\n')
87 except OSError: 87 except OSError:
88 platform_tools_path = os.path.join( 88 platform_tools_path = os.path.join(
89 os.path.dirname(__file__), '..', '..', '..', 89 os.path.dirname(__file__), '..', '..', '..', '..', '..'
90 'third_party', 'android_tools', 'sdk', 'platform-tools') 90 'third_party', 'android_tools', 'sdk', 'platform-tools')
91 if (sys.platform.startswith('linux') and 91 if (sys.platform.startswith('linux') and
92 os.path.exists(os.path.join(platform_tools_path, 'adb'))): 92 os.path.exists(os.path.join(platform_tools_path, 'adb'))):
93 os.environ['PATH'] = os.pathsep.join([platform_tools_path, 93 os.environ['PATH'] = os.pathsep.join([platform_tools_path,
94 os.environ['PATH']]) 94 os.environ['PATH']])
95 else: 95 else:
96 logging.info('No adb command found. ' + 96 logging.info('No adb command found. ' +
97 'Will not try searching for Android browsers.') 97 'Will not try searching for Android browsers.')
98 return [] 98 return []
99 99
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 # but make it accessible to the device. 141 # but make it accessible to the device.
142 if len(possible_browsers) and not adb_commands.HasForwarder(): 142 if len(possible_browsers) and not adb_commands.HasForwarder():
143 logging.warn('telemetry detected an android device. However,') 143 logging.warn('telemetry detected an android device. However,')
144 logging.warn('Chrome\'s port-forwarder app is not available.') 144 logging.warn('Chrome\'s port-forwarder app is not available.')
145 logging.warn('To build:') 145 logging.warn('To build:')
146 logging.warn(' make -j16 host_forwarder device_forwarder') 146 logging.warn(' make -j16 host_forwarder device_forwarder')
147 logging.warn('') 147 logging.warn('')
148 logging.warn('') 148 logging.warn('')
149 return [] 149 return []
150 return possible_browsers 150 return possible_browsers
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698