OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 desktop browsers that can be controlled by telemetry.""" | 4 """Finds desktop browsers that can be controlled by telemetry.""" |
5 | 5 |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 | 10 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return False | 100 return False |
101 | 101 |
102 def FindAllBrowserTypes(_): | 102 def FindAllBrowserTypes(_): |
103 return [ | 103 return [ |
104 'exact', | 104 'exact', |
105 'reference', | 105 'reference', |
106 'release', | 106 'release', |
107 'release_x64', | 107 'release_x64', |
108 'debug', | 108 'debug', |
109 'debug_x64', | 109 'debug_x64', |
| 110 'stable', |
| 111 'beta', |
| 112 'dev', |
110 'canary', | 113 'canary', |
111 'content-shell-debug', | 114 'content-shell-debug', |
112 'content-shell-debug_x64', | 115 'content-shell-debug_x64', |
113 'content-shell-release', | 116 'content-shell-release', |
114 'content-shell-release_x64', | 117 'content-shell-release_x64', |
115 'system'] | 118 'system'] |
116 | 119 |
117 def FindAllAvailableBrowsers(finder_options, device): | 120 def FindAllAvailableBrowsers(finder_options, device): |
118 """Finds all the desktop browsers available on this machine.""" | 121 """Finds all the desktop browsers available on this machine.""" |
119 if not isinstance(device, desktop_device.DesktopDevice): | 122 if not isinstance(device, desktop_device.DesktopDevice): |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 browsers.append(PossibleDesktopBrowser('system', finder_options, | 219 browsers.append(PossibleDesktopBrowser('system', finder_options, |
217 mac_system, None, False, | 220 mac_system, None, False, |
218 mac_system_root)) | 221 mac_system_root)) |
219 if path.IsExecutable(mac_reference): | 222 if path.IsExecutable(mac_reference): |
220 browsers.append(PossibleDesktopBrowser('reference', finder_options, | 223 browsers.append(PossibleDesktopBrowser('reference', finder_options, |
221 mac_reference, None, False, | 224 mac_reference, None, False, |
222 mac_reference_root)) | 225 mac_reference_root)) |
223 | 226 |
224 # Linux specific options. | 227 # Linux specific options. |
225 if sys.platform.startswith('linux'): | 228 if sys.platform.startswith('linux'): |
226 # Look for a google-chrome instance. | 229 versions = { |
227 found = False | 230 'system': ('google-chrome', |
228 try: | 231 os.path.split(os.path.realpath('google-chrome'))[0]), |
229 with open(os.devnull, 'w') as devnull: | 232 'stable': ('google-chrome-stable', '/opt/google/chrome'), |
230 found = subprocess.call(['google-chrome', '--version'], | 233 'beta': ('google-chrome-beta', '/opt/google/chrome-beta'), |
231 stdout=devnull, stderr=devnull) == 0 | 234 'dev': ('google-chrome-unstable', '/opt/google/chrome-unstable') |
232 except OSError: | 235 } |
233 pass | 236 |
234 if found: | 237 for version, (name, root) in versions.iteritems(): |
235 browsers.append(PossibleDesktopBrowser('system', finder_options, | 238 found = False |
236 'google-chrome', None, False, | 239 try: |
237 '/opt/google/chrome')) | 240 with open(os.devnull, 'w') as devnull: |
| 241 found = subprocess.call([name, '--version'], |
| 242 stdout=devnull, stderr=devnull) == 0 |
| 243 except OSError: |
| 244 pass |
| 245 if found: |
| 246 browsers.append(PossibleDesktopBrowser(version, finder_options, name, |
| 247 None, False, root)) |
238 linux_reference_root = os.path.join(reference_build_root, 'chrome_linux') | 248 linux_reference_root = os.path.join(reference_build_root, 'chrome_linux') |
239 linux_reference = os.path.join(linux_reference_root, 'chrome') | 249 linux_reference = os.path.join(linux_reference_root, 'chrome') |
240 if path.IsExecutable(linux_reference): | 250 if path.IsExecutable(linux_reference): |
241 browsers.append(PossibleDesktopBrowser('reference', finder_options, | 251 browsers.append(PossibleDesktopBrowser('reference', finder_options, |
242 linux_reference, None, False, | 252 linux_reference, None, False, |
243 linux_reference_root)) | 253 linux_reference_root)) |
244 | 254 |
245 # Win32-specific options. | 255 # Win32-specific options. |
246 if sys.platform.startswith('win'): | 256 if sys.platform.startswith('win'): |
247 app_paths = ( | 257 app_paths = ( |
(...skipping 16 matching lines...) Expand all Loading... |
264 if "--ozone-platform" in arg: | 274 if "--ozone-platform" in arg: |
265 has_ozone_platform = True | 275 has_ozone_platform = True |
266 | 276 |
267 if len(browsers) and not has_x11_display and not has_ozone_platform: | 277 if len(browsers) and not has_x11_display and not has_ozone_platform: |
268 logging.warning( | 278 logging.warning( |
269 'Found (%s), but you do not have a DISPLAY environment set.' % | 279 'Found (%s), but you do not have a DISPLAY environment set.' % |
270 ','.join([b.browser_type for b in browsers])) | 280 ','.join([b.browser_type for b in browsers])) |
271 return [] | 281 return [] |
272 | 282 |
273 return browsers | 283 return browsers |
OLD | NEW |