| OLD | NEW |
| 1 # encoding: utf-8 | 1 # encoding: utf-8 |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 from page_sets.system_health import platforms | 6 from page_sets.system_health import platforms |
| 7 from page_sets.system_health import story_tags |
| 7 from page_sets.system_health import system_health_story | 8 from page_sets.system_health import system_health_story |
| 8 | 9 |
| 9 from page_sets.login_helpers import pinterest_login | 10 from page_sets.login_helpers import pinterest_login |
| 10 | 11 |
| 11 from telemetry import decorators | 12 from telemetry import decorators |
| 12 from telemetry.util import js_template | 13 from telemetry.util import js_template |
| 13 | 14 |
| 14 | 15 |
| 15 class _BrowsingStory(system_health_story.SystemHealthStory): | 16 class _BrowsingStory(system_health_story.SystemHealthStory): |
| 16 """Abstract base class for browsing stories. | 17 """Abstract base class for browsing stories. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 action_runner.RepeatableBrowserDrivenScroll( | 93 action_runner.RepeatableBrowserDrivenScroll( |
| 93 repeat_count=self.MAIN_PAGE_SCROLL_REPEAT) | 94 repeat_count=self.MAIN_PAGE_SCROLL_REPEAT) |
| 94 | 95 |
| 95 | 96 |
| 96 class CnnStory(_NewsBrowsingStory): | 97 class CnnStory(_NewsBrowsingStory): |
| 97 """The second top website in http://www.alexa.com/topsites/category/News""" | 98 """The second top website in http://www.alexa.com/topsites/category/News""" |
| 98 NAME = 'browse:news:cnn' | 99 NAME = 'browse:news:cnn' |
| 99 URL = 'http://edition.cnn.com/' | 100 URL = 'http://edition.cnn.com/' |
| 100 ITEM_SELECTOR = '.cd__content > h3 > a' | 101 ITEM_SELECTOR = '.cd__content > h3 > a' |
| 101 ITEMS_TO_VISIT = 2 | 102 ITEMS_TO_VISIT = 2 |
| 103 TAGS = [story_tags.JAVASCRIPT_HEAVY] |
| 102 | 104 |
| 103 | 105 |
| 104 class FacebookMobileStory(_NewsBrowsingStory): | 106 class FacebookMobileStory(_NewsBrowsingStory): |
| 105 NAME = 'browse:social:facebook' | 107 NAME = 'browse:social:facebook' |
| 106 URL = 'https://www.facebook.com/rihanna' | 108 URL = 'https://www.facebook.com/rihanna' |
| 107 ITEM_SELECTOR = 'article ._5msj' | 109 ITEM_SELECTOR = 'article ._5msj' |
| 108 # We scroll further than usual so that Facebook fetches enough items | 110 # We scroll further than usual so that Facebook fetches enough items |
| 109 # (crbug.com/631022) | 111 # (crbug.com/631022) |
| 110 MAIN_PAGE_SCROLL_REPEAT = 1 | 112 MAIN_PAGE_SCROLL_REPEAT = 1 |
| 111 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 113 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 IS_SINGLE_PAGE_APP = True | 389 IS_SINGLE_PAGE_APP = True |
| 388 | 390 |
| 389 | 391 |
| 390 class YouTubeMobileStory(_MediaBrowsingStory): | 392 class YouTubeMobileStory(_MediaBrowsingStory): |
| 391 NAME = 'browse:media:youtube' | 393 NAME = 'browse:media:youtube' |
| 392 URL = 'https://m.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' | 394 URL = 'https://m.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' |
| 393 ITEM_SELECTOR = '._mhgb > a' | 395 ITEM_SELECTOR = '._mhgb > a' |
| 394 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 396 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 395 IS_SINGLE_PAGE_APP = True | 397 IS_SINGLE_PAGE_APP = True |
| 396 ITEM_SELECTOR_INDEX = 3 | 398 ITEM_SELECTOR_INDEX = 3 |
| 399 TAGS = [story_tags.JAVASCRIPT_HEAVY] |
| 397 | 400 |
| 398 | 401 |
| 399 class YouTubeDesktopStory(_MediaBrowsingStory): | 402 class YouTubeDesktopStory(_MediaBrowsingStory): |
| 400 NAME = 'browse:media:youtube' | 403 NAME = 'browse:media:youtube' |
| 401 URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' | 404 URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false' |
| 402 ITEM_SELECTOR = '.yt-uix-simple-thumb-related' | 405 ITEM_SELECTOR = '.yt-uix-simple-thumb-related' |
| 403 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY | 406 SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| 404 IS_SINGLE_PAGE_APP = True | 407 IS_SINGLE_PAGE_APP = True |
| 405 # A longer view time allows videos to load and play. | 408 # A longer view time allows videos to load and play. |
| 406 ITEM_VIEW_TIME_IN_SECONDS = 5 | 409 ITEM_VIEW_TIME_IN_SECONDS = 5 |
| 407 ITEMS_TO_VISIT = 8 | 410 ITEMS_TO_VISIT = 8 |
| 408 ITEM_SELECTOR_INDEX = 3 | 411 ITEM_SELECTOR_INDEX = 3 |
| 409 PLATFORM_SPECIFIC = True | 412 PLATFORM_SPECIFIC = True |
| 413 TAGS = [story_tags.JAVASCRIPT_HEAVY] |
| 410 | 414 |
| 411 | 415 |
| 412 class FacebookPhotosMobileStory(_MediaBrowsingStory): | 416 class FacebookPhotosMobileStory(_MediaBrowsingStory): |
| 413 NAME = 'browse:media:facebook_photos' | 417 NAME = 'browse:media:facebook_photos' |
| 414 URL = ( | 418 URL = ( |
| 415 'https://m.facebook.com/rihanna/photos/a.207477806675.138795.10092511675/1
0153911739606676/?type=3&source=54&ref=page_internal') | 419 'https://m.facebook.com/rihanna/photos/a.207477806675.138795.10092511675/1
0153911739606676/?type=3&source=54&ref=page_internal') |
| 416 ITEM_SELECTOR = '._57-r.touchable' | 420 ITEM_SELECTOR = '._57-r.touchable' |
| 417 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY | 421 SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| 418 IS_SINGLE_PAGE_APP = True | 422 IS_SINGLE_PAGE_APP = True |
| 419 ITEM_SELECTOR_INDEX = 0 | 423 ITEM_SELECTOR_INDEX = 0 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 inner_save_function = 'document.querySelector(".nameAndIcons")' | 477 inner_save_function = 'document.querySelector(".nameAndIcons")' |
| 474 action_runner.WaitForElement(element_function=inner_save_function) | 478 action_runner.WaitForElement(element_function=inner_save_function) |
| 475 action_runner.ClickElement(element_function=inner_save_function) | 479 action_runner.ClickElement(element_function=inner_save_function) |
| 476 action_runner.Wait(1) # Wait to make navigation realistic. | 480 action_runner.Wait(1) # Wait to make navigation realistic. |
| 477 | 481 |
| 478 # Close selection. | 482 # Close selection. |
| 479 x_element_function = ('document.querySelector(' | 483 x_element_function = ('document.querySelector(' |
| 480 '".Button.borderless.close.visible")') | 484 '".Button.borderless.close.visible")') |
| 481 action_runner.ClickElement(element_function=x_element_function) | 485 action_runner.ClickElement(element_function=x_element_function) |
| 482 action_runner.Wait(1) # Wait to make navigation realistic. | 486 action_runner.Wait(1) # Wait to make navigation realistic. |
| OLD | NEW |