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 page_set
as page_set_module
7 from page_sets
import key_mobile_sites_pages
10 def _RepaintContinously(action_runner
):
11 action_runner
.RepaintContinuously(seconds
=5)
14 def _CreatePageClassWithRepaintInteractions(page_cls
):
15 class DerivedRepaintPage(page_cls
): # pylint: disable=W0232
17 def RunPageInteractions(self
, action_runner
):
18 _RepaintContinously(action_runner
)
19 return DerivedRepaintPage
22 class KeyMobileSitesRepaintPage(page_module
.Page
):
24 def __init__(self
, url
, page_set
, name
='', labels
=None):
25 super(KeyMobileSitesRepaintPage
, self
).__init
__(
26 url
=url
, page_set
=page_set
, name
=name
,
27 credentials_path
='data/credentials.json', labels
=labels
)
28 self
.user_agent_type
= 'mobile'
29 self
.archive_data_file
= 'data/key_mobile_sites_repaint.json'
31 def RunPageInteractions(self
, action_runner
):
32 _RepaintContinously(action_runner
)
35 class KeyMobileSitesRepaintPageSet(page_set_module
.PageSet
):
37 """ Key mobile sites with repaint interactions. """
40 super(KeyMobileSitesRepaintPageSet
, self
).__init
__(
41 user_agent_type
='mobile',
42 archive_data_file
='data/key_mobile_sites_repaint.json',
43 bucket
=page_set_module
.PARTNER_BUCKET
)
46 # Add pages with predefined classes that contain custom navigation logic.
47 predefined_page_classes
= [
48 key_mobile_sites_pages
.CapitolVolkswagenPage
,
49 key_mobile_sites_pages
.TheVergeArticlePage
,
50 key_mobile_sites_pages
.CnnArticlePage
,
51 key_mobile_sites_pages
.FacebookPage
,
52 key_mobile_sites_pages
.YoutubeMobilePage
,
53 key_mobile_sites_pages
.LinkedInPage
,
54 key_mobile_sites_pages
.YahooAnswersPage
,
55 key_mobile_sites_pages
.GmailPage
,
56 key_mobile_sites_pages
.GoogleNewsMobilePage
,
57 key_mobile_sites_pages
.GoogleNewsMobile2Page
,
58 key_mobile_sites_pages
.AmazonNicolasCagePage
,
59 # Page behaves non-deterministically, replaced with test version for now.
60 # key_mobile_sites_pages.GroupClonedPage,
62 # mean_input_event_latency cannot be tracked correctly for
63 # GroupClonedListImagesPage. See crbug.com/409086.
64 # key_mobile_sites_pages.GroupClonedListImagesPage,
66 for page_class
in predefined_page_classes
:
68 _CreatePageClassWithRepaintInteractions(page_class
)(self
))
70 # Add pages with custom labels.
73 self
.AddUserStory(KeyMobileSitesRepaintPage(
74 url
='http://nytimes.com/', page_set
=self
, labels
=['fastpath']))
76 # Why: Image-heavy site.
77 self
.AddUserStory(KeyMobileSitesRepaintPage(
78 url
='http://cuteoverload.com', page_set
=self
, labels
=['fastpath']))
80 # Why: #11 (Alexa global), google property; some blogger layouts
81 # have infinite scroll but more interesting.
82 self
.AddUserStory(KeyMobileSitesRepaintPage(
83 url
='http://googlewebmastercentral.blogspot.com/',
84 page_set
=self
, name
='Blogger'))
86 # Why: #18 (Alexa global), Picked an interesting post """
87 self
.AddUserStory(KeyMobileSitesRepaintPage(
88 # pylint: disable=line-too-long
89 url
='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks-for-august-2012/',
93 # Why: #6 (Alexa) most visited worldwide, picked an interesting page
94 self
.AddUserStory(KeyMobileSitesRepaintPage(
95 url
='http://en.wikipedia.org/wiki/Wikipedia',
97 name
='Wikipedia (1 tab)'))
100 # Why: #8 (Alexa global), picked an interesting page
101 # Forbidden (Rate Limit Exceeded)
102 # self.AddUserStory(KeyMobileSitesRepaintPage(
103 # url='http://twitter.com/katyperry', page_set=self, name='Twitter'))
105 # Why: #37 (Alexa global) """
106 self
.AddUserStory(KeyMobileSitesRepaintPage(
107 url
='http://pinterest.com',
112 # Fails often; crbug.com/249722'
113 # self.AddUserStory(KeyMobileSitesRepaintPage(
114 # url='http://espn.go.com', page_set=self, name='ESPN'))
115 # Why: crbug.com/231413
116 # Doesn't scroll; crbug.com/249736
117 # self.AddUserStory(KeyMobileSitesRepaintPage(
118 # url='http://forecast.io', page_set=self))
119 # Why: crbug.com/169827
120 self
.AddUserStory(KeyMobileSitesRepaintPage(
121 url
='http://slashdot.org/', page_set
=self
, labels
=['fastpath']))
123 # Why: #5 Alexa news """
125 self
.AddUserStory(KeyMobileSitesRepaintPage(
126 url
='http://www.reddit.com/r/programming/comments/1g96ve',
127 page_set
=self
, labels
=['fastpath']))
129 # Why: Problematic use of fixed position elements """
130 self
.AddUserStory(KeyMobileSitesRepaintPage(
131 url
='http://www.boingboing.net', page_set
=self
, labels
=['fastpath']))
133 # Add simple pages with no custom navigation logic or labels.
135 # Why: Social; top Google property; Public profile; infinite scrolls.
136 # pylint: disable=line-too-long
137 'https://plus.google.com/app/basic/110031535020051778989/posts?source=apppromo',
138 # Why: crbug.com/242544
139 ('http://www.androidpolice.com/2012/10/03/rumor-evidence-mounts-that-an-'
140 'lg-optimus-g-nexus-is-coming-along-with-a-nexus-phone-certification-'
142 # Why: crbug.com/149958
145 'http://theverge.com',
148 # Why: Top Google property; a Google tab is often open
149 'https://www.google.com/#hl=en&q=barack+obama',
150 # Why: #1 news worldwide (Alexa global)
151 'http://news.yahoo.com',
152 # Why: #2 news worldwide
153 'http://www.cnn.com',
154 # Why: #1 commerce website by time spent by users in US
155 'http://shop.mobileweb.ebay.com/searchresults?kw=viking+helmet',
156 # Why: #1 Alexa recreation
157 # pylint: disable=line-too-long
158 'http://www.booking.com/searchresults.html?src=searchresults&latitude=65.0500&longitude=25.4667',
159 # Why: #1 Alexa sports
160 'http://sports.yahoo.com/',
162 'http://techcrunch.com',
163 # Why: #6 Alexa sports
165 # Why: #14 Alexa California
166 'http://www.sfgate.com/',
167 # Why: Non-latin character set
168 'http://worldjournal.com/',
170 'http://www.wowwiki.com/World_of_Warcraft:_Mists_of_Pandaria',
171 # Why: #15 Alexa news
172 'http://online.wsj.com/home-page',
173 # Why: Image-heavy mobile site
174 'http://www.deviantart.com/',
175 # Why: Top search engine
176 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&'
177 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'),
178 # Why: Top search engine
179 'http://www.bing.com/search?q=sloths',
180 # Why: Good example of poor initial scrolling
181 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans'
184 for url
in urls_list
:
185 self
.AddUserStory(KeyMobileSitesRepaintPage(url
, self
))