Chromium Code Reviews| Index: tools/perf/page_sets/system_health/browsing_stories.py |
| diff --git a/tools/perf/page_sets/system_health/browsing_stories.py b/tools/perf/page_sets/system_health/browsing_stories.py |
| index 34efe2b882ab01ac10c399e59719639b80878f52..38bc9999c71bbd9939f16823e21a70a5412c6f0a 100644 |
| --- a/tools/perf/page_sets/system_health/browsing_stories.py |
| +++ b/tools/perf/page_sets/system_health/browsing_stories.py |
| @@ -2,6 +2,7 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| +from page_sets.login_helpers import facebook_login |
| from page_sets.system_health import platforms |
| from page_sets.system_health import system_health_story |
| @@ -38,6 +39,11 @@ class _BrowsingStory(system_health_story.SystemHealthStory): |
| self._WaitForNavigation(action_runner) |
| +############################################################################## |
| +# News browsing stories. |
| +############################################################################## |
| + |
| + |
| class _NewsBrowsingStory(_BrowsingStory): |
| """Abstract base class for news user stories. |
| @@ -74,11 +80,6 @@ class _NewsBrowsingStory(_BrowsingStory): |
| repeat_count=self.MAIN_PAGE_SCROLL_REPEAT) |
| -############################################################################## |
| -# News browsing stories. |
| -############################################################################## |
| - |
| - |
| class CnnStory(_NewsBrowsingStory): |
| """The second top website in http://www.alexa.com/topsites/category/News""" |
| NAME = 'browse:news:cnn' |
| @@ -212,3 +213,97 @@ class WashingtonPostMobileStory(_NewsBrowsingStory): |
| if has_button: |
| action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR) |
| super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner) |
| + |
| + |
| +############################################################################## |
| +# Media browsing stories. |
| +############################################################################## |
| + |
| + |
| +class _MediaBrowsingStory(_BrowsingStory): |
| + """ Abstract base class for media user stories |
| + |
| + A media story imitates browsing a website with photo or video content: |
| + 1. Load a page showing a media item |
| + 2. Click on the next link to go to the next media item |
| + 3. etc. |
| + """ |
| + |
| + ABSTRACT_STORY = True |
| + ITEM_VIEW_TIME_IN_SECONDS = 1 |
| + ITEMS_TO_VISIT = 30 |
| + ITEM_SELECTOR_INDEX = 0 |
| + |
| + def _DidLoadDocument(self, action_runner): |
| + for _ in xrange(self.ITEMS_TO_VISIT): |
| + self._NavigateToItem(action_runner, self.ITEM_SELECTOR_INDEX) |
| + self._ViewMediaItem(action_runner) |
| + |
| + def _ViewMediaItem(self, action_runner): |
| + action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
| + action_runner.Wait(self.ITEM_VIEW_TIME_IN_SECONDS) |
| + |
| + |
| +class ImgurMobileStory(_MediaBrowsingStory): |
| + NAME = 'browse:media:imgur' |
| + URL = 'http://imgur.com/gallery/5UlBN' |
| + ITEM_SELECTOR = '.Navbar-customAction' |
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| + IS_SINGLE_PAGE_APP = True |
| + |
| + |
| +class ImgurDesktopStory(_MediaBrowsingStory): |
| + NAME = 'browse:media:imgur' |
| + URL = 'http://imgur.com/gallery/5UlBN' |
| + ITEM_SELECTOR = '.navNext' |
| + SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| + IS_SINGLE_PAGE_APP = True |
| + |
| + |
| +class YoutubeMobileStory(_MediaBrowsingStory): |
| + NAME = 'browse:media:youtube' |
| + URL = 'https://m.youtube.com/watch?v=njCDZWTI-xg' |
| + ITEM_SELECTOR = '._mpfb > a' |
| + IS_SINGLE_PAGE_APP = True |
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| + ITEM_VIEW_TIME_IN_SECONDS = 2 |
| + ITEMS_TO_VISIT = 15 |
| + ITEM_SELECTOR_INDEX = 3 |
| + |
| + |
| +class YoutubeDesktopStory(_MediaBrowsingStory): |
| + NAME = 'browse:media:youtube' |
| + URL = 'https://www.youtube.com/watch?v=Ic07xTJoP34' |
| + ITEM_SELECTOR = '.yt-uix-simple-thumb-related' |
| + SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| + IS_SINGLE_PAGE_APP = True |
| + ITEM_VIEW_TIME_IN_SECONDS = 2 |
| + ITEMS_TO_VISIT = 15 |
| + |
| + |
| +class FacebookMobileStory(_MediaBrowsingStory): |
| + NAME = 'browse:media:facebookphotos' |
| + URL = ('https://facebook.com/photo.php?fbid=10154398154450513&' |
|
nednguyen
2016/07/26 18:33:43
nits: you can do
URL = (
'https://facebook.com/
Hannes Payer (out of office)
2016/07/27 09:04:33
Done.
|
| + 'id=255110695512&set=a.406278500512.172778.255110695512&' |
| + 'source=54&refid=13') |
| + ITEM_SELECTOR = '._57-p > a' |
| + IS_SINGLE_PAGE_APP = True |
| + SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
| + ITEM_VIEW_TIME_IN_SECONDS = 2 |
| + ITEMS_TO_VISIT = 20 |
| + ITEM_SELECTOR_INDEX = 1 |
| + |
| + |
| +class FacebookDesktopStory(_MediaBrowsingStory): |
| + NAME = 'browse:media:facebookphotos' |
| + URL = ('https://www.facebook.com/NASA/photos/a.67899501771.69169.54971236771/' |
| + '10154267233981772/?type=3&theater') |
|
nednguyen
2016/07/26 18:33:43
Same here
Hannes Payer (out of office)
2016/07/27 09:04:33
Done.
|
| + ITEM_SELECTOR = '.snowliftPager.next' |
| + IS_SINGLE_PAGE_APP = True |
| + SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
| + ITEM_VIEW_TIME_IN_SECONDS = 2 |
| + ITEMS_TO_VISIT = 20 |
| + |
| + def _Login(self, action_runner): |
| + facebook_login.LoginWithDesktopSite(action_runner, 'facebook3', |
| + self.credentials_path) |