Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(832)

Side by Side Diff: tools/perf/page_sets/system_health/system_health_stories.py

Issue 2918873002: Verify story names for system_health story sets (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 os 5 import os
6 6
7 from page_sets.system_health import chrome_stories 7 from page_sets.system_health import chrome_stories
8 from page_sets.system_health import platforms 8 from page_sets.system_health import platforms
9 from page_sets.system_health import system_health_story 9 from page_sets.system_health import system_health_story
10 10
11 from telemetry import story 11 from telemetry import story
12 from telemetry.core import discover 12 from telemetry.core import discover
13 13
14 14
15 class SystemHealthStorySet(story.StorySet): 15 class SystemHealthStorySet(story.StorySet):
16 """User stories for the System Health Plan. 16 """User stories for the System Health Plan.
17 17
18 See https://goo.gl/Jek2NL. 18 See https://goo.gl/Jek2NL.
19 """ 19 """
20 def __init__(self, platform, case=None, take_memory_measurement=False): 20 def __init__(self, platform, case=None, take_memory_measurement=False):
21 super(SystemHealthStorySet, self).__init__( 21 super(SystemHealthStorySet, self).__init__(
22 archive_data_file=('../data/system_health_%s.json' % platform), 22 archive_data_file=('../data/system_health_%s.json' % platform),
23 cloud_storage_bucket=story.PARTNER_BUCKET) 23 cloud_storage_bucket=story.PARTNER_BUCKET,
24 verify_names=True)
24 25
25 assert platform in platforms.ALL_PLATFORMS 26 assert platform in platforms.ALL_PLATFORMS
26 27
27 for story_class in _IterAllSystemHealthStoryClasses(): 28 for story_class in _IterAllSystemHealthStoryClasses():
28 if (story_class.ABSTRACT_STORY or 29 if (story_class.ABSTRACT_STORY or
29 platform not in story_class.SUPPORTED_PLATFORMS or 30 platform not in story_class.SUPPORTED_PLATFORMS or
30 case and not story_class.NAME.startswith(case + ':')): 31 case and not story_class.NAME.startswith(case + ':')):
31 continue 32 continue
32 self.AddStory(story_class(self, take_memory_measurement)) 33 self.AddStory(story_class(self, take_memory_measurement))
33 34
34 35
35 class SystemHealthBlankStorySet(story.StorySet): 36 class SystemHealthBlankStorySet(story.StorySet):
36 """A story set containing the chrome:blank story only.""" 37 """A story set containing the chrome:blank story only."""
37 def __init__(self, take_memory_measurement=False): 38 def __init__(self, take_memory_measurement=False, verify_names=True):
38 super(SystemHealthBlankStorySet, self).__init__() 39 super(SystemHealthBlankStorySet, self).__init__()
39 self.AddStory( 40 self.AddStory(
40 chrome_stories.BlankAboutBlankStory(self, take_memory_measurement)) 41 chrome_stories.BlankAboutBlankStory(self, take_memory_measurement))
41 42
42 43
43 class DesktopSystemHealthStorySet(SystemHealthStorySet): 44 class DesktopSystemHealthStorySet(SystemHealthStorySet):
44 """Desktop user stories for the System Health Plan. 45 """Desktop user stories for the System Health Plan.
45 46
46 Note: This story set is only intended to be used for recording stories via 47 Note: This story set is only intended to be used for recording stories via
47 tools/perf/record_wpr. If you would like to use it in a benchmark, please use 48 tools/perf/record_wpr. If you would like to use it in a benchmark, please use
(...skipping 20 matching lines...) Expand all
68 69
69 def _IterAllSystemHealthStoryClasses(): 70 def _IterAllSystemHealthStoryClasses():
70 start_dir = os.path.dirname(os.path.abspath(__file__)) 71 start_dir = os.path.dirname(os.path.abspath(__file__))
71 # Sort the classes by their names so that their order is stable and 72 # Sort the classes by their names so that their order is stable and
72 # deterministic. 73 # deterministic.
73 for unused_cls_name, cls in sorted(discover.DiscoverClasses( 74 for unused_cls_name, cls in sorted(discover.DiscoverClasses(
74 start_dir=start_dir, 75 start_dir=start_dir,
75 top_level_dir=os.path.dirname(start_dir), 76 top_level_dir=os.path.dirname(start_dir),
76 base_class=system_health_story.SystemHealthStory).iteritems()): 77 base_class=system_health_story.SystemHealthStory).iteritems()):
77 yield cls 78 yield cls
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698