Chromium Code Reviews| 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', None), |
| 228 try: | 231 'stable': ('google-chrome-stable', '/opt/google/chrome'), |
| 229 with open(os.devnull, 'w') as devnull: | 232 'beta': ('google-chrome-beta', '/opt/google/chrome-beta'), |
| 230 found = subprocess.call(['google-chrome', '--version'], | 233 'dev': ('google-chrome-unstable', '/opt/google/chrome-unstable') |
| 231 stdout=devnull, stderr=devnull) == 0 | 234 } |
| 232 except OSError: | 235 |
| 233 pass | 236 for version, (name, root) in versions.iteritems(): |
| 234 if found: | 237 found = False |
| 235 browsers.append(PossibleDesktopBrowser('system', finder_options, | 238 try: |
| 236 'google-chrome', None, False, | 239 with open(os.devnull, 'w') as devnull: |
| 237 '/opt/google/chrome')) | 240 found = subprocess.call([name, '--version'], |
| 241 stdout=devnull, stderr=devnull) == 0 | |
| 242 except OSError: | |
| 243 pass | |
| 244 if found: | |
| 245 if version == 'system': | |
| 246 root = os.path.split(os.path.realpath('google-chrome'))[0] | |
|
nednguyen
2015/07/30 20:06:45
Fix this
eakuefner
2015/07/30 20:27:12
Done.
| |
| 247 browsers.append(PossibleDesktopBrowser(version, finder_options, | |
| 248 name, None, False, | |
| 249 root)) | |
| 238 linux_reference_root = os.path.join(reference_build_root, 'chrome_linux') | 250 linux_reference_root = os.path.join(reference_build_root, 'chrome_linux') |
| 239 linux_reference = os.path.join(linux_reference_root, 'chrome') | 251 linux_reference = os.path.join(linux_reference_root, 'chrome') |
| 240 if path.IsExecutable(linux_reference): | 252 if path.IsExecutable(linux_reference): |
| 241 browsers.append(PossibleDesktopBrowser('reference', finder_options, | 253 browsers.append(PossibleDesktopBrowser('reference', finder_options, |
| 242 linux_reference, None, False, | 254 linux_reference, None, False, |
| 243 linux_reference_root)) | 255 linux_reference_root)) |
| 244 | 256 |
| 245 # Win32-specific options. | 257 # Win32-specific options. |
| 246 if sys.platform.startswith('win'): | 258 if sys.platform.startswith('win'): |
| 247 app_paths = ( | 259 app_paths = ( |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 264 if "--ozone-platform" in arg: | 276 if "--ozone-platform" in arg: |
| 265 has_ozone_platform = True | 277 has_ozone_platform = True |
| 266 | 278 |
| 267 if len(browsers) and not has_x11_display and not has_ozone_platform: | 279 if len(browsers) and not has_x11_display and not has_ozone_platform: |
| 268 logging.warning( | 280 logging.warning( |
| 269 'Found (%s), but you do not have a DISPLAY environment set.' % | 281 'Found (%s), but you do not have a DISPLAY environment set.' % |
| 270 ','.join([b.browser_type for b in browsers])) | 282 ','.join([b.browser_type for b in browsers])) |
| 271 return [] | 283 return [] |
| 272 | 284 |
| 273 return browsers | 285 return browsers |
| OLD | NEW |