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 browsers that can be controlled by telemetry.""" | 4 """Finds browsers that can be controlled by telemetry.""" |
5 | 5 |
6 import logging | 6 import logging |
7 | 7 |
8 from telemetry.core.chrome import android_browser_finder | 8 from telemetry.core.chrome import android_browser_finder |
9 from telemetry.core.chrome import cros_browser_finder | 9 from telemetry.core.chrome import cros_browser_finder |
10 from telemetry.core.chrome import desktop_browser_finder | 10 from telemetry.core.chrome import desktop_browser_finder |
11 from telemetry.core.webdriver import webdriver_desktop_browser_finder | |
11 | 12 |
12 BROWSER_FINDERS = [ | 13 BROWSER_FINDERS = [ |
13 desktop_browser_finder, | 14 desktop_browser_finder, |
14 android_browser_finder, | 15 android_browser_finder, |
15 cros_browser_finder | 16 cros_browser_finder, |
17 webdriver_desktop_browser_finder | |
16 ] | 18 ] |
17 | 19 |
18 ALL_BROWSER_TYPES = ','.join([bf.ALL_BROWSER_TYPES for bf in BROWSER_FINDERS]) | 20 ALL_BROWSER_TYPES = ','.join([bf.ALL_BROWSER_TYPES for bf in BROWSER_FINDERS]) |
19 | 21 |
20 | |
tonyg
2013/07/30 19:35:34
The style guide wants 2 blank lines between top le
chrisgao (Use stgao instead)
2013/07/31 19:05:41
Whopps, Done.
| |
21 class BrowserTypeRequiredException(Exception): | 22 class BrowserTypeRequiredException(Exception): |
22 pass | 23 pass |
23 | 24 |
24 class BrowserFinderException(Exception): | 25 class BrowserFinderException(Exception): |
25 pass | 26 pass |
26 | 27 |
27 def FindBrowser(options): | 28 def FindBrowser(options): |
28 """Finds the best PossibleBrowser object to run given the provided | 29 """Finds the best PossibleBrowser object to run given the provided |
29 BrowserOptions object. The returned possiblity object can then be used to | 30 BrowserOptions object. The returned possiblity object can then be used to |
30 connect to and control the located browser. A BrowserFinderException will | 31 connect to and control the located browser. A BrowserFinderException will |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 improperly set or if an error occurs when finding a browser. | 96 improperly set or if an error occurs when finding a browser. |
96 """ | 97 """ |
97 browsers = [] | 98 browsers = [] |
98 for finder in BROWSER_FINDERS: | 99 for finder in BROWSER_FINDERS: |
99 browsers.extend(finder.FindAllAvailableBrowsers(options)) | 100 browsers.extend(finder.FindAllAvailableBrowsers(options)) |
100 | 101 |
101 type_list = set([browser.browser_type for browser in browsers]) | 102 type_list = set([browser.browser_type for browser in browsers]) |
102 type_list = list(type_list) | 103 type_list = list(type_list) |
103 type_list.sort() | 104 type_list.sort() |
104 return type_list | 105 return type_list |
OLD | NEW |