| OLD | NEW |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 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 sys | 5 import sys |
| 6 | 6 |
| 7 from page_sets.login_helpers import facebook_login | 7 from page_sets.login_helpers import facebook_login |
| 8 from page_sets.system_health import platforms | 8 from page_sets.system_health import platforms |
| 9 from telemetry.core import discover | |
| 10 from telemetry.page import page | 9 from telemetry.page import page |
| 11 from telemetry.page import shared_page_state | 10 from telemetry.page import shared_page_state |
| 12 from telemetry import story | 11 from telemetry import story |
| 13 | 12 |
| 13 from py_utils import discover |
| 14 |
| 14 class _InfiniteScrollStory(page.Page): | 15 class _InfiniteScrollStory(page.Page): |
| 15 """ Base class for infinite scroll stories.""" | 16 """ Base class for infinite scroll stories.""" |
| 16 | 17 |
| 17 NAME = NotImplemented | 18 NAME = NotImplemented |
| 18 URL = NotImplemented | 19 URL = NotImplemented |
| 19 SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS | 20 SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS |
| 20 | 21 |
| 21 SCROLL_DISTANCE = 25000 | 22 SCROLL_DISTANCE = 25000 |
| 22 SCROLL_STEP = 1000 | 23 SCROLL_STEP = 1000 |
| 23 MAX_SCROLL_RETRIES = 5 | 24 MAX_SCROLL_RETRIES = 5 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 self.AddStory(story_class(self)) | 149 self.AddStory(story_class(self)) |
| 149 | 150 |
| 150 def _FindInfiniteScrollStoryClasses(platform): | 151 def _FindInfiniteScrollStoryClasses(platform): |
| 151 # Sort the classes by their names so that their order is stable and | 152 # Sort the classes by their names so that their order is stable and |
| 152 # deterministic. | 153 # deterministic. |
| 153 for unused_cls_name, cls in sorted(discover.DiscoverClassesInModule( | 154 for unused_cls_name, cls in sorted(discover.DiscoverClassesInModule( |
| 154 module=sys.modules[__name__], base_class=_InfiniteScrollStory, | 155 module=sys.modules[__name__], base_class=_InfiniteScrollStory, |
| 155 index_by_class_name=True).iteritems()): | 156 index_by_class_name=True).iteritems()): |
| 156 if platform in cls.SUPPORTED_PLATFORMS: | 157 if platform in cls.SUPPORTED_PLATFORMS: |
| 157 yield cls | 158 yield cls |
| OLD | NEW |