| 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 | 7 |
| 7 from telemetry import decorators | 8 from telemetry import decorators |
| 8 from telemetry.page import page | 9 from telemetry.page import page |
| 9 from telemetry.page import shared_page_state | 10 from telemetry.page import shared_page_state |
| 10 | 11 |
| 11 | 12 |
| 12 # Extra wait time after the page has loaded required by the loading metric. We | 13 # Extra wait time after the page has loaded required by the loading metric. We |
| 13 # use it in all benchmarks to avoid divergence between benchmarks. | 14 # use it in all benchmarks to avoid divergence between benchmarks. |
| 14 # TODO(petrcermak): Switch the memory benchmarks to use it as well. | 15 # TODO(petrcermak): Switch the memory benchmarks to use it as well. |
| 15 _WAIT_TIME_AFTER_LOAD = 10 | 16 _WAIT_TIME_AFTER_LOAD = 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 class SystemHealthStory(page.Page): | 59 class SystemHealthStory(page.Page): |
| 59 """Abstract base class for System Health user stories.""" | 60 """Abstract base class for System Health user stories.""" |
| 60 __metaclass__ = _MetaSystemHealthStory | 61 __metaclass__ = _MetaSystemHealthStory |
| 61 | 62 |
| 62 # The full name of a single page story has the form CASE:GROUP:PAGE (e.g. | 63 # The full name of a single page story has the form CASE:GROUP:PAGE (e.g. |
| 63 # 'load:search:google'). | 64 # 'load:search:google'). |
| 64 NAME = NotImplemented | 65 NAME = NotImplemented |
| 65 URL = NotImplemented | 66 URL = NotImplemented |
| 66 ABSTRACT_STORY = True | 67 ABSTRACT_STORY = True |
| 67 SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS | 68 SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS |
| 69 TAGS = None |
| 68 | 70 |
| 69 def __init__(self, story_set, take_memory_measurement): | 71 def __init__(self, story_set, take_memory_measurement): |
| 70 case, group, _ = self.NAME.split(':') | 72 case, group, _ = self.NAME.split(':') |
| 73 tags = [] |
| 74 if self.TAGS: |
| 75 for t in self.TAGS: |
| 76 assert t in story_tags.ALL_TAGS |
| 77 tags.append(t.name) |
| 71 super(SystemHealthStory, self).__init__( | 78 super(SystemHealthStory, self).__init__( |
| 72 shared_page_state_class=_SystemHealthSharedState, page_set=story_set, | 79 shared_page_state_class=_SystemHealthSharedState, page_set=story_set, |
| 73 name=self.NAME, url=self.URL, | 80 name=self.NAME, url=self.URL, tags=tags, |
| 74 credentials_path='../data/credentials.json', | 81 credentials_path='../data/credentials.json', |
| 75 grouping_keys={'case': case, 'group': group}) | 82 grouping_keys={'case': case, 'group': group}) |
| 76 self._take_memory_measurement = take_memory_measurement | 83 self._take_memory_measurement = take_memory_measurement |
| 77 | 84 |
| 78 @classmethod | 85 @classmethod |
| 79 def CanRun(cls, possible_browser): | 86 def CanRun(cls, possible_browser): |
| 80 if (decorators.ShouldSkip(cls, possible_browser)[0] or | 87 if (decorators.ShouldSkip(cls, possible_browser)[0] or |
| 81 cls.ShouldDisable(possible_browser)): | 88 cls.ShouldDisable(possible_browser)): |
| 82 return False | 89 return False |
| 83 return True | 90 return True |
| (...skipping 20 matching lines...) Expand all Loading... |
| 104 pass | 111 pass |
| 105 | 112 |
| 106 def RunNavigateSteps(self, action_runner): | 113 def RunNavigateSteps(self, action_runner): |
| 107 self._Login(action_runner) | 114 self._Login(action_runner) |
| 108 super(SystemHealthStory, self).RunNavigateSteps(action_runner) | 115 super(SystemHealthStory, self).RunNavigateSteps(action_runner) |
| 109 | 116 |
| 110 def RunPageInteractions(self, action_runner): | 117 def RunPageInteractions(self, action_runner): |
| 111 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | 118 action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
| 112 self._DidLoadDocument(action_runner) | 119 self._DidLoadDocument(action_runner) |
| 113 self._Measure(action_runner) | 120 self._Measure(action_runner) |
| OLD | NEW |