OLD | NEW |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 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 logging | 5 import logging |
6 | 6 |
7 | 7 |
8 class StoryExpectations(object): | 8 class StoryExpectations(object): |
9 """An object that contains disabling expectations for benchmarks and stories. | 9 """An object that contains disabling expectations for benchmarks and stories. |
10 | 10 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 """ | 128 """ |
129 for conditions, reason in self._expectations.get(story.name, []): | 129 for conditions, reason in self._expectations.get(story.name, []): |
130 for condition in conditions: | 130 for condition in conditions: |
131 if condition.ShouldDisable(platform, finder_options): | 131 if condition.ShouldDisable(platform, finder_options): |
132 logging.info('%s is disabled on %s due to %s.', | 132 logging.info('%s is disabled on %s due to %s.', |
133 story.name, condition, reason) | 133 story.name, condition, reason) |
134 return reason | 134 return reason |
135 return None | 135 return None |
136 | 136 |
137 | 137 |
| 138 # TODO(rnephew): Since TestConditions are being used for more than |
| 139 # just story expectations now, this should be decoupled and refactored |
| 140 # to be clearer. |
138 class _TestCondition(object): | 141 class _TestCondition(object): |
139 def ShouldDisable(self, platform, finder_options): | 142 def ShouldDisable(self, platform, finder_options): |
140 raise NotImplementedError | 143 raise NotImplementedError |
141 | 144 |
142 def __str__(self): | 145 def __str__(self): |
143 raise NotImplementedError | 146 raise NotImplementedError |
144 | 147 |
145 | 148 |
146 class _TestConditionByPlatformList(_TestCondition): | 149 class _TestConditionByPlatformList(_TestCondition): |
147 def __init__(self, platforms, name): | 150 def __init__(self, platforms, name): |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 'W6210', 'Cherry Mobile Android One') | 236 'W6210', 'Cherry Mobile Android One') |
234 ANDROID_SVELTE = _TestConditionAndroidSvelte() | 237 ANDROID_SVELTE = _TestConditionAndroidSvelte() |
235 ANDROID_WEBVIEW = _TestConditionAndroidWebview() | 238 ANDROID_WEBVIEW = _TestConditionAndroidWebview() |
236 ANDROID_NOT_WEBVIEW = _TestConditionAndroidNotWebview() | 239 ANDROID_NOT_WEBVIEW = _TestConditionAndroidNotWebview() |
237 # MAC_10_11 Includes: | 240 # MAC_10_11 Includes: |
238 # Mac 10.11 Perf, Mac Retina Perf, Mac Pro 10.11 Perf, Mac Air 10.11 Perf | 241 # Mac 10.11 Perf, Mac Retina Perf, Mac Pro 10.11 Perf, Mac Air 10.11 Perf |
239 MAC_10_11 = _TestConditionByMacVersion('10.11', 'Mac 10.11') | 242 MAC_10_11 = _TestConditionByMacVersion('10.11', 'Mac 10.11') |
240 # Mac 10_12 Includes: | 243 # Mac 10_12 Includes: |
241 # Mac 10.12 Perf, Mac Mini 8GB 10.12 Perf | 244 # Mac 10.12 Perf, Mac Mini 8GB 10.12 Perf |
242 MAC_10_12 = _TestConditionByMacVersion('10.12', 'Mac 10.12') | 245 MAC_10_12 = _TestConditionByMacVersion('10.12', 'Mac 10.12') |
OLD | NEW |