| 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 system_health_story | 6 from page_sets.system_health import system_health_story |
| 7 | 7 |
| 8 from telemetry import decorators |
| 9 |
| 8 | 10 |
| 9 class _BrowsingStory(system_health_story.SystemHealthStory): | 11 class _BrowsingStory(system_health_story.SystemHealthStory): |
| 10 """Abstract base class for browsing stories. | 12 """Abstract base class for browsing stories. |
| 11 | 13 |
| 12 A browsing story visits items on the main page. Subclasses provide | 14 A browsing story visits items on the main page. Subclasses provide |
| 13 CSS selector to identify the items and implement interaction using | 15 CSS selector to identify the items and implement interaction using |
| 14 the helper methods of this class. | 16 the helper methods of this class. |
| 15 """ | 17 """ |
| 16 | 18 |
| 17 IS_SINGLE_PAGE_APP = False | 19 IS_SINGLE_PAGE_APP = False |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS) | 74 action_runner.Wait(self.ITEM_READ_TIME_IN_SECONDS) |
| 73 action_runner.RepeatableBrowserDrivenScroll( | 75 action_runner.RepeatableBrowserDrivenScroll( |
| 74 repeat_count=self.ITEM_SCROLL_REPEAT) | 76 repeat_count=self.ITEM_SCROLL_REPEAT) |
| 75 | 77 |
| 76 def _ScrollMainPage(self, action_runner): | 78 def _ScrollMainPage(self, action_runner): |
| 77 action_runner.tab.WaitForDocumentReadyStateToBeComplete() | 79 action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
| 78 action_runner.RepeatableBrowserDrivenScroll( | 80 action_runner.RepeatableBrowserDrivenScroll( |
| 79 repeat_count=self.MAIN_PAGE_SCROLL_REPEAT) | 81 repeat_count=self.MAIN_PAGE_SCROLL_REPEAT) |
| 80 | 82 |
| 81 | 83 |
| 84 # TODO(ulan): Enable this story on mobile once it uses less memory and does not |
| 85 # crash with OOM. |
| 86 @decorators.Disabled('android') |
| 82 class CnnStory(_NewsBrowsingStory): | 87 class CnnStory(_NewsBrowsingStory): |
| 83 """The second top website in http://www.alexa.com/topsites/category/News""" | 88 """The second top website in http://www.alexa.com/topsites/category/News""" |
| 84 NAME = 'browse:news:cnn' | 89 NAME = 'browse:news:cnn' |
| 85 URL = 'http://edition.cnn.com/' | 90 URL = 'http://edition.cnn.com/' |
| 86 ITEM_SELECTOR = '.cd__content > h3 > a' | 91 ITEM_SELECTOR = '.cd__content > h3 > a' |
| 87 ITEMS_TO_VISIT = 2 | 92 ITEMS_TO_VISIT = 2 |
| 88 # TODO(ulan): Enable this story on mobile once it uses less memory and | |
| 89 # does not crash with OOM. | |
| 90 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | |
| 91 | 93 |
| 92 | 94 |
| 93 class FacebookMobileStory(_NewsBrowsingStory): | 95 class FacebookMobileStory(_NewsBrowsingStory): |
| 94 NAME = 'browse:social:facebook' | 96 NAME = 'browse:social:facebook' |
| 95 URL = 'https://www.facebook.com/rihanna' | 97 URL = 'https://www.facebook.com/rihanna' |
| 96 ITEM_SELECTOR = 'article ._5msj' | 98 ITEM_SELECTOR = 'article ._5msj' |
| 97 # We scroll further than usual so that Facebook fetches enough items | 99 # We scroll further than usual so that Facebook fetches enough items |
| 98 # (crbug.com/631022) | 100 # (crbug.com/631022) |
| 99 MAIN_PAGE_SCROLL_REPEAT = 1 | 101 MAIN_PAGE_SCROLL_REPEAT = 1 |
| 100 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 102 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 146 |
| 145 | 147 |
| 146 class NytimesDesktopStory(_NewsBrowsingStory): | 148 class NytimesDesktopStory(_NewsBrowsingStory): |
| 147 """The third top website in http://www.alexa.com/topsites/category/News""" | 149 """The third top website in http://www.alexa.com/topsites/category/News""" |
| 148 NAME = 'browse:news:nytimes' | 150 NAME = 'browse:news:nytimes' |
| 149 URL = 'http://www.nytimes.com' | 151 URL = 'http://www.nytimes.com' |
| 150 ITEM_SELECTOR = '.story-heading > a' | 152 ITEM_SELECTOR = '.story-heading > a' |
| 151 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 153 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 152 | 154 |
| 153 | 155 |
| 156 # Desktop qq.com opens a news item in a separate tab, for which the back button |
| 157 # does not work. Mobile qq.com is disabled due to crbug.com/627166. |
| 158 @decorators.Disabled('all') |
| 154 class QqMobileStory(_NewsBrowsingStory): | 159 class QqMobileStory(_NewsBrowsingStory): |
| 155 NAME = 'browse:news:qq' | 160 NAME = 'browse:news:qq' |
| 156 URL = 'http://news.qq.com' | 161 URL = 'http://news.qq.com' |
| 157 # Desktop qq.com opens a news item in a separate tab, for which the back | |
| 158 # button does not work. | |
| 159 # Mobile qq.com is disabled due to crbug.com/627166 | |
| 160 ITEM_SELECTOR = '.list .full a' | 162 ITEM_SELECTOR = '.list .full a' |
| 161 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS | 163 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 162 | 164 |
| 163 | 165 |
| 164 class RedditDesktopStory(_NewsBrowsingStory): | 166 class RedditDesktopStory(_NewsBrowsingStory): |
| 165 """The top website in http://www.alexa.com/topsites/category/News""" | 167 """The top website in http://www.alexa.com/topsites/category/News""" |
| 166 NAME = 'browse:news:reddit' | 168 NAME = 'browse:news:reddit' |
| 167 URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week' | 169 URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week' |
| 168 ITEM_SELECTOR = '.thing .title > a' | 170 ITEM_SELECTOR = '.thing .title > a' |
| 169 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 171 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 170 | 172 |
| 171 | 173 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' | 275 URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' |
| 274 ITEM_SELECTOR = '.yt-uix-simple-thumb-related' | 276 ITEM_SELECTOR = '.yt-uix-simple-thumb-related' |
| 275 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 277 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 276 IS_SINGLE_PAGE_APP = True | 278 IS_SINGLE_PAGE_APP = True |
| 277 # A longer view time allows videos to load and play. | 279 # A longer view time allows videos to load and play. |
| 278 ITEM_VIEW_TIME_IN_SECONDS = 5 | 280 ITEM_VIEW_TIME_IN_SECONDS = 5 |
| 279 ITEMS_TO_VISIT = 8 | 281 ITEMS_TO_VISIT = 8 |
| 280 ITEM_SELECTOR_INDEX = 3 | 282 ITEM_SELECTOR_INDEX = 3 |
| 281 | 283 |
| 282 | 284 |
| 283 class FacebookPhotosMediaStory(_MediaBrowsingStory): | 285 class FacebookPhotosMobileStory(_MediaBrowsingStory): |
| 284 NAME = 'browse:media:facebook_photos' | 286 NAME = 'browse:media:facebook_photos' |
| 285 URL = ( | 287 URL = ( |
| 286 'https://m.facebook.com/rihanna/photos/a.207477806675.138795.10092511675/1
0153911739606676/?type=3&source=54&ref=page_internal') | 288 'https://m.facebook.com/rihanna/photos/a.207477806675.138795.10092511675/1
0153911739606676/?type=3&source=54&ref=page_internal') |
| 287 ITEM_SELECTOR = '._57-r.touchable' | 289 ITEM_SELECTOR = '._57-r.touchable' |
| 288 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 290 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 289 IS_SINGLE_PAGE_APP = True | 291 IS_SINGLE_PAGE_APP = True |
| 290 ITEM_SELECTOR_INDEX = 0 | 292 ITEM_SELECTOR_INDEX = 0 |
| 291 | 293 |
| 292 | 294 |
| 293 class FacebookPhotosDesktopStory(_MediaBrowsingStory): | 295 class FacebookPhotosDesktopStory(_MediaBrowsingStory): |
| 294 NAME = 'browse:media:facebook_photos' | 296 NAME = 'browse:media:facebook_photos' |
| 295 URL = ( | 297 URL = ( |
| 296 'https://www.facebook.com/rihanna/photos/a.207477806675.138795.10092511675
/10153911739606676/?type=3&theater') | 298 'https://www.facebook.com/rihanna/photos/a.207477806675.138795.10092511675
/10153911739606676/?type=3&theater') |
| 297 ITEM_SELECTOR = '.snowliftPager.next' | 299 ITEM_SELECTOR = '.snowliftPager.next' |
| 298 # Recording currently does not work. The page gets stuck in the | 300 # Recording currently does not work. The page gets stuck in the |
| 299 # theater viewer. | 301 # theater viewer. |
| 300 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS | 302 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS |
| 301 IS_SINGLE_PAGE_APP = True | 303 IS_SINGLE_PAGE_APP = True |
| OLD | NEW |