| 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 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) | |
| 25 | 24 |
| 26 assert platform in platforms.ALL_PLATFORMS | 25 assert platform in platforms.ALL_PLATFORMS |
| 27 | 26 |
| 28 for story_class in _IterAllSystemHealthStoryClasses(): | 27 for story_class in _IterAllSystemHealthStoryClasses(): |
| 29 if (story_class.ABSTRACT_STORY or | 28 if (story_class.ABSTRACT_STORY or |
| 30 platform not in story_class.SUPPORTED_PLATFORMS or | 29 platform not in story_class.SUPPORTED_PLATFORMS or |
| 31 case and not story_class.NAME.startswith(case + ':')): | 30 case and not story_class.NAME.startswith(case + ':')): |
| 32 continue | 31 continue |
| 33 self.AddStory(story_class(self, take_memory_measurement)) | 32 self.AddStory(story_class(self, take_memory_measurement)) |
| 34 | 33 |
| 35 | 34 |
| 36 class SystemHealthBlankStorySet(story.StorySet): | 35 class SystemHealthBlankStorySet(story.StorySet): |
| 37 """A story set containing the chrome:blank story only.""" | 36 """A story set containing the chrome:blank story only.""" |
| 38 def __init__(self, take_memory_measurement=False, verify_names=True): | 37 def __init__(self, take_memory_measurement=False): |
| 39 super(SystemHealthBlankStorySet, self).__init__() | 38 super(SystemHealthBlankStorySet, self).__init__() |
| 40 self.AddStory( | 39 self.AddStory( |
| 41 chrome_stories.BlankAboutBlankStory(self, take_memory_measurement)) | 40 chrome_stories.BlankAboutBlankStory(self, take_memory_measurement)) |
| 42 | 41 |
| 43 | 42 |
| 44 class DesktopSystemHealthStorySet(SystemHealthStorySet): | 43 class DesktopSystemHealthStorySet(SystemHealthStorySet): |
| 45 """Desktop user stories for the System Health Plan. | 44 """Desktop user stories for the System Health Plan. |
| 46 | 45 |
| 47 Note: This story set is only intended to be used for recording stories via | 46 Note: This story set is only intended to be used for recording stories via |
| 48 tools/perf/record_wpr. If you would like to use it in a benchmark, please use | 47 tools/perf/record_wpr. If you would like to use it in a benchmark, please use |
| (...skipping 20 matching lines...) Expand all Loading... |
| 69 | 68 |
| 70 def _IterAllSystemHealthStoryClasses(): | 69 def _IterAllSystemHealthStoryClasses(): |
| 71 start_dir = os.path.dirname(os.path.abspath(__file__)) | 70 start_dir = os.path.dirname(os.path.abspath(__file__)) |
| 72 # Sort the classes by their names so that their order is stable and | 71 # Sort the classes by their names so that their order is stable and |
| 73 # deterministic. | 72 # deterministic. |
| 74 for unused_cls_name, cls in sorted(discover.DiscoverClasses( | 73 for unused_cls_name, cls in sorted(discover.DiscoverClasses( |
| 75 start_dir=start_dir, | 74 start_dir=start_dir, |
| 76 top_level_dir=os.path.dirname(start_dir), | 75 top_level_dir=os.path.dirname(start_dir), |
| 77 base_class=system_health_story.SystemHealthStory).iteritems()): | 76 base_class=system_health_story.SystemHealthStory).iteritems()): |
| 78 yield cls | 77 yield cls |
| OLD | NEW |