| 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 |
| 101 | 103 |
| 102 | 104 |
| 105 # Web-page-replay does not work for this website: |
| 106 # https://github.com/chromium/web-page-replay/issues/79. |
| 107 @decorators.Disabled('all') |
| 103 class FacebookDesktopStory(_NewsBrowsingStory): | 108 class FacebookDesktopStory(_NewsBrowsingStory): |
| 104 NAME = 'browse:social:facebook' | 109 NAME = 'browse:social:facebook' |
| 105 URL = 'https://www.facebook.com/rihanna' | 110 URL = 'https://www.facebook.com/rihanna' |
| 106 ITEM_SELECTOR = '._4-eo' | 111 ITEM_SELECTOR = '._4-eo' |
| 107 IS_SINGLE_PAGE_APP = True | 112 IS_SINGLE_PAGE_APP = True |
| 108 # Web-page-replay does not work for this website: | 113 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 109 # https://github.com/chromium/web-page-replay/issues/79. | |
| 110 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS | |
| 111 | 114 |
| 112 | 115 |
| 113 class FlipboardMobileStory(_NewsBrowsingStory): | 116 class FlipboardMobileStory(_NewsBrowsingStory): |
| 114 NAME = 'browse:news:flipboard' | 117 NAME = 'browse:news:flipboard' |
| 115 URL = 'https://flipboard.com/explore' | 118 URL = 'https://flipboard.com/explore' |
| 116 IS_SINGLE_PAGE_APP = True | 119 IS_SINGLE_PAGE_APP = True |
| 117 ITEM_SELECTOR = '.grad-top' | 120 ITEM_SELECTOR = '.grad-top' |
| 118 ITEM_SCROLL_REPEAT = 4 | 121 ITEM_SCROLL_REPEAT = 4 |
| 119 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 122 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 120 | 123 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 144 | 147 |
| 145 | 148 |
| 146 class NytimesDesktopStory(_NewsBrowsingStory): | 149 class NytimesDesktopStory(_NewsBrowsingStory): |
| 147 """The third top website in http://www.alexa.com/topsites/category/News""" | 150 """The third top website in http://www.alexa.com/topsites/category/News""" |
| 148 NAME = 'browse:news:nytimes' | 151 NAME = 'browse:news:nytimes' |
| 149 URL = 'http://www.nytimes.com' | 152 URL = 'http://www.nytimes.com' |
| 150 ITEM_SELECTOR = '.story-heading > a' | 153 ITEM_SELECTOR = '.story-heading > a' |
| 151 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 154 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 152 | 155 |
| 153 | 156 |
| 157 # Desktop qq.com opens a news item in a separate tab, for which the back button |
| 158 # does not work. Mobile qq.com is disabled due to crbug.com/627166. |
| 159 @decorators.Disabled('all') |
| 154 class QqMobileStory(_NewsBrowsingStory): | 160 class QqMobileStory(_NewsBrowsingStory): |
| 155 NAME = 'browse:news:qq' | 161 NAME = 'browse:news:qq' |
| 156 URL = 'http://news.qq.com' | 162 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' | 163 ITEM_SELECTOR = '.list .full a' |
| 161 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS | 164 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 162 | 165 |
| 163 | 166 |
| 164 class RedditDesktopStory(_NewsBrowsingStory): | 167 class RedditDesktopStory(_NewsBrowsingStory): |
| 165 """The top website in http://www.alexa.com/topsites/category/News""" | 168 """The top website in http://www.alexa.com/topsites/category/News""" |
| 166 NAME = 'browse:news:reddit' | 169 NAME = 'browse:news:reddit' |
| 167 URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week' | 170 URL = 'https://www.reddit.com/r/news/top/?sort=top&t=week' |
| 168 ITEM_SELECTOR = '.thing .title > a' | 171 ITEM_SELECTOR = '.thing .title > a' |
| 169 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 172 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 170 | 173 |
| 171 | 174 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' | 276 URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' |
| 274 ITEM_SELECTOR = '.yt-uix-simple-thumb-related' | 277 ITEM_SELECTOR = '.yt-uix-simple-thumb-related' |
| 275 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 278 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 276 IS_SINGLE_PAGE_APP = True | 279 IS_SINGLE_PAGE_APP = True |
| 277 # A longer view time allows videos to load and play. | 280 # A longer view time allows videos to load and play. |
| 278 ITEM_VIEW_TIME_IN_SECONDS = 5 | 281 ITEM_VIEW_TIME_IN_SECONDS = 5 |
| 279 ITEMS_TO_VISIT = 8 | 282 ITEMS_TO_VISIT = 8 |
| 280 ITEM_SELECTOR_INDEX = 3 | 283 ITEM_SELECTOR_INDEX = 3 |
| 281 | 284 |
| 282 | 285 |
| 283 class FacebookPhotosMediaStory(_MediaBrowsingStory): | 286 class FacebookPhotosMobileStory(_MediaBrowsingStory): |
| 284 NAME = 'browse:media:facebook_photos' | 287 NAME = 'browse:media:facebook_photos' |
| 285 URL = ( | 288 URL = ( |
| 286 'https://m.facebook.com/rihanna/photos/a.207477806675.138795.10092511675/1
0153911739606676/?type=3&source=54&ref=page_internal') | 289 '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' | 290 ITEM_SELECTOR = '._57-r.touchable' |
| 288 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 291 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 289 IS_SINGLE_PAGE_APP = True | 292 IS_SINGLE_PAGE_APP = True |
| 290 ITEM_SELECTOR_INDEX = 0 | 293 ITEM_SELECTOR_INDEX = 0 |
| 291 | 294 |
| 292 | 295 |
| 296 # Recording currently does not work. The page gets stuck in the theater viewer. |
| 297 @decorators.Disabled('all') |
| 293 class FacebookPhotosDesktopStory(_MediaBrowsingStory): | 298 class FacebookPhotosDesktopStory(_MediaBrowsingStory): |
| 294 NAME = 'browse:media:facebook_photos' | 299 NAME = 'browse:media:facebook_photos' |
| 295 URL = ( | 300 URL = ( |
| 296 'https://www.facebook.com/rihanna/photos/a.207477806675.138795.10092511675
/10153911739606676/?type=3&theater') | 301 'https://www.facebook.com/rihanna/photos/a.207477806675.138795.10092511675
/10153911739606676/?type=3&theater') |
| 297 ITEM_SELECTOR = '.snowliftPager.next' | 302 ITEM_SELECTOR = '.snowliftPager.next' |
| 298 # Recording currently does not work. The page gets stuck in the | 303 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 299 # theater viewer. | |
| 300 SUPPORTED_PLATFORMS = platforms.NO_PLATFORMS | |
| 301 IS_SINGLE_PAGE_APP = True | 304 IS_SINGLE_PAGE_APP = True |
| OLD | NEW |