| 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 | 9 from telemetry.core import discover |
| 10 from telemetry.page import page | 10 from telemetry.page import page |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 class TwitterDesktopStory(_InfiniteScrollStory): | 127 class TwitterDesktopStory(_InfiniteScrollStory): |
| 128 NAME = 'twitter' | 128 NAME = 'twitter' |
| 129 URL = 'https://twitter.com/taylorswift13' | 129 URL = 'https://twitter.com/taylorswift13' |
| 130 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 130 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 131 | 131 |
| 132 class InfiniteScrollStorySet(story.StorySet): | 132 class InfiniteScrollStorySet(story.StorySet): |
| 133 """ Desktop story set. """ | 133 """ Desktop story set. """ |
| 134 def __init__(self): | 134 def __init__(self): |
| 135 super(InfiniteScrollStorySet, self).__init__( | 135 super(InfiniteScrollStorySet, self).__init__( |
| 136 archive_data_file='data/infinite_scroll.json', | 136 archive_data_file='data/infinite_scroll.json', |
| 137 cloud_storage_bucket=story.PARTNER_BUCKET) | 137 cloud_storage_bucket=story.PARTNER_BUCKET, |
| 138 verify_names=True) |
| 138 for story_class in _FindInfiniteScrollStoryClasses(platforms.DESKTOP): | 139 for story_class in _FindInfiniteScrollStoryClasses(platforms.DESKTOP): |
| 139 self.AddStory(story_class(self)) | 140 self.AddStory(story_class(self)) |
| 140 | 141 |
| 141 class MobileInfiniteScrollStorySet(story.StorySet): | 142 class MobileInfiniteScrollStorySet(story.StorySet): |
| 142 """ Mobile story set. """ | 143 """ Mobile story set. """ |
| 143 def __init__(self): | 144 def __init__(self): |
| 144 super(MobileInfiniteScrollStorySet, self).__init__( | 145 super(MobileInfiniteScrollStorySet, self).__init__( |
| 145 archive_data_file='data/mobile_infinite_scroll.json', | 146 archive_data_file='data/mobile_infinite_scroll.json', |
| 146 cloud_storage_bucket=story.PARTNER_BUCKET) | 147 cloud_storage_bucket=story.PARTNER_BUCKET, |
| 148 verify_names=True) |
| 147 for story_class in _FindInfiniteScrollStoryClasses(platforms.MOBILE): | 149 for story_class in _FindInfiniteScrollStoryClasses(platforms.MOBILE): |
| 148 self.AddStory(story_class(self)) | 150 self.AddStory(story_class(self)) |
| 149 | 151 |
| 150 def _FindInfiniteScrollStoryClasses(platform): | 152 def _FindInfiniteScrollStoryClasses(platform): |
| 151 # Sort the classes by their names so that their order is stable and | 153 # Sort the classes by their names so that their order is stable and |
| 152 # deterministic. | 154 # deterministic. |
| 153 for unused_cls_name, cls in sorted(discover.DiscoverClassesInModule( | 155 for unused_cls_name, cls in sorted(discover.DiscoverClassesInModule( |
| 154 module=sys.modules[__name__], base_class=_InfiniteScrollStory, | 156 module=sys.modules[__name__], base_class=_InfiniteScrollStory, |
| 155 index_by_class_name=True).iteritems()): | 157 index_by_class_name=True).iteritems()): |
| 156 if platform in cls.SUPPORTED_PLATFORMS: | 158 if platform in cls.SUPPORTED_PLATFORMS: |
| 157 yield cls | 159 yield cls |
| OLD | NEW |