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 android browsers that can be controlled by telemetry.""" | 4 """Finds android browsers that can be controlled by telemetry.""" |
5 | 5 |
6 import logging | 6 import logging |
7 | 7 |
8 from telemetry import browser | 8 from telemetry import browser |
9 from telemetry import platform | 9 from telemetry import platform |
10 from telemetry import possible_browser | 10 from telemetry import possible_browser |
11 from telemetry import cros_browser_backend | 11 from telemetry import cros_browser_backend |
12 from telemetry import cros_interface | 12 from telemetry import cros_interface |
13 | 13 |
14 ALL_BROWSER_TYPES = ','.join([ | 14 ALL_BROWSER_TYPES = ','.join([ |
15 'cros-chrome', | 15 'cros-chrome', |
16 ]) | 16 ]) |
17 | 17 |
18 class PossibleCrOSBrowser(possible_browser.PossibleBrowser): | 18 class PossibleCrOSBrowser(possible_browser.PossibleBrowser): |
19 """A launchable android browser instance.""" | 19 """A launchable android browser instance.""" |
20 def __init__(self, browser_type, options, *args): | 20 def __init__(self, browser_type, options, *args): |
21 super(PossibleCrOSBrowser, self).__init__( | 21 super(PossibleCrOSBrowser, self).__init__( |
22 browser_type, options) | 22 browser_type, options, True) |
23 self._args = args | 23 self._args = args |
24 | 24 |
25 def __repr__(self): | 25 def __repr__(self): |
26 return 'PossibleCrOSBrowser(browser_type=%s)' % self.browser_type | 26 return 'PossibleCrOSBrowser(browser_type=%s)' % self.browser_type |
27 | 27 |
28 def Create(self): | 28 def Create(self): |
29 backend = cros_browser_backend.CrOSBrowserBackend( | 29 backend = cros_browser_backend.CrOSBrowserBackend( |
30 self.browser_type, self._options, *self._args) | 30 self.browser_type, self._options, *self._args) |
31 b = browser.Browser(backend, platform.Platform()) | 31 b = browser.Browser(backend, platform.Platform()) |
32 backend.SetBrowser(b) | 32 backend.SetBrowser(b) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 logging.warn('') | 69 logging.warn('') |
70 logging.warn('P.S. Please, tell your manager how INANE this is.') | 70 logging.warn('P.S. Please, tell your manager how INANE this is.') |
71 else: | 71 else: |
72 logging.warn(str(ex)) | 72 logging.warn(str(ex)) |
73 return [] | 73 return [] |
74 | 74 |
75 if not cri.FileExistsOnDevice('/opt/google/chrome/chrome'): | 75 if not cri.FileExistsOnDevice('/opt/google/chrome/chrome'): |
76 logging.warn('Could not find a chrome on ' % cri.hostname) | 76 logging.warn('Could not find a chrome on ' % cri.hostname) |
77 | 77 |
78 return [PossibleCrOSBrowser('cros-chrome', options, False, cri)] | 78 return [PossibleCrOSBrowser('cros-chrome', options, False, cri)] |
OLD | NEW |