Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: tools/perf/page_sets/key_mobile_sites.py

Issue 321563003: Add Wait* API to ActionRunner to wrap over WaitAction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing to head. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/perf/page_sets/key_desktop_sites.py ('k') | tools/perf/page_sets/key_silk_cases.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 # pylint: disable=W0401,W0614 4 # pylint: disable=W0401,W0614
5 from telemetry.page.actions.all_page_actions import * 5 from telemetry.page.actions.all_page_actions import *
6 from telemetry.page import page as page_module 6 from telemetry.page import page as page_module
7 from telemetry.page import page_set as page_set_module 7 from telemetry.page import page_set as page_set_module
8 8
9 9
10 class KeyMobileSitesPage(page_module.Page): 10 class KeyMobileSitesPage(page_module.Page):
(...skipping 29 matching lines...) Expand all
40 """ Why: Typical mobile business site """ 40 """ Why: Typical mobile business site """
41 41
42 def __init__(self, page_set): 42 def __init__(self, page_set):
43 super(Page2, self).__init__( 43 super(Page2, self).__init__(
44 url=('http://iphone.capitolvolkswagen.com/index.htm' 44 url=('http://iphone.capitolvolkswagen.com/index.htm'
45 '#new-inventory_p_2Fsb-new_p_2Ehtm_p_3Freset_p_3DInventoryListing'), 45 '#new-inventory_p_2Fsb-new_p_2Ehtm_p_3Freset_p_3DInventoryListing'),
46 page_set=page_set) 46 page_set=page_set)
47 47
48 def RunNavigateSteps(self, action_runner): 48 def RunNavigateSteps(self, action_runner):
49 action_runner.NavigateToPage(self) 49 action_runner.NavigateToPage(self)
50 action_runner.RunAction(WaitAction( 50 action_runner.WaitForElement(text='Next 35')
51 { 51 action_runner.WaitForJavaScriptCondition(
52 'text': 'Next 35', 52 'document.body.scrollHeight > 2560')
53 'condition': 'element'
54 }))
55 action_runner.RunAction(WaitAction(
56 {
57 'javascript': 'document.body.scrollHeight > 2560'
58 }))
59 53
60 54
61 class Page3(KeyMobileSitesPage): 55 class Page3(KeyMobileSitesPage):
62 56
63 """ Why: Image-heavy site """ 57 """ Why: Image-heavy site """
64 58
65 def __init__(self, page_set): 59 def __init__(self, page_set):
66 super(Page3, self).__init__( 60 super(Page3, self).__init__(
67 url='http://cuteoverload.com', 61 url='http://cuteoverload.com',
68 page_set=page_set) 62 page_set=page_set)
69 63
70 self.fastpath = True 64 self.fastpath = True
71 65
72 66
73 class Page4(KeyMobileSitesPage): 67 class Page4(KeyMobileSitesPage):
74 68
75 """ Why: Top tech blog """ 69 """ Why: Top tech blog """
76 70
77 def __init__(self, page_set): 71 def __init__(self, page_set):
78 super(Page4, self).__init__( 72 super(Page4, self).__init__(
79 # pylint: disable=C0301 73 # pylint: disable=C0301
80 url='http://www.theverge.com/2012/10/28/3568746/amazon-7-inch-fire-hd-ipad -mini-ad-ballsy', 74 url='http://www.theverge.com/2012/10/28/3568746/amazon-7-inch-fire-hd-ipad -mini-ad-ballsy',
81 page_set=page_set) 75 page_set=page_set)
82 76
83 def RunNavigateSteps(self, action_runner): 77 def RunNavigateSteps(self, action_runner):
84 action_runner.NavigateToPage(self) 78 action_runner.NavigateToPage(self)
85 action_runner.RunAction(WaitAction( 79 action_runner.WaitForJavaScriptCondition(
86 { 80 'window.Chorus !== undefined &&'
87 'javascript': ('window.Chorus !== undefined &&' 81 'window.Chorus.Comments !== undefined &&'
88 'window.Chorus.Comments !== undefined &&' 82 'window.Chorus.Comments.Json !== undefined &&'
89 'window.Chorus.Comments.Json !== undefined &&' 83 '(window.Chorus.Comments.loaded ||'
90 '(window.Chorus.Comments.loaded ||' 84 ' window.Chorus.Comments.Json.load_comments())')
91 ' window.Chorus.Comments.Json.load_comments())')
92 }))
93 85
94 86
95 class Page5(KeyMobileSitesPage): 87 class Page5(KeyMobileSitesPage):
96 88
97 """ Why: Top news site """ 89 """ Why: Top news site """
98 90
99 def __init__(self, page_set): 91 def __init__(self, page_set):
100 super(Page5, self).__init__( 92 super(Page5, self).__init__(
101 # pylint: disable=C0301 93 # pylint: disable=C0301
102 url='http://www.cnn.com/2012/10/03/politics/michelle-obama-debate/index.ht ml', 94 url='http://www.cnn.com/2012/10/03/politics/michelle-obama-debate/index.ht ml',
103 page_set=page_set) 95 page_set=page_set)
104 96
105 def RunNavigateSteps(self, action_runner): 97 def RunNavigateSteps(self, action_runner):
106 action_runner.NavigateToPage(self) 98 action_runner.NavigateToPage(self)
107 action_runner.RunAction(WaitAction({'seconds': 8})) 99 action_runner.Wait(8)
108 100
109 101
110 class Page6(KeyMobileSitesPage): 102 class Page6(KeyMobileSitesPage):
111 103
112 """ Why: Social; top Google property; Public profile; infinite scrolls """ 104 """ Why: Social; top Google property; Public profile; infinite scrolls """
113 105
114 def __init__(self, page_set): 106 def __init__(self, page_set):
115 super(Page6, self).__init__( 107 super(Page6, self).__init__(
116 # pylint: disable=C0301 108 # pylint: disable=C0301
117 url='https://plus.google.com/app/basic/110031535020051778989/posts?source= apppromo', 109 url='https://plus.google.com/app/basic/110031535020051778989/posts?source= apppromo',
118 page_set=page_set) 110 page_set=page_set)
119 111
120 def RunSmoothness(self, action_runner): 112 def RunSmoothness(self, action_runner):
121 action_runner.RunAction(ScrollAction({'scroll_is_infinite': True})) 113 action_runner.RunAction(ScrollAction({'scroll_is_infinite': True}))
122 114
123 115
124 class Page7(KeyMobileSitesPage): 116 class Page7(KeyMobileSitesPage):
125 117
126 """ Why: #1 (Alexa global) """ 118 """ Why: #1 (Alexa global) """
127 119
128 def __init__(self, page_set): 120 def __init__(self, page_set):
129 super(Page7, self).__init__( 121 super(Page7, self).__init__(
130 url='https://facebook.com/barackobama', 122 url='https://facebook.com/barackobama',
131 page_set=page_set) 123 page_set=page_set)
132 124
133 def RunNavigateSteps(self, action_runner): 125 def RunNavigateSteps(self, action_runner):
134 action_runner.NavigateToPage(self) 126 action_runner.NavigateToPage(self)
135 action_runner.RunAction(WaitAction( 127 action_runner.WaitForJavaScriptCondition(
136 { 128 'document.getElementById("u_0_c") !== null &&'
137 'javascript': ('document.getElementById("u_0_c") !== null &&' 129 'document.body.scrollHeight > window.innerHeight')
138 'document.body.scrollHeight > window.innerHeight')
139 }))
140 130
141 131
142 class Page8(KeyMobileSitesPage): 132 class Page8(KeyMobileSitesPage):
143 133
144 """ Why: #3 (Alexa global) """ 134 """ Why: #3 (Alexa global) """
145 135
146 def __init__(self, page_set): 136 def __init__(self, page_set):
147 super(Page8, self).__init__( 137 super(Page8, self).__init__(
148 url='http://m.youtube.com/watch?v=9hBpF_Zj4OA', 138 url='http://m.youtube.com/watch?v=9hBpF_Zj4OA',
149 page_set=page_set) 139 page_set=page_set)
150 140
151 def RunNavigateSteps(self, action_runner): 141 def RunNavigateSteps(self, action_runner):
152 action_runner.NavigateToPage(self) 142 action_runner.NavigateToPage(self)
153 action_runner.RunAction(WaitAction( 143 action_runner.WaitForJavaScriptCondition(
154 { 144 'document.getElementById("paginatortarget") !== null')
155 'javascript': 'document.getElementById("paginatortarget") !== null'
156 }))
157 145
158 146
159 class Page9(KeyMobileSitesPage): 147 class Page9(KeyMobileSitesPage):
160 148
161 """ 149 """
162 Why: #11 (Alexa global), google property; some blogger layouts have infinite 150 Why: #11 (Alexa global), google property; some blogger layouts have infinite
163 scroll but more interesting 151 scroll but more interesting
164 """ 152 """
165 153
166 def __init__(self, page_set): 154 def __init__(self, page_set):
(...skipping 20 matching lines...) Expand all
187 """ Why: #12 (Alexa global),Public profile """ 175 """ Why: #12 (Alexa global),Public profile """
188 176
189 def __init__(self, page_set): 177 def __init__(self, page_set):
190 super(Page11, self).__init__( 178 super(Page11, self).__init__(
191 url='https://www.linkedin.com/in/linustorvalds', 179 url='https://www.linkedin.com/in/linustorvalds',
192 page_set=page_set, 180 page_set=page_set,
193 name='LinkedIn') 181 name='LinkedIn')
194 182
195 def RunNavigateSteps(self, action_runner): 183 def RunNavigateSteps(self, action_runner):
196 action_runner.NavigateToPage(self) 184 action_runner.NavigateToPage(self)
197 action_runner.RunAction(WaitAction( 185 action_runner.WaitForJavaScriptCondition(
198 { 186 'document.getElementById("profile-view-scroller") !== null')
199 'javascript':
200 'document.getElementById("profile-view-scroller") !== null'
201 }))
202 187
203 188
204 class Page12(KeyMobileSitesPage): 189 class Page12(KeyMobileSitesPage):
205 190
206 """ Why: #6 (Alexa) most visited worldwide, picked an interesting page """ 191 """ Why: #6 (Alexa) most visited worldwide, picked an interesting page """
207 192
208 def __init__(self, page_set): 193 def __init__(self, page_set):
209 super(Page12, self).__init__( 194 super(Page12, self).__init__(
210 url='http://en.wikipedia.org/wiki/Wikipedia', 195 url='http://en.wikipedia.org/wiki/Wikipedia',
211 page_set=page_set, 196 page_set=page_set,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 """ Why: #1 Alexa reference """ 237 """ Why: #1 Alexa reference """
253 238
254 def __init__(self, page_set): 239 def __init__(self, page_set):
255 super(Page16, self).__init__( 240 super(Page16, self).__init__(
256 # pylint: disable=C0301 241 # pylint: disable=C0301
257 url='http://answers.yahoo.com/question/index?qid=20110117024343AAopj8f', 242 url='http://answers.yahoo.com/question/index?qid=20110117024343AAopj8f',
258 page_set=page_set) 243 page_set=page_set)
259 244
260 def RunNavigateSteps(self, action_runner): 245 def RunNavigateSteps(self, action_runner):
261 action_runner.NavigateToPage(self) 246 action_runner.NavigateToPage(self)
262 action_runner.RunAction(WaitAction( 247 action_runner.WaitForElement(text='Other Answers (1 - 20 of 149)')
263 {
264 'text': 'Other Answers (1 - 20 of 149)',
265 'condition': 'element'
266 }))
267 action_runner.RunAction(ClickElementAction( 248 action_runner.RunAction(ClickElementAction(
268 { 249 {
269 'text': 'Other Answers (1 - 20 of 149)' 250 'text': 'Other Answers (1 - 20 of 149)'
270 })) 251 }))
271 252
272 253
273 class Page17(KeyMobileSitesPage): 254 class Page17(KeyMobileSitesPage):
274 255
275 """ Why: productivity, top google properties """ 256 """ Why: productivity, top google properties """
276 257
277 def __init__(self, page_set): 258 def __init__(self, page_set):
278 super(Page17, self).__init__( 259 super(Page17, self).__init__(
279 url='https://mail.google.com/mail/', 260 url='https://mail.google.com/mail/',
280 page_set=page_set) 261 page_set=page_set)
281 262
282 self.credentials = 'google' 263 self.credentials = 'google'
283 264
284 def RunNavigateSteps(self, action_runner): 265 def RunNavigateSteps(self, action_runner):
285 action_runner.NavigateToPage(self) 266 action_runner.NavigateToPage(self)
286 action_runner.RunAction(WaitAction( 267 action_runner.WaitForJavaScriptCondition(
287 { 268 'document.getElementById("og_user_warning") !== null')
288 'javascript': 'document.getElementById("og_user_warning") !== null' 269 action_runner.WaitForJavaScriptCondition(
289 })) 270 'document.getElementById("og_user_warning") === null')
290 action_runner.RunAction(WaitAction(
291 {
292 'javascript': 'document.getElementById("og_user_warning") === null'
293 }))
294 271
295 def RunSmoothness(self, action_runner): 272 def RunSmoothness(self, action_runner):
296 action_runner.RunAction(ScrollAction( 273 action_runner.RunAction(ScrollAction(
297 { 274 {
298 'scrollable_element_function': 275 'scrollable_element_function':
299 ('function(callback) {' 276 ('function(callback) {'
300 'callback(document.getElementById("views")' 277 'callback(document.getElementById("views")'
301 '.childNodes[1].firstChild); }') 278 '.childNodes[1].firstChild); }')
302 })) 279 }))
303 action_runner.RunAction(ScrollAction( 280 action_runner.RunAction(ScrollAction(
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 def __init__(self, page_set): 329 def __init__(self, page_set):
353 super(Page21, self).__init__( 330 super(Page21, self).__init__(
354 url='http://groupcloned.com', 331 url='http://groupcloned.com',
355 page_set=page_set) 332 page_set=page_set)
356 333
357 self.disabled = ('Page behaves non-deterministically, replaced with test' 334 self.disabled = ('Page behaves non-deterministically, replaced with test'
358 'version for now') 335 'version for now')
359 336
360 def RunNavigateSteps(self, action_runner): 337 def RunNavigateSteps(self, action_runner):
361 action_runner.NavigateToPage(self) 338 action_runner.NavigateToPage(self)
362 action_runner.RunAction(WaitAction({'seconds': 5})) 339 action_runner.Wait(5)
363 action_runner.RunAction(WaitAction( 340 action_runner.WaitForJavaScriptCondition('''
364 { 341 document.getElementById("element-19") !== null &&
365 'javascript': ''' 342 document.getElementById("element-19").contentDocument
366 document.getElementById("element-19") !== null && 343 .getElementById("element-22") !== null &&
367 document.getElementById("element-19").contentDocument 344 document.getElementById("element-19").contentDocument
368 .getElementById("element-22") !== null && 345 .getElementsByClassName(
369 document.getElementById("element-19").contentDocument 346 "container list-item gc-list-item stretched").length !== 0''')
370 .getElementsByClassName(
371 "container list-item gc-list-item stretched").length !== 0'''
372 }))
373 347
374 def RunSmoothness(self, action_runner): 348 def RunSmoothness(self, action_runner):
375 action_runner.RunAction(ScrollAction( 349 action_runner.RunAction(ScrollAction(
376 { 350 {
377 'scroll_distance_function': ''' 351 'scroll_distance_function': '''
378 function() { 352 function() {
379 return Math.max(0, 1250 + document.getElementById("element-19") 353 return Math.max(0, 1250 + document.getElementById("element-19")
380 .contentDocument 354 .contentDocument
381 .getElementById("element-22") 355 .getElementById("element-22")
382 .getBoundingClientRect().top); 356 .getBoundingClientRect().top);
383 }''', 357 }''',
384 'scroll_requires_touch': True 358 'scroll_requires_touch': True
385 })) 359 }))
386 360
387 361
388 class Page22(KeyMobileSitesPage): 362 class Page22(KeyMobileSitesPage):
389 363
390 """ Why: crbug.com/172906 """ 364 """ Why: crbug.com/172906 """
391 365
392 def __init__(self, page_set): 366 def __init__(self, page_set):
393 super(Page22, self).__init__( 367 super(Page22, self).__init__(
394 url='http://groupcloned.com/test/list-images-variable/index.html', 368 url='http://groupcloned.com/test/list-images-variable/index.html',
395 page_set=page_set) 369 page_set=page_set)
396 370
397 def RunNavigateSteps(self, action_runner): 371 def RunNavigateSteps(self, action_runner):
398 action_runner.NavigateToPage(self) 372 action_runner.NavigateToPage(self)
399 action_runner.RunAction(WaitAction( 373 action_runner.WaitForJavaScriptCondition(
400 { 374 'document.getElementById("element-5") !== null')
401 'javascript': 'document.getElementById("element-5") !== null'
402 }))
403 375
404 def RunSmoothness(self, action_runner): 376 def RunSmoothness(self, action_runner):
405 action_runner.RunAction(ScrollAction( 377 action_runner.RunAction(ScrollAction(
406 { 378 {
407 'scroll_distance_function': ''' 379 'scroll_distance_function': '''
408 function() { 380 function() {
409 return Math.max(0, 1250 + 381 return Math.max(0, 1250 +
410 document.getElementById("element-5").getBoundingClientRect().top); 382 document.getElementById("element-5").getBoundingClientRect().top);
411 }''', 383 }''',
412 'scroll_requires_touch': True 384 'scroll_requires_touch': True
(...skipping 16 matching lines...) Expand all
429 401
430 """ Why: Google News: accelerated scrolling version """ 402 """ Why: Google News: accelerated scrolling version """
431 403
432 def __init__(self, page_set): 404 def __init__(self, page_set):
433 super(Page24, self).__init__( 405 super(Page24, self).__init__(
434 url='http://mobile-news.sandbox.google.com/news/pt1', 406 url='http://mobile-news.sandbox.google.com/news/pt1',
435 page_set=page_set) 407 page_set=page_set)
436 408
437 def RunNavigateSteps(self, action_runner): 409 def RunNavigateSteps(self, action_runner):
438 action_runner.NavigateToPage(self) 410 action_runner.NavigateToPage(self)
439 action_runner.RunAction(WaitAction( 411 action_runner.WaitForJavaScriptCondition(
440 { 412 'typeof NEWS_telemetryReady !== "undefined" && '
441 'javascript': ('typeof NEWS_telemetryReady !== "undefined" && ' 413 'NEWS_telemetryReady == true')
442 'NEWS_telemetryReady == true')
443 }))
444 414
445 415
446 class Page25(KeyMobileSitesPage): 416 class Page25(KeyMobileSitesPage):
447 417
448 """ 418 """
449 Why: Google News: this iOS version is slower than accelerated scrolling 419 Why: Google News: this iOS version is slower than accelerated scrolling
450 """ 420 """
451 421
452 def __init__(self, page_set): 422 def __init__(self, page_set):
453 super(Page25, self).__init__( 423 super(Page25, self).__init__(
454 url='http://mobile-news.sandbox.google.com/news/pt0', 424 url='http://mobile-news.sandbox.google.com/news/pt0',
455 page_set=page_set) 425 page_set=page_set)
456 426
457 def RunNavigateSteps(self, action_runner): 427 def RunNavigateSteps(self, action_runner):
458 action_runner.NavigateToPage(self) 428 action_runner.NavigateToPage(self)
459 action_runner.RunAction(WaitAction( 429 action_runner.WaitForJavaScriptCondition(
460 { 430 'document.getElementById(":h") != null')
461 'javascript': 'document.getElementById(":h") != null' 431 action_runner.Wait(1)
462 }))
463 action_runner.RunAction(WaitAction(
464 {
465 'seconds': 1
466 }))
467 432
468 def RunSmoothness(self, action_runner): 433 def RunSmoothness(self, action_runner):
469 action_runner.RunAction(ScrollAction( 434 action_runner.RunAction(ScrollAction(
470 { 435 {
471 'scroll_requires_touch': True, 436 'scroll_requires_touch': True,
472 'scrollable_element_function': ''' 437 'scrollable_element_function': '''
473 function(callback) { 438 function(callback) {
474 callback(document.getElementById(':5')); 439 callback(document.getElementById(':5'));
475 }''', 440 }''',
476 'scroll_distance_function': ''' 441 'scroll_distance_function': '''
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 'http://www.deviantart.com/', 548 'http://www.deviantart.com/',
584 # Why: Top search engine 549 # Why: Top search engine
585 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' 550 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&'
586 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), 551 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'),
587 # Why: Top search engine 552 # Why: Top search engine
588 'http://www.bing.com/search?q=sloths' 553 'http://www.bing.com/search?q=sloths'
589 ] 554 ]
590 555
591 for url in urls_list: 556 for url in urls_list:
592 self.AddPage(KeyMobileSitesPage(url, self)) 557 self.AddPage(KeyMobileSitesPage(url, self))
OLDNEW
« no previous file with comments | « tools/perf/page_sets/key_desktop_sites.py ('k') | tools/perf/page_sets/key_silk_cases.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698