Disable flaky AnimatedContentSamplerParameterizedTest.FrameTimestampsConvergeTowardsE...
[chromium-blink-merge.git] / tools / perf / page_sets / key_mobile_sites_smooth.py
blob8f557510f16a211297adb6f26c157ea00ff33f6f
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 _IssueMarkerAndScroll(action_runner):
11 with action_runner.CreateGestureInteraction('ScrollAction'):
12 action_runner.ScrollPage()
15 def _CreatePageClassWithSmoothInteractions(page_cls):
16 class DerivedSmoothPage(page_cls): # pylint: disable=W0232
18 def RunPageInteractions(self, action_runner):
19 _IssueMarkerAndScroll(action_runner)
20 return DerivedSmoothPage
23 class KeyMobileSitesSmoothPage(page_module.Page):
25 def __init__(self, url, page_set, name='', labels=None,
26 action_on_load_complete=False):
27 super(KeyMobileSitesSmoothPage, self).__init__(
28 url=url, page_set=page_set, name=name,
29 credentials_path='data/credentials.json', labels=labels)
30 self.user_agent_type = 'mobile'
31 self.archive_data_file = 'data/key_mobile_sites.json'
32 self.action_on_load_complete = action_on_load_complete
34 def RunPageInteractions(self, action_runner):
35 if self.action_on_load_complete:
36 action_runner.WaitForJavaScriptCondition(
37 'document.readyState == "complete"', 30)
38 _IssueMarkerAndScroll(action_runner)
41 class LinkedInSmoothPage(key_mobile_sites_pages.LinkedInPage):
43 def __init__(self, page_set):
44 super(LinkedInSmoothPage, self).__init__(page_set=page_set)
46 # Linkedin has expensive shader compilation so it can benefit from shader
47 # cache from reload.
48 def RunNavigateSteps(self, action_runner):
49 super(LinkedInSmoothPage, self).RunNavigateSteps(action_runner)
50 action_runner.ScrollPage()
51 action_runner.ReloadPage()
52 super(LinkedInSmoothPage, self).RunNavigateSteps(action_runner)
55 class WowwikiSmoothPage(KeyMobileSitesSmoothPage):
56 """Why: Mobile wiki."""
57 def __init__(self, page_set):
58 super(WowwikiSmoothPage, self).__init__(
59 url='http://www.wowwiki.com/World_of_Warcraft:_Mists_of_Pandaria',
60 page_set=page_set)
62 # Wowwiki has expensive shader compilation so it can benefit from shader
63 # cache from reload.
64 def RunNavigateSteps(self, action_runner):
65 super(WowwikiSmoothPage, self).RunNavigateSteps(action_runner)
66 action_runner.ScrollPage()
67 action_runner.ReloadPage()
68 super(WowwikiSmoothPage, self).RunNavigateSteps(action_runner)
71 class GmailSmoothPage(key_mobile_sites_pages.GmailPage):
73 def RunPageInteractions(self, action_runner):
74 with action_runner.CreateGestureInteraction('ScrollAction'):
75 action_runner.ScrollElement(element_function=(
76 'document.getElementById("views").childNodes[1].firstChild'))
77 with action_runner.CreateGestureInteraction('ScrollAction'):
78 action_runner.ScrollElement(element_function=(
79 'document.getElementById("views").childNodes[1].firstChild'))
82 class GroupClonedSmoothPage(key_mobile_sites_pages.GroupClonedPage):
84 def RunPageInteractions(self, action_runner):
85 with action_runner.CreateGestureInteraction('ScrollAction'):
86 action_runner.ScrollPage(
87 distance_expr='''
88 Math.max(0, 1250 + document.getElementById("element-19")
89 .contentDocument
90 .getElementById("element-22")
91 .getBoundingClientRect().top);''',
92 use_touch=True)
95 class GroupClonedListImagesPage(
96 key_mobile_sites_pages.GroupClonedListImagesPage):
98 def RunPageInteractions(self, action_runner):
99 with action_runner.CreateGestureInteraction('ScrollAction'):
100 action_runner.ScrollPage(
101 distance_expr='''
102 Math.max(0, 1250 +
103 document.getElementById("element-5")
104 .getBoundingClientRect().top);''',
105 use_touch=True)
107 class GoogleNewsMobile2SmoothPage(
108 key_mobile_sites_pages.GoogleNewsMobile2Page):
110 def RunPageInteractions(self, action_runner):
111 with action_runner.CreateGestureInteraction('ScrollAction'):
112 action_runner.ScrollElement(
113 element_function='document.getElementById(":5")',
114 distance_expr='''
115 Math.max(0, 2500 +
116 document.getElementById(':h').getBoundingClientRect().top)''',
117 use_touch=True)
120 class AmazonNicolasCageSmoothPage(
121 key_mobile_sites_pages.AmazonNicolasCagePage):
123 def RunPageInteractions(self, action_runner):
124 with action_runner.CreateGestureInteraction('ScrollAction'):
125 action_runner.ScrollElement(
126 selector='#search',
127 distance_expr='document.body.scrollHeight - window.innerHeight')
130 class KeyMobileSitesSmoothPageSet(page_set_module.PageSet):
132 """ Key mobile sites with smooth interactions. """
134 def __init__(self):
135 super(KeyMobileSitesSmoothPageSet, self).__init__(
136 user_agent_type='mobile',
137 archive_data_file='data/key_mobile_sites_smooth.json',
138 bucket=page_set_module.PARTNER_BUCKET)
141 # Add pages with predefined classes that contain custom navigation logic.
142 predefined_page_classes = [
143 key_mobile_sites_pages.CapitolVolkswagenPage,
144 key_mobile_sites_pages.TheVergeArticlePage,
145 key_mobile_sites_pages.CnnArticlePage,
146 key_mobile_sites_pages.FacebookPage,
147 key_mobile_sites_pages.YoutubeMobilePage,
148 key_mobile_sites_pages.YahooAnswersPage,
149 key_mobile_sites_pages.GoogleNewsMobilePage,
151 for page_class in predefined_page_classes:
152 self.AddUserStory(
153 _CreatePageClassWithSmoothInteractions(page_class)(self))
155 self.AddUserStory(
156 _CreatePageClassWithSmoothInteractions(LinkedInSmoothPage)(self))
157 self.AddUserStory(WowwikiSmoothPage(self))
159 # Add pages with custom page interaction logic.
161 # Page behaves non-deterministically, replaced with test version for now.
162 # self.AddUserStory(GroupClonedSmoothPage(self))
163 # mean_input_event_latency cannot be tracked correctly for
164 # GroupClonedListImagesPage.
165 # See crbug.com/409086.
166 # self.AddUserStory(GroupClonedListImagesSmoothPage(self))
167 self.AddUserStory(GoogleNewsMobile2SmoothPage(self))
168 self.AddUserStory(AmazonNicolasCageSmoothPage(self))
170 # Add pages with custom labels.
172 # Why: Top news site.
173 self.AddUserStory(KeyMobileSitesSmoothPage(
174 url='http://nytimes.com/', page_set=self, labels=['fastpath']))
176 # Why: Image-heavy site.
177 self.AddUserStory(KeyMobileSitesSmoothPage(
178 url='http://cuteoverload.com', page_set=self, labels=['fastpath']))
180 # Why: #11 (Alexa global), google property; some blogger layouts
181 # have infinite scroll but more interesting.
182 self.AddUserStory(KeyMobileSitesSmoothPage(
183 url='http://googlewebmastercentral.blogspot.com/',
184 page_set=self, name='Blogger'))
186 # Why: #18 (Alexa global), Picked an interesting post """
187 self.AddUserStory(KeyMobileSitesSmoothPage(
188 # pylint: disable=line-too-long
189 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks-for-august-2012/',
190 page_set=self,
191 name='Wordpress'))
193 # Why: #6 (Alexa) most visited worldwide, picked an interesting page
194 self.AddUserStory(KeyMobileSitesSmoothPage(
195 url='http://en.wikipedia.org/wiki/Wikipedia',
196 page_set=self,
197 name='Wikipedia (1 tab)'))
199 # Why: Wikipedia page with a delayed scroll start
200 self.AddUserStory(KeyMobileSitesSmoothPage(
201 url='http://en.wikipedia.org/wiki/Wikipedia',
202 page_set=self,
203 name='Wikipedia (1 tab) - delayed scroll start',
204 action_on_load_complete=True))
206 # Why: #8 (Alexa global), picked an interesting page
207 # Forbidden (Rate Limit Exceeded)
208 # self.AddUserStory(KeyMobileSitesSmoothPage(
209 # url='http://twitter.com/katyperry', page_set=self, name='Twitter'))
211 # Why: #37 (Alexa global) """
212 self.AddUserStory(KeyMobileSitesSmoothPage(
213 url='http://pinterest.com',
214 page_set=self,
215 name='Pinterest'))
217 # Why: #1 sports.
218 # Fails often; crbug.com/249722'
219 # self.AddUserStory(KeyMobileSitesSmoothPage(
220 # url='http://espn.go.com', page_set=self, name='ESPN'))
221 # Why: crbug.com/231413
222 # Doesn't scroll; crbug.com/249736
223 # self.AddUserStory(KeyMobileSitesSmoothPage(
224 # url='http://forecast.io', page_set=self))
225 # Why: crbug.com/169827
226 self.AddUserStory(KeyMobileSitesSmoothPage(
227 url='http://slashdot.org/', page_set=self, labels=['fastpath']))
229 # Why: #5 Alexa news """
231 self.AddUserStory(KeyMobileSitesSmoothPage(
232 url='http://www.reddit.com/r/programming/comments/1g96ve',
233 page_set=self, labels=['fastpath']))
235 # Why: Problematic use of fixed position elements """
236 self.AddUserStory(KeyMobileSitesSmoothPage(
237 url='http://www.boingboing.net', page_set=self, labels=['fastpath']))
239 # Add simple pages with no custom navigation logic or labels.
240 urls_list = [
241 # Why: Social; top Google property; Public profile; infinite scrolls.
242 # pylint: disable=line-too-long
243 'https://plus.google.com/app/basic/110031535020051778989/posts?source=apppromo',
244 # Why: crbug.com/242544
245 ('http://www.androidpolice.com/2012/10/03/rumor-evidence-mounts-that-an-'
246 'lg-optimus-g-nexus-is-coming-along-with-a-nexus-phone-certification-'
247 'program/'),
248 # Why: crbug.com/149958
249 'http://gsp.ro',
250 # Why: Top tech blog
251 'http://theverge.com',
252 # Why: Top tech site
253 'http://digg.com',
254 # Why: Top Google property; a Google tab is often open
255 'https://www.google.com/#hl=en&q=barack+obama',
256 # Why: #1 news worldwide (Alexa global)
257 'http://news.yahoo.com',
258 # Why: #2 news worldwide
259 'http://www.cnn.com',
260 # Why: #1 commerce website by time spent by users in US
261 'http://shop.mobileweb.ebay.com/searchresults?kw=viking+helmet',
262 # Why: #1 Alexa recreation
263 # pylint: disable=line-too-long
264 'http://www.booking.com/searchresults.html?src=searchresults&latitude=65.0500&longitude=25.4667',
265 # Why: Top tech blog
266 'http://techcrunch.com',
267 # Why: #6 Alexa sports
268 'http://mlb.com/',
269 # Why: #14 Alexa California
270 'http://www.sfgate.com/',
271 # Why: Non-latin character set
272 'http://worldjournal.com/',
273 # Why: #15 Alexa news
274 'http://online.wsj.com/home-page',
275 # Why: Image-heavy mobile site
276 'http://www.deviantart.com/',
277 # Why: Top search engine
278 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&'
279 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'),
280 # Why: Top search engine
281 'http://www.bing.com/search?q=sloths',
282 # Why: Good example of poor initial scrolling
283 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans'
286 for url in urls_list:
287 self.AddUserStory(KeyMobileSitesSmoothPage(url, self))