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 072b2f42f831ef8f72ed15a57747046c5b55de3b..d195109233ee3c4a86fb9a98a4981511f1c76a80 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 mobile_facebook_login |
from page_sets.system_health import platforms |
from page_sets.system_health import system_health_story |
@@ -73,6 +74,28 @@ class _NewsBrowsingStory(_BrowsingStory): |
action_runner.RepeatableBrowserDrivenScroll( |
repeat_count=self.MAIN_PAGE_SCROLL_REPEAT) |
petrcermak
2016/07/21 19:38:42
nit: add extra blank line (I added justification i
Hannes Payer (out of office)
2016/07/26 16:02:09
Done.
|
+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 |
+ |
+ def _DidLoadDocument(self, action_runner): |
+ for i in xrange(self.ITEMS_TO_VISIT): |
+ self._NavigateToItem(action_runner, self._ItemSelector(i)) |
petrcermak
2016/07/21 19:38:42
Why do you define the _ItemSelector method when yo
Hannes Payer (out of office)
2016/07/26 16:02:09
Done. That is was leftover code experimenting with
|
+ self._ViewMediaItem(action_runner) |
+ |
+ def _ViewMediaItem(self, action_runner): |
+ action_runner.tab.WaitForDocumentReadyStateToBeComplete() |
+ action_runner.Wait(self.ITEM_VIEW_TIME_IN_SECONDS) |
+ |
############################################################################## |
# News browsing stories. |
@@ -177,3 +200,102 @@ class WashingtonPostMobileStory(_NewsBrowsingStory): |
# Close the popup window. |
action_runner.ClickElement(selector='.close') |
super(WashingtonPostMobileStory, self)._DidLoadDocument(action_runner) |
+ |
petrcermak
2016/07/21 19:38:42
nit: There should be two spaces between top-level
Hannes Payer (out of office)
2016/07/26 16:02:09
Done.
|
+############################################################################## |
+# Media browsing stories. |
+############################################################################## |
+ |
+class FlickrMobileStory(_MediaBrowsingStory): |
+ NAME = 'browse:media:flickr' |
+ URL = ("https://www.flickr.com/photos/albertdros/27815579924/in/" |
petrcermak
2016/07/21 19:38:42
s/"/'/g everywhere
Hannes Payer (out of office)
2016/07/26 16:02:09
Done.
|
+ "explore-2016-07-20") |
+ ITEM_SELECTOR = '.next-photo.photo-link' |
+ SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
+ IS_SINGLE_PAGE_APP = True |
+ |
+ def _ItemSelector(self, _): |
+ return 0 |
+ |
+class FlickrDesktopStory(_MediaBrowsingStory): |
+ NAME = 'browse:media:flickr' |
+ URL = ("https://www.flickr.com/photos/albertdros/27815579924/in/" |
+ "explore-2016-07-20") |
+ ITEM_SELECTOR = '.navigate-target.navigate-next' |
+ SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
+ IS_SINGLE_PAGE_APP = True |
+ |
+ def _ItemSelector(self, _): |
+ return 0 |
+ |
+class ImgurMobileStory(_MediaBrowsingStory): |
+ NAME = 'browse:media:imgur' |
+ URL = 'http://imgur.com/gallery/e6gPQ' |
+ ITEM_SELECTOR = '.Navbar-customAction' |
+ SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY |
+ IS_SINGLE_PAGE_APP = True |
+ def _ItemSelector(self, _): |
+ return 0 |
+ |
+class ImgurDesktopStory(_MediaBrowsingStory): |
+ NAME = 'browse:media:imgur' |
+ URL = 'http://imgur.com/gallery/e6gPQ' |
+ ITEM_SELECTOR = '.navNext' |
+ SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY |
+ IS_SINGLE_PAGE_APP = True |
+ def _ItemSelector(self, _): |
+ return 0 |
+ |
+class YoutubeMobileStory(_MediaBrowsingStory): |
charliea (OOO until 10-5)
2016/07/29 20:10:01
I think it's worth noting that there are known iss
Hannes Payer (out of office)
2016/08/04 11:38:01
Acknowledged.
|
+ 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 |
charliea (OOO until 10-5)
2016/07/29 20:10:01
maybe petrcermak@chromium.org has an opinion here,
Hannes Payer (out of office)
2016/08/04 11:38:01
I will change it for all to two seconds.
|
+ ITEMS_TO_VISIT = 15 |
+ def _ItemSelector(self, _): |
+ return 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 |
+ def _ItemSelector(self, _): |
+ return 0 |
+ |
+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 |
+ |
+ def _ItemSelector(self, _): |
+ return 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 _ItemSelector(self, _): |
+ return 0 |
+ |
+ def _Login(self, action_runner): |
+ mobile_facebook_login.LoginAccount(action_runner, 'facebook3', |
nednguyen
2016/07/21 17:32:00
Can you not use mobile_facebook_login here but:
1)
Hannes Payer (out of office)
2016/07/26 16:02:09
I experimented with that. The Desktop version gets
|
+ self.credentials_path) |
+ action_runner.Navigate("https://www.facebook.com") |
+ action_runner.tab.WaitForDocumentReadyStateToBeComplete() |