| OLD | NEW |
| 1 # Copyright 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 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 | 4 |
| 5 """Finds browsers that can be controlled by telemetry.""" | 5 """Finds browsers that can be controlled by telemetry.""" |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 import operator | 8 import operator |
| 9 | 9 |
| 10 from telemetry import decorators | 10 from telemetry import decorators |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 y_idx = types.index(y.browser_type) | 100 y_idx = types.index(y.browser_type) |
| 101 return x_idx - y_idx | 101 return x_idx - y_idx |
| 102 browsers.sort(CompareBrowsersOnTypePriority) | 102 browsers.sort(CompareBrowsersOnTypePriority) |
| 103 if len(browsers) >= 1: | 103 if len(browsers) >= 1: |
| 104 browsers[0].UpdateExecutableIfNeeded() | 104 browsers[0].UpdateExecutableIfNeeded() |
| 105 return browsers[0] | 105 return browsers[0] |
| 106 else: | 106 else: |
| 107 return None | 107 return None |
| 108 | 108 |
| 109 matching_browsers = [b for b in browsers | 109 matching_browsers = [b for b in browsers |
| 110 if b.browser_type == options.browser_type and b.SupportsOptions(options)] | 110 if b.browser_type == options.browser_type and |
| 111 b.SupportsOptions(options.browser_options)] |
| 111 | 112 |
| 112 chosen_browser = None | 113 chosen_browser = None |
| 113 if len(matching_browsers) == 1: | 114 if len(matching_browsers) == 1: |
| 114 chosen_browser = matching_browsers[0] | 115 chosen_browser = matching_browsers[0] |
| 115 elif len(matching_browsers) > 1: | 116 elif len(matching_browsers) > 1: |
| 116 logging.warning('Multiple browsers of the same type found: %s' % ( | 117 logging.warning('Multiple browsers of the same type found: %s' % ( |
| 117 repr(matching_browsers))) | 118 repr(matching_browsers))) |
| 118 chosen_browser = sorted(matching_browsers, | 119 chosen_browser = sorted(matching_browsers, |
| 119 key=lambda b: b.last_modification_time())[-1] | 120 key=lambda b: b.last_modification_time())[-1] |
| 120 | 121 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 # The reference build should be available for mac, linux and win, but the | 170 # The reference build should be available for mac, linux and win, but the |
| 170 # desktop browser finder won't return it in the list of browsers. | 171 # desktop browser finder won't return it in the list of browsers. |
| 171 for browser in possible_browsers: | 172 for browser in possible_browsers: |
| 172 if (browser.target_os == 'darwin' or browser.target_os.startswith('linux') | 173 if (browser.target_os == 'darwin' or browser.target_os.startswith('linux') |
| 173 or browser.target_os.startswith('win')): | 174 or browser.target_os.startswith('win')): |
| 174 type_list.add('reference') | 175 type_list.add('reference') |
| 175 break | 176 break |
| 176 type_list = list(type_list) | 177 type_list = list(type_list) |
| 177 type_list.sort() | 178 type_list.sort() |
| 178 return type_list | 179 return type_list |
| OLD | NEW |