OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 import fnmatch | 5 import fnmatch |
6 import urlparse | 6 import urlparse |
7 | 7 |
8 # Valid expectation conditions are: | 8 # Valid expectation conditions are: |
9 # | 9 # |
10 # Operating systems: | 10 # Operating systems: |
11 # win, xp, vista, win7, win8, win10, mac, leopard, snowleopard, | 11 # win, xp, vista, win7, win8, win10, mac, leopard, snowleopard, |
12 # lion, mountainlion, mavericks, yosemite, linux, chromeos, | 12 # lion, mountainlion, mavericks, yosemite, sierra, linux, chromeos, |
13 # android | 13 # android |
14 # | 14 # |
15 # Browser types: | 15 # Browser types: |
16 # android-webview-shell, android-content-shell, debug, release | 16 # android-webview-shell, android-content-shell, debug, release |
17 # | 17 # |
18 # Sample usage in SetExpectations in subclasses: | 18 # Sample usage in SetExpectations in subclasses: |
19 # self.Fail('gl-enable-vertex-attrib.html', | 19 # self.Fail('gl-enable-vertex-attrib.html', |
20 # ['mac', 'release'], bug=123) | 20 # ['mac', 'release'], bug=123) |
21 | 21 |
22 WIN_CONDITIONS = ['xp', 'vista', 'win7', 'win8', 'win10'] | 22 WIN_CONDITIONS = ['xp', 'vista', 'win7', 'win8', 'win10'] |
23 MAC_CONDITIONS = ['leopard', 'snowleopard', 'lion', 'mountainlion', | 23 MAC_CONDITIONS = ['leopard', 'snowleopard', 'lion', 'mountainlion', |
24 'mavericks', 'yosemite'] | 24 'mavericks', 'yosemite', 'sierra'] |
25 | 25 |
26 OS_CONDITIONS = ['win', 'mac', 'linux', 'chromeos', 'android'] + \ | 26 OS_CONDITIONS = ['win', 'mac', 'linux', 'chromeos', 'android'] + \ |
27 WIN_CONDITIONS + MAC_CONDITIONS | 27 WIN_CONDITIONS + MAC_CONDITIONS |
28 | 28 |
29 BROWSER_TYPE_CONDITIONS = [ | 29 BROWSER_TYPE_CONDITIONS = [ |
30 'android-webview-shell', 'android-content-shell', 'android-chromium', | 30 'android-webview-shell', 'android-content-shell', 'android-chromium', |
31 'debug', 'release'] | 31 'debug', 'release'] |
32 | 32 |
33 class Expectation(object): | 33 class Expectation(object): |
34 """Represents a single expectation for a test. | 34 """Represents a single expectation for a test. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 Can be overridden to handle new types of conditions. Call the | 67 Can be overridden to handle new types of conditions. Call the |
68 superclass's implementation of ParseCondition at the end of your | 68 superclass's implementation of ParseCondition at the end of your |
69 subclass if you don't handle the condition. The base | 69 subclass if you don't handle the condition. The base |
70 implementation will raise an exception if the condition is | 70 implementation will raise an exception if the condition is |
71 unsupported. | 71 unsupported. |
72 | 72 |
73 Valid expectation conditions are: | 73 Valid expectation conditions are: |
74 | 74 |
75 Operating systems: | 75 Operating systems: |
76 win, xp, vista, win7, mac, leopard, snowleopard, lion, | 76 win, xp, vista, win7, mac, leopard, snowleopard, lion, |
77 mountainlion, mavericks, yosemite, linux, chromeos, android | 77 mountainlion, mavericks, yosemite, sierra, linux, chromeos, |
| 78 android |
78 | 79 |
79 Browser types: | 80 Browser types: |
80 android-webview-shell, android-content-shell, android-chromium, | 81 android-webview-shell, android-content-shell, android-chromium, |
81 debug, release | 82 debug, release |
82 | 83 |
83 Sample usage in SetExpectations in subclasses: | 84 Sample usage in SetExpectations in subclasses: |
84 self.Fail('gl-enable-vertex-attrib.html', | 85 self.Fail('gl-enable-vertex-attrib.html', |
85 ['mac', 'release'], bug=123) | 86 ['mac', 'release'], bug=123) |
| 87 |
86 """ | 88 """ |
87 cl = condition.lower() | 89 cl = condition.lower() |
88 if cl in OS_CONDITIONS: | 90 if cl in OS_CONDITIONS: |
89 self.os_conditions.append(cl) | 91 self.os_conditions.append(cl) |
90 elif cl in BROWSER_TYPE_CONDITIONS: | 92 elif cl in BROWSER_TYPE_CONDITIONS: |
91 self.browser_conditions.append(condition) | 93 self.browser_conditions.append(condition) |
92 else: | 94 else: |
93 raise ValueError('Unknown expectation condition: "%s"' % cl) | 95 raise ValueError('Unknown expectation condition: "%s"' % cl) |
94 | 96 |
95 | 97 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 platform = browser.platform | 276 platform = browser.platform |
275 os_matches = (not expectation.os_conditions or | 277 os_matches = (not expectation.os_conditions or |
276 platform.GetOSName() in expectation.os_conditions or | 278 platform.GetOSName() in expectation.os_conditions or |
277 platform.GetOSVersionName() in expectation.os_conditions) | 279 platform.GetOSVersionName() in expectation.os_conditions) |
278 | 280 |
279 browser_matches = ( | 281 browser_matches = ( |
280 (not expectation.browser_conditions) or | 282 (not expectation.browser_conditions) or |
281 browser.browser_type in expectation.browser_conditions) | 283 browser.browser_type in expectation.browser_conditions) |
282 | 284 |
283 return os_matches and browser_matches | 285 return os_matches and browser_matches |
OLD | NEW |