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..9f180164fc33f380fb43e1d2e80aa45aa4f78009 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,96 @@ class WashingtonPostMobileStory(_NewsBrowsingStory): |
if has_button: |
action_runner.ClickElement(selector=self._CLOSE_BUTTON_SELECTOR) |
super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner) |
+ |
+ |
+############################################################################## |
+# Media browsing stories. |
petrcermak
2016/08/01 11:22:30
Can you please update the corresponding loading st
Hannes Payer (out of office)
2016/08/04 11:38:01
Added imgur to the load stories.
Changed the links
|
+############################################################################## |
+ |
+ |
+class _MediaBrowsingStory(_BrowsingStory): |
+ """ Abstract base class for media user stories |
petrcermak
2016/08/01 11:22:30
nit: remove space before "Abstract"
Hannes Payer (out of office)
2016/08/04 11:38:01
Done.
|
+ |
+ 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 |
charliea (OOO until 10-5)
2016/07/29 20:10:01
IMO this (and the corresponding mobile story time)
Hannes Payer (out of office)
2016/08/04 11:38:01
Done.
|
+ ITEMS_TO_VISIT = 15 |
+ |
+ |
+class FacebookMobileStory(_MediaBrowsingStory): |
+ NAME = 'browse:media:facebookphotos' |
+ URL = ( |
+ 'https://facebook.com/photo.php?fbid=10154398154450513&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') |
+ 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) |
petrcermak
2016/08/01 11:22:30
nit: invalid indentation. The two basic options ar
|