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 |
11 Example Usage: | 11 Example Usage: |
12 class FooBenchmarkExpectations(expectations.StoryExpectations): | 12 class FooBenchmarkExpectations(expectations.StoryExpectations): |
13 def SetExpectations(self): | 13 def SetExpectations(self): |
14 self.DisableBenchmark( | 14 self.DisableBenchmark( |
15 [expectations.ALL_MOBILE], 'Desktop Benchmark') | 15 [expectations.ALL_MOBILE], 'Desktop Benchmark') |
16 self.DisableStory('story_name1', [expectations.ALL_MAC], 'crbug.com/456') | 16 self.DisableStory('story_name1', [expectations.ALL_MAC], 'crbug.com/456') |
17 self.DisableStory('story_name2', [expectations.ALL], 'crbug.com/789') | 17 self.DisableStory('story_name2', [expectations.ALL], 'crbug.com/789') |
18 ... | 18 ... |
19 """ | 19 """ |
20 def __init__(self): | 20 def __init__(self): |
21 self._disabled_platforms = [] | 21 self._disabled_platforms = [] |
22 self._expectations = {} | 22 self._expectations = {} |
23 self._frozen = False | 23 self._frozen = False |
24 self.SetExpectations() | 24 self.SetExpectations() |
25 self._Freeze() | 25 self._Freeze() |
26 | 26 |
27 @property | |
28 def disabled_stories(self): | |
nednguyen
2017/09/07 21:43:21
the name here "disabled_stories" but then this ret
rnephew (Reviews Here)
2017/09/11 17:31:55
Switched to calling it AsDict() as recomended by J
| |
29 return self._expectations | |
30 | |
27 def GetBrokenExpectations(self, story_set): | 31 def GetBrokenExpectations(self, story_set): |
28 story_set_story_names = [s.name for s in story_set.stories] | 32 story_set_story_names = [s.name for s in story_set.stories] |
29 invalid_story_names = [] | 33 invalid_story_names = [] |
30 for story_name in self._expectations: | 34 for story_name in self._expectations: |
31 if story_name not in story_set_story_names: | 35 if story_name not in story_set_story_names: |
32 invalid_story_names.append(story_name) | 36 invalid_story_names.append(story_name) |
33 logging.error('Story %s is not in the story set.' % story_name) | 37 logging.error('Story %s is not in the story set.' % story_name) |
34 return invalid_story_names | 38 return invalid_story_names |
35 | 39 |
36 def SetExpectations(self): | 40 def SetExpectations(self): |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 # Mac 10.11 Perf, Mac Retina Perf, Mac Pro 10.11 Perf, Mac Air 10.11 Perf | 260 # Mac 10.11 Perf, Mac Retina Perf, Mac Pro 10.11 Perf, Mac Air 10.11 Perf |
257 MAC_10_11 = _TestConditionByMacVersion('10.11', 'Mac 10.11') | 261 MAC_10_11 = _TestConditionByMacVersion('10.11', 'Mac 10.11') |
258 # Mac 10_12 Includes: | 262 # Mac 10_12 Includes: |
259 # Mac 10.12 Perf, Mac Mini 8GB 10.12 Perf | 263 # Mac 10.12 Perf, Mac Mini 8GB 10.12 Perf |
260 MAC_10_12 = _TestConditionByMacVersion('10.12', 'Mac 10.12') | 264 MAC_10_12 = _TestConditionByMacVersion('10.12', 'Mac 10.12') |
261 | 265 |
262 ANDROID_NEXUS6_WEBVIEW = _TestConditionLogicalAndConditions( | 266 ANDROID_NEXUS6_WEBVIEW = _TestConditionLogicalAndConditions( |
263 [ANDROID_NEXUS6, ANDROID_WEBVIEW], 'Nexus6 Webview') | 267 [ANDROID_NEXUS6, ANDROID_WEBVIEW], 'Nexus6 Webview') |
264 ANDROID_NEXUS5X_WEBVIEW = _TestConditionLogicalAndConditions( | 268 ANDROID_NEXUS5X_WEBVIEW = _TestConditionLogicalAndConditions( |
265 [ANDROID_NEXUS5X, ANDROID_WEBVIEW], 'Nexus5X Webview') | 269 [ANDROID_NEXUS5X, ANDROID_WEBVIEW], 'Nexus5X Webview') |
OLD | NEW |