Commit 025f70b5 authored by Sunny Sachanandani's avatar Sunny Sachanandani Committed by Commit Bot

telemetry: Allow specifying extra_browser_args for top pages.

We want multiple instances of these pages with different flags e.g.
sw raster and gpu raster in the new rendering.desktop/mobile page sets.

BUG=760553

Change-Id: I48e2ac82a4314cdf36a61f301559160b8d801f52
Reviewed-on: https://chromium-review.googlesource.com/887798
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: default avatarNed Nguyen <nednguyen@google.com>
Cr-Commit-Position: refs/heads/master@{#533043}
parent 4eb5b28c
......@@ -7,25 +7,30 @@ from telemetry.page import shared_page_state
class KeyMobileSitesPage(page_module.Page):
def __init__(self, url, page_set, name='', tags=None):
def __init__(self, url, page_set, name='', tags=None,
extra_browser_args=None):
if name == '':
name = url
super(KeyMobileSitesPage, self).__init__(
url=url, page_set=page_set, name=name,
url=url,
page_set=page_set,
name=name,
shared_page_state_class=shared_page_state.SharedMobilePageState,
tags=tags)
tags=tags,
extra_browser_args=extra_browser_args)
class CapitolVolkswagenPage(KeyMobileSitesPage):
""" Why: Typical mobile business site """
def __init__(self, page_set, name=''):
def __init__(self, page_set, name='', extra_browser_args=None):
super(CapitolVolkswagenPage, self).__init__(
url=('http://iphone.capitolvolkswagen.com/index.htm'
url=(
'http://iphone.capitolvolkswagen.com/index.htm'
'#new-inventory_p_2Fsb-new_p_2Ehtm_p_3Freset_p_3DInventoryListing'),
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
def RunNavigateSteps(self, action_runner):
super(CapitolVolkswagenPage, self).RunNavigateSteps(action_runner)
......@@ -34,17 +39,17 @@ class CapitolVolkswagenPage(KeyMobileSitesPage):
'document.body.scrollHeight > 2560')
class TheVergeArticlePage(KeyMobileSitesPage):
""" Why: Top tech blog """
def __init__(self, page_set, name=''):
def __init__(self, page_set, name='', extra_browser_args=None):
super(TheVergeArticlePage, self).__init__(
# pylint: disable=line-too-long
url='http://www.theverge.com/2012/10/28/3568746/amazon-7-inch-fire-hd-ipad-mini-ad-ballsy',
url=
'http://www.theverge.com/2012/10/28/3568746/amazon-7-inch-fire-hd-ipad-mini-ad-ballsy',
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
def RunNavigateSteps(self, action_runner):
super(TheVergeArticlePage, self).RunNavigateSteps(action_runner)
......@@ -57,31 +62,31 @@ class TheVergeArticlePage(KeyMobileSitesPage):
class CnnArticlePage(KeyMobileSitesPage):
""" Why: Top news site """
def __init__(self, page_set, name=''):
def __init__(self, page_set, name='', extra_browser_args=None):
super(CnnArticlePage, self).__init__(
# pylint: disable=line-too-long
url='http://www.cnn.com/2012/10/03/politics/michelle-obama-debate/index.html',
url=
'http://www.cnn.com/2012/10/03/politics/michelle-obama-debate/index.html',
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
def RunNavigateSteps(self, action_runner):
super(CnnArticlePage, self).RunNavigateSteps(action_runner)
action_runner.Wait(8)
class FacebookPage(KeyMobileSitesPage):
""" Why: #1 (Alexa global) """
def __init__(self, page_set, name=''):
def __init__(self, page_set, name='', extra_browser_args=None):
super(FacebookPage, self).__init__(
url='https://facebook.com/barackobama',
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
def RunNavigateSteps(self, action_runner):
super(FacebookPage, self).RunNavigateSteps(action_runner)
......@@ -91,14 +96,14 @@ class FacebookPage(KeyMobileSitesPage):
class YoutubeMobilePage(KeyMobileSitesPage):
""" Why: #3 (Alexa global) """
def __init__(self, page_set, name=''):
def __init__(self, page_set, name='', extra_browser_args=None):
super(YoutubeMobilePage, self).__init__(
url='http://m.youtube.com/watch?v=9hBpF_Zj4OA',
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
def RunNavigateSteps(self, action_runner):
super(YoutubeMobilePage, self).RunNavigateSteps(action_runner)
......@@ -107,14 +112,14 @@ class YoutubeMobilePage(KeyMobileSitesPage):
class LinkedInPage(KeyMobileSitesPage):
""" Why: #12 (Alexa global),Public profile """
def __init__(self, page_set, name='LinkedIn'):
def __init__(self, page_set, name='LinkedIn', extra_browser_args=None):
super(LinkedInPage, self).__init__(
url='https://www.linkedin.com/in/linustorvalds',
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
def RunNavigateSteps(self, action_runner):
super(LinkedInPage, self).RunNavigateSteps(action_runner)
......@@ -122,17 +127,16 @@ class LinkedInPage(KeyMobileSitesPage):
'document.getElementById("profile-view-scroller") !== null')
class YahooAnswersPage(KeyMobileSitesPage):
""" Why: #1 Alexa reference """
def __init__(self, page_set, name=''):
def __init__(self, page_set, name='', extra_browser_args=None):
super(YahooAnswersPage, self).__init__(
# pylint: disable=line-too-long
url='http://answers.yahoo.com/question/index?qid=20110117024343AAopj8f',
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
def RunNavigateSteps(self, action_runner):
super(YahooAnswersPage, self).RunNavigateSteps(action_runner)
......@@ -141,37 +145,36 @@ class YahooAnswersPage(KeyMobileSitesPage):
class GroupClonedPage(KeyMobileSitesPage):
""" Why: crbug.com/172906 """
def __init__(self, page_set, name=''):
def __init__(self, page_set, name='', extra_browser_args=None):
super(GroupClonedPage, self).__init__(
url='http://groupcloned.com',
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
def RunNavigateSteps(self, action_runner):
super(GroupClonedPage, self).RunNavigateSteps(action_runner)
action_runner.Wait(5)
action_runner.WaitForJavaScriptCondition('''
action_runner.WaitForJavaScriptCondition("""
document.getElementById("element-19") !== null &&
document.getElementById("element-19").contentDocument
.getElementById("element-22") !== null &&
document.getElementById("element-19").contentDocument
.getElementsByClassName(
"container list-item gc-list-item stretched").length !== 0''')
"container list-item gc-list-item stretched").length !== 0""")
class GroupClonedListImagesPage(KeyMobileSitesPage):
""" Why: crbug.com/172906 """
def __init__(self, page_set, name=''):
def __init__(self, page_set, name='', extra_browser_args=None):
super(GroupClonedListImagesPage, self).__init__(
url='http://groupcloned.com/test/list-images-variable/index.html',
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
def RunNavigateSteps(self, action_runner):
super(GroupClonedListImagesPage, self).RunNavigateSteps(action_runner)
......@@ -180,14 +183,14 @@ class GroupClonedListImagesPage(KeyMobileSitesPage):
class GoogleNewsMobilePage(KeyMobileSitesPage):
""" Why: Google News: accelerated scrolling version """
def __init__(self, page_set, name=''):
def __init__(self, page_set, name='', extra_browser_args=None):
super(GoogleNewsMobilePage, self).__init__(
url='http://mobile-news.sandbox.google.com/news/pt1',
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
def RunNavigateSteps(self, action_runner):
super(GoogleNewsMobilePage, self).RunNavigateSteps(action_runner)
......@@ -197,16 +200,16 @@ class GoogleNewsMobilePage(KeyMobileSitesPage):
class GoogleNewsMobile2Page(KeyMobileSitesPage):
"""
Why: Google News: this iOS version is slower than accelerated scrolling
"""
def __init__(self, page_set, name=''):
def __init__(self, page_set, name='', extra_browser_args=None):
super(GoogleNewsMobile2Page, self).__init__(
url='http://mobile-news.sandbox.google.com/news/pt0',
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
def RunNavigateSteps(self, action_runner):
super(GoogleNewsMobile2Page, self).RunNavigateSteps(action_runner)
......@@ -216,13 +219,13 @@ class GoogleNewsMobile2Page(KeyMobileSitesPage):
class AmazonNicolasCagePage(KeyMobileSitesPage):
"""
Why: #1 world commerce website by visits; #3 commerce in the US by time spent
"""
def __init__(self, page_set, name=''):
def __init__(self, page_set, name='', extra_browser_args=None):
super(AmazonNicolasCagePage, self).__init__(
url='http://www.amazon.com/gp/aw/s/ref=is_box_?k=nicolas+cage',
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
......@@ -14,22 +14,33 @@ def _IssueMarkerAndScroll(action_runner):
def _CreatePageClassWithSmoothInteractions(page_cls):
class DerivedSmoothPage(page_cls): # pylint: disable=no-init
def RunPageInteractions(self, action_runner):
_IssueMarkerAndScroll(action_runner)
return DerivedSmoothPage
class KeyMobileSitesSmoothPage(page_module.Page):
def __init__(self, url, page_set, name='', tags=None,
action_on_load_complete=False):
def __init__(self,
url,
page_set,
name='',
tags=None,
action_on_load_complete=False,
extra_browser_args=None):
if name == '':
name = url
super(KeyMobileSitesSmoothPage, self).__init__(
url=url, page_set=page_set, name=name, tags=tags,
shared_page_state_class=shared_page_state.SharedMobilePageState)
url=url,
page_set=page_set,
name=name,
tags=tags,
shared_page_state_class=shared_page_state.SharedMobilePageState,
extra_browser_args=extra_browser_args)
self.action_on_load_complete = action_on_load_complete
def RunPageInteractions(self, action_runner):
......@@ -41,8 +52,9 @@ class KeyMobileSitesSmoothPage(page_module.Page):
class LinkedInSmoothPage(key_mobile_sites_pages.LinkedInPage):
def __init__(self, page_set, name=''):
super(LinkedInSmoothPage, self).__init__(page_set=page_set, name=name)
def __init__(self, page_set, name='', extra_browser_args=None):
super(LinkedInSmoothPage, self).__init__(
page_set=page_set, name=name, extra_browser_args=extra_browser_args)
# Linkedin has expensive shader compilation so it can benefit from shader
# cache from reload.
......@@ -54,11 +66,13 @@ class LinkedInSmoothPage(key_mobile_sites_pages.LinkedInPage):
class WowwikiSmoothPage(KeyMobileSitesSmoothPage):
"""Why: Mobile wiki."""
def __init__(self, page_set, name=''):
def __init__(self, page_set, name='', extra_browser_args=None):
super(WowwikiSmoothPage, self).__init__(
url='http://www.wowwiki.com/World_of_Warcraft:_Mists_of_Pandaria',
page_set=page_set,
name=name)
name=name,
extra_browser_args=extra_browser_args)
# Wowwiki has expensive shader compilation so it can benefit from shader
# cache from reload.
......@@ -73,11 +87,11 @@ class GroupClonedSmoothPage(key_mobile_sites_pages.GroupClonedPage):
def RunPageInteractions(self, action_runner):
with action_runner.CreateGestureInteraction('ScrollAction'):
action_runner.ScrollPage(
distance_expr='''
distance_expr="""
Math.max(0, 1250 + document.getElementById("element-19")
.contentDocument
.getElementById("element-22")
.getBoundingClientRect().top);''',
.getBoundingClientRect().top);""",
use_touch=True)
......@@ -87,27 +101,26 @@ class GroupClonedListImagesPage(
def RunPageInteractions(self, action_runner):
with action_runner.CreateGestureInteraction('ScrollAction'):
action_runner.ScrollPage(
distance_expr='''
distance_expr="""
Math.max(0, 1250 +
document.getElementById("element-5")
.getBoundingClientRect().top);''',
.getBoundingClientRect().top);""",
use_touch=True)
class GoogleNewsMobile2SmoothPage(
key_mobile_sites_pages.GoogleNewsMobile2Page):
class GoogleNewsMobile2SmoothPage(key_mobile_sites_pages.GoogleNewsMobile2Page):
def RunPageInteractions(self, action_runner):
with action_runner.CreateGestureInteraction('ScrollAction'):
action_runner.ScrollElement(
element_function='document.getElementById(":5")',
distance_expr='''
distance_expr="""
Math.max(0, 2500 +
document.getElementById(':h').getBoundingClientRect().top)''',
document.getElementById(':h').getBoundingClientRect().top)""",
use_touch=True)
class AmazonNicolasCageSmoothPage(
key_mobile_sites_pages.AmazonNicolasCagePage):
class AmazonNicolasCageSmoothPage(key_mobile_sites_pages.AmazonNicolasCagePage):
def RunPageInteractions(self, action_runner):
with action_runner.CreateGestureInteraction('ScrollAction'):
......@@ -115,8 +128,8 @@ class AmazonNicolasCageSmoothPage(
selector='#search',
distance_expr='document.body.scrollHeight - window.innerHeight')
class CNNArticleSmoothPage(
key_mobile_sites_pages.CnnArticlePage):
class CNNArticleSmoothPage(key_mobile_sites_pages.CnnArticlePage):
def RunPageInteractions(self, action_runner):
with action_runner.CreateGestureInteraction('ScrollAction'):
......@@ -124,8 +137,8 @@ class CNNArticleSmoothPage(
# will not be in the root scroller.
action_runner.ScrollPage(top_start_ratio=0.01)
class KeyMobileSitesSmoothPageSet(story.StorySet):
class KeyMobileSitesSmoothPageSet(story.StorySet):
""" Key mobile sites with smooth interactions. """
def __init__(self):
......@@ -133,7 +146,6 @@ class KeyMobileSitesSmoothPageSet(story.StorySet):
archive_data_file='data/key_mobile_sites_smooth.json',
cloud_storage_bucket=story.PARTNER_BUCKET)
# Add pages with predefined classes that contain custom navigation logic.
predefined_page_classes = [
key_mobile_sites_pages.CapitolVolkswagenPage,
......@@ -144,8 +156,7 @@ class KeyMobileSitesSmoothPageSet(story.StorySet):
key_mobile_sites_pages.GoogleNewsMobilePage,
]
for page_class in predefined_page_classes:
self.AddStory(
_CreatePageClassWithSmoothInteractions(page_class)(self))
self.AddStory(_CreatePageClassWithSmoothInteractions(page_class)(self))
self.AddStory(
_CreatePageClassWithSmoothInteractions(LinkedInSmoothPage)(self))
......@@ -169,33 +180,41 @@ class KeyMobileSitesSmoothPageSet(story.StorySet):
# Add pages with custom tags.
# Why: Top news site.
self.AddStory(KeyMobileSitesSmoothPage(
self.AddStory(
KeyMobileSitesSmoothPage(
url='http://nytimes.com/', page_set=self, tags=['fastpath']))
# Why: Image-heavy site.
self.AddStory(KeyMobileSitesSmoothPage(
self.AddStory(
KeyMobileSitesSmoothPage(
url='http://cuteoverload.com', page_set=self, tags=['fastpath']))
# Why: #11 (Alexa global), google property; some blogger layouts
# have infinite scroll but more interesting.
self.AddStory(KeyMobileSitesSmoothPage(
self.AddStory(
KeyMobileSitesSmoothPage(
url='http://googlewebmastercentral.blogspot.com/',
page_set=self, name='Blogger'))
page_set=self,
name='Blogger'))
# Why: #18 (Alexa global), Picked an interesting post """
self.AddStory(KeyMobileSitesSmoothPage(
url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks-for-august-2012/',
self.AddStory(
KeyMobileSitesSmoothPage(
url=
'http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks-for-august-2012/',
page_set=self,
name='Wordpress'))
# Why: #6 (Alexa) most visited worldwide, picked an interesting page
self.AddStory(KeyMobileSitesSmoothPage(
self.AddStory(
KeyMobileSitesSmoothPage(
url='http://en.wikipedia.org/wiki/Wikipedia',
page_set=self,
name='Wikipedia_(1_tab)'))
# Why: Wikipedia page with a delayed scroll start
self.AddStory(KeyMobileSitesSmoothPage(
self.AddStory(
KeyMobileSitesSmoothPage(
url='http://en.wikipedia.org/wiki/Wikipedia',
page_set=self,
name='Wikipedia_(1_tab)-delayed_scroll_start',
......@@ -207,10 +226,9 @@ class KeyMobileSitesSmoothPageSet(story.StorySet):
# url='http://twitter.com/katyperry', page_set=self, name='Twitter'))
# Why: #37 (Alexa global) """
self.AddStory(KeyMobileSitesSmoothPage(
url='http://pinterest.com',
page_set=self,
name='Pinterest'))
self.AddStory(
KeyMobileSitesSmoothPage(
url='http://pinterest.com', page_set=self, name='Pinterest'))
# Why: #1 sports.
# Fails often; crbug.com/249722'
......@@ -221,17 +239,21 @@ class KeyMobileSitesSmoothPageSet(story.StorySet):
# self.AddStory(KeyMobileSitesSmoothPage(
# url='http://forecast.io', page_set=self))
# Why: crbug.com/169827
self.AddStory(KeyMobileSitesSmoothPage(
self.AddStory(
KeyMobileSitesSmoothPage(
url='http://slashdot.org/', page_set=self, tags=['fastpath']))
# Why: #5 Alexa news """
self.AddStory(KeyMobileSitesSmoothPage(
self.AddStory(
KeyMobileSitesSmoothPage(
url='http://www.reddit.com/r/programming/comments/1g96ve',
page_set=self, tags=['fastpath']))
page_set=self,
tags=['fastpath']))
# Why: Problematic use of fixed position elements """
self.AddStory(KeyMobileSitesSmoothPage(
self.AddStory(
KeyMobileSitesSmoothPage(
url='http://www.boingboing.net', page_set=self, tags=['fastpath']))
# Add simple pages with no custom navigation logic or tags.
......
......@@ -30,14 +30,15 @@ def _CreatePageClassWithSmoothInteractions(page_cls):
class TopSmoothPage(page_module.Page):
def __init__(self, url, page_set, name=''):
def __init__(self, url, page_set, name='', extra_browser_args=None):
if name == '':
name = url
super(TopSmoothPage, self).__init__(
url=url,
page_set=page_set,
name=name,
shared_page_state_class=shared_page_state.SharedDesktopPageState)
shared_page_state_class=shared_page_state.SharedDesktopPageState,
extra_browser_args=extra_browser_args)
def RunPageInteractions(self, action_runner):
action_runner.Wait(1)
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment