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 from page_sets.system_health import platforms | 5 from page_sets.system_health import platforms |
6 from page_sets.system_health import story_tags | 6 from page_sets.system_health import story_tags |
7 | 7 |
8 from telemetry import decorators | 8 from telemetry import decorators |
9 from telemetry.page import page | 9 from telemetry.page import page |
10 from telemetry.page import shared_page_state | 10 from telemetry.page import shared_page_state |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 tags.append(t.name) | 80 tags.append(t.name) |
81 super(SystemHealthStory, self).__init__( | 81 super(SystemHealthStory, self).__init__( |
82 shared_page_state_class=_SystemHealthSharedState, page_set=story_set, | 82 shared_page_state_class=_SystemHealthSharedState, page_set=story_set, |
83 name=self.NAME, url=self.URL, tags=tags, | 83 name=self.NAME, url=self.URL, tags=tags, |
84 credentials_path='../data/credentials.json', | 84 credentials_path='../data/credentials.json', |
85 grouping_keys={'case': case, 'group': group}, | 85 grouping_keys={'case': case, 'group': group}, |
86 platform_specific=self.PLATFORM_SPECIFIC) | 86 platform_specific=self.PLATFORM_SPECIFIC) |
87 self._take_memory_measurement = take_memory_measurement | 87 self._take_memory_measurement = take_memory_measurement |
88 | 88 |
89 @classmethod | 89 @classmethod |
| 90 def GetStoryDescription(cls): |
| 91 if cls.__doc__: |
| 92 return cls.__doc__ |
| 93 return cls.GenerateStoryDescription() |
| 94 |
| 95 @classmethod |
| 96 def GenerateStoryDescription(cls): |
| 97 """ Subclasses of SystemHealthStory can override this to auto generate |
| 98 their story description. |
| 99 However, it's recommended to use the Python docstring to describe the user |
| 100 stories instead and this should only be used for very repetitive cases. |
| 101 """ |
| 102 return None |
| 103 |
| 104 @classmethod |
90 def CanRun(cls, possible_browser): | 105 def CanRun(cls, possible_browser): |
91 if (decorators.ShouldSkip(cls, possible_browser)[0] or | 106 if (decorators.ShouldSkip(cls, possible_browser)[0] or |
92 cls.ShouldDisable(possible_browser)): | 107 cls.ShouldDisable(possible_browser)): |
93 return False | 108 return False |
94 return True | 109 return True |
95 | 110 |
96 @classmethod | 111 @classmethod |
97 def ShouldDisable(cls, possible_browser): | 112 def ShouldDisable(cls, possible_browser): |
98 """Override this method to disable a story under specific conditions. | 113 """Override this method to disable a story under specific conditions. |
99 | 114 |
(...skipping 15 matching lines...) Expand all Loading... |
115 pass | 130 pass |
116 | 131 |
117 def RunNavigateSteps(self, action_runner): | 132 def RunNavigateSteps(self, action_runner): |
118 self._Login(action_runner) | 133 self._Login(action_runner) |
119 super(SystemHealthStory, self).RunNavigateSteps(action_runner) | 134 super(SystemHealthStory, self).RunNavigateSteps(action_runner) |
120 | 135 |
121 def RunPageInteractions(self, action_runner): | 136 def RunPageInteractions(self, action_runner): |
122 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | 137 action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
123 self._DidLoadDocument(action_runner) | 138 self._DidLoadDocument(action_runner) |
124 self._Measure(action_runner) | 139 self._Measure(action_runner) |
OLD | NEW |