1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 from telemetry
.page
import page
as page_module
5 from telemetry
.page
import shared_page_state
6 from telemetry
import story
8 from page_sets
import key_mobile_sites_pages
9 from page_sets
import repaint_helpers
13 def _CreatePageClassWithRepaintInteractions(page_cls
, mode
, height
, width
):
14 class DerivedRepaintPage(page_cls
): # pylint: disable=W0232
16 def RunPageInteractions(self
, action_runner
):
17 repaint_helpers
.Repaint(
18 action_runner
, mode
=mode
, width
=width
, height
=height
)
20 return DerivedRepaintPage
23 class KeyMobileSitesRepaintPage(page_module
.Page
):
25 def __init__(self
, url
, page_set
, mode
, height
, width
, name
='', labels
=None):
26 super(KeyMobileSitesRepaintPage
, self
).__init
__(
27 url
=url
, page_set
=page_set
, name
=name
,
28 shared_page_state_class
=shared_page_state
.SharedMobilePageState
,
29 credentials_path
='data/credentials.json', labels
=labels
)
30 self
.archive_data_file
= 'data/key_mobile_sites_repaint.json'
35 def RunPageInteractions(self
, action_runner
):
36 repaint_helpers
.Repaint(
37 action_runner
, mode
=self
._mode
, width
=self
._width
, height
=self
._height
)
40 class KeyMobileSitesRepaintPageSet(story
.StorySet
):
42 """ Key mobile sites with repaint interactions. """
44 def __init__(self
, mode
='viewport', width
=None, height
=None):
45 super(KeyMobileSitesRepaintPageSet
, self
).__init
__(
46 archive_data_file
='data/key_mobile_sites_repaint.json',
47 cloud_storage_bucket
=story
.PARTNER_BUCKET
)
50 # Add pages with predefined classes that contain custom navigation logic.
51 predefined_page_classes
= [
52 key_mobile_sites_pages
.CapitolVolkswagenPage
,
53 key_mobile_sites_pages
.TheVergeArticlePage
,
54 key_mobile_sites_pages
.CnnArticlePage
,
55 key_mobile_sites_pages
.FacebookPage
,
56 key_mobile_sites_pages
.YoutubeMobilePage
,
57 key_mobile_sites_pages
.LinkedInPage
,
58 key_mobile_sites_pages
.YahooAnswersPage
,
59 key_mobile_sites_pages
.GmailPage
,
60 key_mobile_sites_pages
.GoogleNewsMobilePage
,
61 key_mobile_sites_pages
.GoogleNewsMobile2Page
,
62 key_mobile_sites_pages
.AmazonNicolasCagePage
,
63 # Page behaves non-deterministically, replaced with test version for now.
64 # key_mobile_sites_pages.GroupClonedPage,
66 # mean_input_event_latency cannot be tracked correctly for
67 # GroupClonedListImagesPage. See crbug.com/409086.
68 # key_mobile_sites_pages.GroupClonedListImagesPage,
70 for page_class
in predefined_page_classes
:
72 _CreatePageClassWithRepaintInteractions(
73 page_class
, mode
=mode
, height
=height
, width
=width
)(self
))
75 # Add pages with custom labels.
78 self
.AddStory(KeyMobileSitesRepaintPage(
79 url
='http://nytimes.com/', page_set
=self
, labels
=['fastpath'],
80 mode
=mode
, height
=height
, width
=width
))
82 # Why: Image-heavy site.
83 self
.AddStory(KeyMobileSitesRepaintPage(
84 url
='http://cuteoverload.com', page_set
=self
, labels
=['fastpath'],
85 mode
=mode
, height
=height
, width
=width
))
87 # Why: #11 (Alexa global), google property; some blogger layouts
88 # have infinite scroll but more interesting.
89 self
.AddStory(KeyMobileSitesRepaintPage(
90 url
='http://googlewebmastercentral.blogspot.com/',
91 page_set
=self
, name
='Blogger', mode
=mode
, height
=height
, width
=width
))
93 # Why: #18 (Alexa global), Picked an interesting post """
94 self
.AddStory(KeyMobileSitesRepaintPage(
95 # pylint: disable=line-too-long
96 url
='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks-for-august-2012/',
98 name
='Wordpress', mode
=mode
, height
=height
, width
=width
))
100 # Why: #6 (Alexa) most visited worldwide, picked an interesting page
101 self
.AddStory(KeyMobileSitesRepaintPage(
102 url
='http://en.wikipedia.org/wiki/Wikipedia',
104 name
='Wikipedia (1 tab)', mode
=mode
, height
=height
, width
=width
))
106 # Why: #8 (Alexa global), picked an interesting page
107 # Forbidden (Rate Limit Exceeded)
108 # self.AddStory(KeyMobileSitesRepaintPage(
109 # url='http://twitter.com/katyperry', page_set=self, name='Twitter'))
111 # Why: #37 (Alexa global) """
112 self
.AddStory(KeyMobileSitesRepaintPage(
113 url
='http://pinterest.com',
115 name
='Pinterest', mode
=mode
, height
=height
, width
=width
))
118 # Fails often; crbug.com/249722'
119 # self.AddStory(KeyMobileSitesRepaintPage(
120 # url='http://espn.go.com', page_set=self, name='ESPN'))
121 # Why: crbug.com/231413
122 # Doesn't scroll; crbug.com/249736
123 # self.AddStory(KeyMobileSitesRepaintPage(
124 # url='http://forecast.io', page_set=self))
125 # Why: crbug.com/169827
126 self
.AddStory(KeyMobileSitesRepaintPage(
127 url
='http://slashdot.org/', page_set
=self
, labels
=['fastpath'],
128 mode
=mode
, width
=width
, height
=height
))
130 # Why: #5 Alexa news """
132 self
.AddStory(KeyMobileSitesRepaintPage(
133 url
='http://www.reddit.com/r/programming/comments/1g96ve',
134 page_set
=self
, labels
=['fastpath'],
135 mode
=mode
, width
=width
, height
=height
))
137 # Why: Problematic use of fixed position elements """
138 self
.AddStory(KeyMobileSitesRepaintPage(
139 url
='http://www.boingboing.net', page_set
=self
, labels
=['fastpath'],
140 mode
=mode
, width
=width
, height
=height
))
142 # Add simple pages with no custom navigation logic or labels.
144 # Why: Social; top Google property; Public profile; infinite scrolls.
145 # pylint: disable=line-too-long
146 'https://plus.google.com/app/basic/110031535020051778989/posts?source=apppromo',
147 # Why: crbug.com/242544
148 ('http://www.androidpolice.com/2012/10/03/rumor-evidence-mounts-that-an-'
149 'lg-optimus-g-nexus-is-coming-along-with-a-nexus-phone-certification-'
151 # Why: crbug.com/149958
154 'http://theverge.com',
157 # Why: Top Google property; a Google tab is often open
158 'https://www.google.com/#hl=en&q=barack+obama',
159 # Why: #1 news worldwide (Alexa global)
160 'http://news.yahoo.com',
161 # Why: #2 news worldwide
162 'http://www.cnn.com',
163 # Why: #1 commerce website by time spent by users in US
164 'http://shop.mobileweb.ebay.com/searchresults?kw=viking+helmet',
165 # Why: #1 Alexa recreation
166 # pylint: disable=line-too-long
167 'http://www.booking.com/searchresults.html?src=searchresults&latitude=65.0500&longitude=25.4667',
168 # Why: #1 Alexa sports
169 'http://sports.yahoo.com/',
171 'http://techcrunch.com',
172 # Why: #6 Alexa sports
174 # Why: #14 Alexa California
175 'http://www.sfgate.com/',
176 # Why: Non-latin character set
177 'http://worldjournal.com/',
179 'http://www.wowwiki.com/World_of_Warcraft:_Mists_of_Pandaria',
180 # Why: #15 Alexa news
181 'http://online.wsj.com/home-page',
182 # Why: Image-heavy mobile site
183 'http://www.deviantart.com/',
184 # Why: Top search engine
185 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&'
186 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'),
187 # Why: Top search engine
188 'http://www.bing.com/search?q=sloths',
189 # Why: Good example of poor initial scrolling
190 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans'
193 for url
in urls_list
:
194 self
.AddStory(KeyMobileSitesRepaintPage(
195 url
, self
, mode
=mode
, height
=height
, width
=width
))