| 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 CrOS browsers that can be controlled by telemetry.""" | 4 """Finds CrOS browsers that can be controlled by telemetry.""" |
| 5 | 5 |
| 6 import logging | 6 import logging |
| 7 | 7 |
| 8 from telemetry.core import browser | 8 from telemetry.core import browser |
| 9 from telemetry.core import possible_browser | 9 from telemetry.core import possible_browser |
| 10 from telemetry.core import profile_types | 10 from telemetry.core import profile_types |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 b = browser.Browser(backend, | 37 b = browser.Browser(backend, |
| 38 cros_platform_backend.CrosPlatformBackend(self._cri)) | 38 cros_platform_backend.CrosPlatformBackend(self._cri)) |
| 39 backend.SetBrowser(b) | 39 backend.SetBrowser(b) |
| 40 return b | 40 return b |
| 41 | 41 |
| 42 def SupportsOptions(self, options): | 42 def SupportsOptions(self, options): |
| 43 if (len(options.extensions_to_load) != 0) and self._is_guest: | 43 if (len(options.extensions_to_load) != 0) and self._is_guest: |
| 44 return False | 44 return False |
| 45 return True | 45 return True |
| 46 | 46 |
| 47 def SelectDefaultBrowser(possible_browsers): |
| 48 if cros_interface.IsRunningOnCrosDevice(): |
| 49 for b in possible_browsers: |
| 50 if b.browser_type == 'system': |
| 51 return b |
| 52 return None |
| 53 |
| 47 def FindAllAvailableBrowsers(options): | 54 def FindAllAvailableBrowsers(options): |
| 48 """Finds all available chromeos browsers, locally and remotely.""" | 55 """Finds all available chromeos browsers, locally and remotely.""" |
| 49 if cros_interface.IsRunningOnCrosDevice(): | 56 if cros_interface.IsRunningOnCrosDevice(): |
| 50 return [PossibleCrOSBrowser('system', options, | 57 return [PossibleCrOSBrowser('system', options, |
| 51 cros_interface.CrOSInterface(), | 58 cros_interface.CrOSInterface(), |
| 52 is_guest=False), | 59 is_guest=False), |
| 53 PossibleCrOSBrowser('system-guest', options, | 60 PossibleCrOSBrowser('system-guest', options, |
| 54 cros_interface.CrOSInterface(), | 61 cros_interface.CrOSInterface(), |
| 55 is_guest=True)] | 62 is_guest=True)] |
| 56 | 63 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 logging.warn('P.S. Please, tell your manager how INANE this is.') | 97 logging.warn('P.S. Please, tell your manager how INANE this is.') |
| 91 | 98 |
| 92 from telemetry.core import browser_finder | 99 from telemetry.core import browser_finder |
| 93 raise browser_finder.BrowserFinderException(str(ex)) | 100 raise browser_finder.BrowserFinderException(str(ex)) |
| 94 | 101 |
| 95 if not cri.FileExistsOnDevice('/opt/google/chrome/chrome'): | 102 if not cri.FileExistsOnDevice('/opt/google/chrome/chrome'): |
| 96 logging.warn('Could not find a chrome on ' % cri.hostname) | 103 logging.warn('Could not find a chrome on ' % cri.hostname) |
| 97 | 104 |
| 98 return [PossibleCrOSBrowser('cros-chrome', options, cri, is_guest=False), | 105 return [PossibleCrOSBrowser('cros-chrome', options, cri, is_guest=False), |
| 99 PossibleCrOSBrowser('cros-chrome-guest', options, cri, is_guest=True)] | 106 PossibleCrOSBrowser('cros-chrome-guest', options, cri, is_guest=True)] |
| OLD | NEW |