| 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 |
| 11 from telemetry import browser | 11 from telemetry import browser |
| 12 from telemetry import desktop_browser_backend | 12 from telemetry import desktop_browser_backend |
| 13 from telemetry import platform | 13 from telemetry import platform |
| 14 from telemetry import possible_browser | 14 from telemetry import possible_browser |
| 15 | 15 |
| 16 ALL_BROWSER_TYPES = ','.join([ | 16 ALL_BROWSER_TYPES = ','.join([ |
| 17 'exact', | 17 'exact', |
| 18 'release', | 18 'release', |
| 19 'debug', | 19 'debug', |
| 20 'canary', | 20 'canary', |
| 21 'content-shell-debug', | 21 'content-shell-debug', |
| 22 'content-shell-release', | 22 'content-shell-release', |
| 23 'system']) | 23 'system']) |
| 24 | 24 |
| 25 class PossibleDesktopBrowser(possible_browser.PossibleBrowser): | 25 class PossibleDesktopBrowser(possible_browser.PossibleBrowser): |
| 26 """A desktop browser that can be controlled.""" | 26 """A desktop browser that can be controlled.""" |
| 27 | 27 |
| 28 def __init__(self, browser_type, options, executable, is_content_shell): | 28 def __init__(self, browser_type, options, executable, is_content_shell): |
| 29 super(PossibleDesktopBrowser, self).__init__(browser_type, options) | 29 super(PossibleDesktopBrowser, self).__init__( |
| 30 browser_type, options, not is_content_shell) |
| 30 self._local_executable = executable | 31 self._local_executable = executable |
| 31 self._is_content_shell = is_content_shell | 32 self._is_content_shell = is_content_shell |
| 32 | 33 |
| 33 def __repr__(self): | 34 def __repr__(self): |
| 34 return 'PossibleDesktopBrowser(browser_type=%s)' % self.browser_type | 35 return 'PossibleDesktopBrowser(browser_type=%s)' % self.browser_type |
| 35 | 36 |
| 36 def Create(self): | 37 def Create(self): |
| 37 backend = desktop_browser_backend.DesktopBrowserBackend( | 38 backend = desktop_browser_backend.DesktopBrowserBackend( |
| 38 self._options, self._local_executable, self._is_content_shell) | 39 self._options, self._local_executable, self._is_content_shell) |
| 39 b = browser.Browser(backend, platform.Platform()) | 40 b = browser.Browser(backend, platform.Platform()) |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 chromium_app_name, False): | 145 chromium_app_name, False): |
| 145 break | 146 break |
| 146 | 147 |
| 147 if len(browsers) and not has_display: | 148 if len(browsers) and not has_display: |
| 148 logging.warning( | 149 logging.warning( |
| 149 'Found (%s), but you do not have a DISPLAY environment set.' % | 150 'Found (%s), but you do not have a DISPLAY environment set.' % |
| 150 ','.join([b.browser_type for b in browsers])) | 151 ','.join([b.browser_type for b in browsers])) |
| 151 return [] | 152 return [] |
| 152 | 153 |
| 153 return browsers | 154 return browsers |
| OLD | NEW |