| 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 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 18 matching lines...) Expand all Loading... |
| 29 super(PossibleDesktopBrowser, self).__init__(browser_type, options) | 29 super(PossibleDesktopBrowser, self).__init__(browser_type, options) |
| 30 self._local_executable = executable | 30 self._local_executable = executable |
| 31 self._is_content_shell = is_content_shell | 31 self._is_content_shell = is_content_shell |
| 32 | 32 |
| 33 def __repr__(self): | 33 def __repr__(self): |
| 34 return 'PossibleDesktopBrowser(browser_type=%s)' % self.browser_type | 34 return 'PossibleDesktopBrowser(browser_type=%s)' % self.browser_type |
| 35 | 35 |
| 36 def Create(self): | 36 def Create(self): |
| 37 backend = desktop_browser_backend.DesktopBrowserBackend( | 37 backend = desktop_browser_backend.DesktopBrowserBackend( |
| 38 self._options, self._local_executable, self._is_content_shell) | 38 self._options, self._local_executable, self._is_content_shell) |
| 39 b = browser.Browser(backend, platform.Platform()) | 39 b = browser.Browser(backend, platform.EmptyPlatform()) |
| 40 backend.SetBrowser(b) | 40 backend.SetBrowser(b) |
| 41 return b | 41 return b |
| 42 | 42 |
| 43 def FindAllAvailableBrowsers(options): | 43 def FindAllAvailableBrowsers(options): |
| 44 """Finds all the desktop browsers available on this machine.""" | 44 """Finds all the desktop browsers available on this machine.""" |
| 45 browsers = [] | 45 browsers = [] |
| 46 | 46 |
| 47 has_display = True | 47 has_display = True |
| 48 if (sys.platform.startswith('linux') and | 48 if (sys.platform.startswith('linux') and |
| 49 os.getenv('DISPLAY') == None): | 49 os.getenv('DISPLAY') == None): |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 chromium_app_name, False): | 144 chromium_app_name, False): |
| 145 break | 145 break |
| 146 | 146 |
| 147 if len(browsers) and not has_display: | 147 if len(browsers) and not has_display: |
| 148 logging.warning( | 148 logging.warning( |
| 149 'Found (%s), but you do not have a DISPLAY environment set.' % | 149 'Found (%s), but you do not have a DISPLAY environment set.' % |
| 150 ','.join([b.browser_type for b in browsers])) | 150 ','.join([b.browser_type for b in browsers])) |
| 151 return [] | 151 return [] |
| 152 | 152 |
| 153 return browsers | 153 return browsers |
| OLD | NEW |