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 20 matching lines...) Expand all Loading... |
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 return browser.Browser(backend, platform.Platform()) | 39 return browser.Browser(backend, platform.Platform()) |
40 | 40 |
| 41 |
41 def FindAllAvailableBrowsers(options): | 42 def FindAllAvailableBrowsers(options): |
42 """Finds all the desktop browsers available on this machine.""" | 43 """Finds all the desktop browsers available on this machine.""" |
43 browsers = [] | 44 browsers = [] |
44 | 45 |
45 has_display = True | 46 has_display = True |
46 if (sys.platform.startswith('linux') and | 47 if (sys.platform.startswith('linux') and |
47 os.getenv('DISPLAY') == None): | 48 os.getenv('DISPLAY') == None): |
48 has_display = False | 49 has_display = False |
49 | 50 |
50 # Add the explicit browser executable if given. | 51 # Add the explicit browser executable if given. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 chromium_app_name, False): | 143 chromium_app_name, False): |
143 break | 144 break |
144 | 145 |
145 if len(browsers) and not has_display: | 146 if len(browsers) and not has_display: |
146 logging.warning( | 147 logging.warning( |
147 'Found (%s), but you do not have a DISPLAY environment set.' % | 148 'Found (%s), but you do not have a DISPLAY environment set.' % |
148 ','.join([b.browser_type for b in browsers])) | 149 ','.join([b.browser_type for b in browsers])) |
149 return [] | 150 return [] |
150 | 151 |
151 return browsers | 152 return browsers |
OLD | NEW |