OLD | NEW |
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 platforms | 7 from page_sets.system_health import platforms |
8 from page_sets.system_health import system_health_story | 8 from page_sets.system_health import system_health_story |
9 | 9 |
10 from telemetry import story | 10 from telemetry import story |
11 from telemetry.core import discover | 11 from telemetry.core import discover |
12 | 12 |
13 | 13 |
14 class SystemHealthStorySet(story.StorySet): | 14 class SystemHealthStorySet(story.StorySet): |
15 """User stories for the System Health Plan. | 15 """User stories for the System Health Plan. |
16 | 16 |
17 See https://goo.gl/Jek2NL. | 17 See https://goo.gl/Jek2NL. |
18 """ | 18 """ |
19 def __init__(self, platform, case=None, take_memory_measurement=False): | 19 def __init__(self, platform, case=None, take_memory_measurement=False): |
20 super(SystemHealthStorySet, self).__init__( | 20 super(SystemHealthStorySet, self).__init__( |
21 archive_data_file=('../data/memory_system_health_%s.json' % platform), | 21 archive_data_file=('../data/system_health_%s.json' % platform), |
22 cloud_storage_bucket=story.PARTNER_BUCKET) | 22 cloud_storage_bucket=story.PARTNER_BUCKET) |
23 | 23 |
24 assert platform in platforms.ALL_PLATFORMS | 24 assert platform in platforms.ALL_PLATFORMS |
25 | 25 |
26 for story_class in _IterAllSystemHealthStoryClasses(): | 26 for story_class in _IterAllSystemHealthStoryClasses(): |
27 if (story_class.ABSTRACT_STORY or | 27 if (story_class.ABSTRACT_STORY or |
28 platform not in story_class.SUPPORTED_PLATFORMS or | 28 platform not in story_class.SUPPORTED_PLATFORMS or |
29 case and not story_class.NAME.startswith(case + ':')): | 29 case and not story_class.NAME.startswith(case + ':')): |
30 continue | 30 continue |
31 self.AddStory(story_class(self, take_memory_measurement)) | 31 self.AddStory(story_class(self, take_memory_measurement)) |
32 | 32 |
33 | 33 |
34 def _IterAllSystemHealthStoryClasses(): | 34 def _IterAllSystemHealthStoryClasses(): |
35 start_dir = os.path.dirname(os.path.abspath(__file__)) | 35 start_dir = os.path.dirname(os.path.abspath(__file__)) |
36 # Sort the classes by their names so that their order is stable and | 36 # Sort the classes by their names so that their order is stable and |
37 # deterministic. | 37 # deterministic. |
38 for unused_cls_name, cls in sorted(discover.DiscoverClasses( | 38 for unused_cls_name, cls in sorted(discover.DiscoverClasses( |
39 start_dir=start_dir, | 39 start_dir=start_dir, |
40 top_level_dir=os.path.dirname(start_dir), | 40 top_level_dir=os.path.dirname(start_dir), |
41 base_class=system_health_story.SystemHealthStory).iteritems()): | 41 base_class=system_health_story.SystemHealthStory).iteritems()): |
42 yield cls | 42 yield cls |
OLD | NEW |