OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 | 39 |
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.RunAction(NavigateAction()) | 49 action_runner.NavigateToPage(self) |
50 action_runner.RunAction(WaitAction( | 50 action_runner.RunAction(WaitAction( |
51 { | 51 { |
52 'text': 'Next 35', | 52 'text': 'Next 35', |
53 'condition': 'element' | 53 'condition': 'element' |
54 })) | 54 })) |
55 action_runner.RunAction(WaitAction( | 55 action_runner.RunAction(WaitAction( |
56 { | 56 { |
57 'javascript': 'document.body.scrollHeight > 2560' | 57 'javascript': 'document.body.scrollHeight > 2560' |
58 })) | 58 })) |
59 | 59 |
(...skipping 14 matching lines...) Expand all Loading... |
74 | 74 |
75 """ Why: Top tech blog """ | 75 """ Why: Top tech blog """ |
76 | 76 |
77 def __init__(self, page_set): | 77 def __init__(self, page_set): |
78 super(Page4, self).__init__( | 78 super(Page4, self).__init__( |
79 # pylint: disable=C0301 | 79 # pylint: disable=C0301 |
80 url='http://www.theverge.com/2012/10/28/3568746/amazon-7-inch-fire-hd-ipad
-mini-ad-ballsy', | 80 url='http://www.theverge.com/2012/10/28/3568746/amazon-7-inch-fire-hd-ipad
-mini-ad-ballsy', |
81 page_set=page_set) | 81 page_set=page_set) |
82 | 82 |
83 def RunNavigateSteps(self, action_runner): | 83 def RunNavigateSteps(self, action_runner): |
84 action_runner.RunAction(NavigateAction()) | 84 action_runner.NavigateToPage(self) |
85 action_runner.RunAction(WaitAction( | 85 action_runner.RunAction(WaitAction( |
86 { | 86 { |
87 'javascript': ('window.Chorus !== undefined &&' | 87 'javascript': ('window.Chorus !== undefined &&' |
88 'window.Chorus.Comments !== undefined &&' | 88 'window.Chorus.Comments !== undefined &&' |
89 'window.Chorus.Comments.Json !== undefined &&' | 89 'window.Chorus.Comments.Json !== undefined &&' |
90 '(window.Chorus.Comments.loaded ||' | 90 '(window.Chorus.Comments.loaded ||' |
91 ' window.Chorus.Comments.Json.load_comments())') | 91 ' window.Chorus.Comments.Json.load_comments())') |
92 })) | 92 })) |
93 | 93 |
94 | 94 |
95 class Page5(KeyMobileSitesPage): | 95 class Page5(KeyMobileSitesPage): |
96 | 96 |
97 """ Why: Top news site """ | 97 """ Why: Top news site """ |
98 | 98 |
99 def __init__(self, page_set): | 99 def __init__(self, page_set): |
100 super(Page5, self).__init__( | 100 super(Page5, self).__init__( |
101 # pylint: disable=C0301 | 101 # pylint: disable=C0301 |
102 url='http://www.cnn.com/2012/10/03/politics/michelle-obama-debate/index.ht
ml', | 102 url='http://www.cnn.com/2012/10/03/politics/michelle-obama-debate/index.ht
ml', |
103 page_set=page_set) | 103 page_set=page_set) |
104 | 104 |
105 def RunNavigateSteps(self, action_runner): | 105 def RunNavigateSteps(self, action_runner): |
106 action_runner.RunAction(NavigateAction()) | 106 action_runner.NavigateToPage(self) |
107 action_runner.RunAction(WaitAction({'seconds': 8})) | 107 action_runner.RunAction(WaitAction({'seconds': 8})) |
108 | 108 |
109 | 109 |
110 class Page6(KeyMobileSitesPage): | 110 class Page6(KeyMobileSitesPage): |
111 | 111 |
112 """ Why: Social; top Google property; Public profile; infinite scrolls """ | 112 """ Why: Social; top Google property; Public profile; infinite scrolls """ |
113 | 113 |
114 def __init__(self, page_set): | 114 def __init__(self, page_set): |
115 super(Page6, self).__init__( | 115 super(Page6, self).__init__( |
116 # pylint: disable=C0301 | 116 # pylint: disable=C0301 |
117 url='https://plus.google.com/app/basic/110031535020051778989/posts?source=
apppromo', | 117 url='https://plus.google.com/app/basic/110031535020051778989/posts?source=
apppromo', |
118 page_set=page_set) | 118 page_set=page_set) |
119 | 119 |
120 def RunSmoothness(self, action_runner): | 120 def RunSmoothness(self, action_runner): |
121 action_runner.RunAction(ScrollAction({'scroll_is_infinite': True})) | 121 action_runner.RunAction(ScrollAction({'scroll_is_infinite': True})) |
122 | 122 |
123 | 123 |
124 class Page7(KeyMobileSitesPage): | 124 class Page7(KeyMobileSitesPage): |
125 | 125 |
126 """ Why: #1 (Alexa global) """ | 126 """ Why: #1 (Alexa global) """ |
127 | 127 |
128 def __init__(self, page_set): | 128 def __init__(self, page_set): |
129 super(Page7, self).__init__( | 129 super(Page7, self).__init__( |
130 url='https://facebook.com/barackobama', | 130 url='https://facebook.com/barackobama', |
131 page_set=page_set) | 131 page_set=page_set) |
132 | 132 |
133 def RunNavigateSteps(self, action_runner): | 133 def RunNavigateSteps(self, action_runner): |
134 action_runner.RunAction(NavigateAction()) | 134 action_runner.NavigateToPage(self) |
135 action_runner.RunAction(WaitAction( | 135 action_runner.RunAction(WaitAction( |
136 { | 136 { |
137 'javascript': ('document.getElementById("u_0_c") !== null &&' | 137 'javascript': ('document.getElementById("u_0_c") !== null &&' |
138 'document.body.scrollHeight > window.innerHeight') | 138 'document.body.scrollHeight > window.innerHeight') |
139 })) | 139 })) |
140 | 140 |
141 | 141 |
142 class Page8(KeyMobileSitesPage): | 142 class Page8(KeyMobileSitesPage): |
143 | 143 |
144 """ Why: #3 (Alexa global) """ | 144 """ Why: #3 (Alexa global) """ |
145 | 145 |
146 def __init__(self, page_set): | 146 def __init__(self, page_set): |
147 super(Page8, self).__init__( | 147 super(Page8, self).__init__( |
148 url='http://m.youtube.com/watch?v=9hBpF_Zj4OA', | 148 url='http://m.youtube.com/watch?v=9hBpF_Zj4OA', |
149 page_set=page_set) | 149 page_set=page_set) |
150 | 150 |
151 def RunNavigateSteps(self, action_runner): | 151 def RunNavigateSteps(self, action_runner): |
152 action_runner.RunAction(NavigateAction()) | 152 action_runner.NavigateToPage(self) |
153 action_runner.RunAction(WaitAction( | 153 action_runner.RunAction(WaitAction( |
154 { | 154 { |
155 'javascript': 'document.getElementById("paginatortarget") !== null' | 155 'javascript': 'document.getElementById("paginatortarget") !== null' |
156 })) | 156 })) |
157 | 157 |
158 | 158 |
159 class Page9(KeyMobileSitesPage): | 159 class Page9(KeyMobileSitesPage): |
160 | 160 |
161 """ | 161 """ |
162 Why: #11 (Alexa global), google property; some blogger layouts have infinite | 162 Why: #11 (Alexa global), google property; some blogger layouts have infinite |
(...skipping 23 matching lines...) Expand all Loading... |
186 | 186 |
187 """ Why: #12 (Alexa global),Public profile """ | 187 """ Why: #12 (Alexa global),Public profile """ |
188 | 188 |
189 def __init__(self, page_set): | 189 def __init__(self, page_set): |
190 super(Page11, self).__init__( | 190 super(Page11, self).__init__( |
191 url='https://www.linkedin.com/in/linustorvalds', | 191 url='https://www.linkedin.com/in/linustorvalds', |
192 page_set=page_set, | 192 page_set=page_set, |
193 name='LinkedIn') | 193 name='LinkedIn') |
194 | 194 |
195 def RunNavigateSteps(self, action_runner): | 195 def RunNavigateSteps(self, action_runner): |
196 action_runner.RunAction(NavigateAction()) | 196 action_runner.NavigateToPage(self) |
197 action_runner.RunAction(WaitAction( | 197 action_runner.RunAction(WaitAction( |
198 { | 198 { |
199 'javascript': | 199 'javascript': |
200 'document.getElementById("profile-view-scroller") !== null' | 200 'document.getElementById("profile-view-scroller") !== null' |
201 })) | 201 })) |
202 | 202 |
203 | 203 |
204 class Page12(KeyMobileSitesPage): | 204 class Page12(KeyMobileSitesPage): |
205 | 205 |
206 """ Why: #6 (Alexa) most visited worldwide, picked an interesting page """ | 206 """ Why: #6 (Alexa) most visited worldwide, picked an interesting page """ |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 """ Why: #1 Alexa reference """ | 252 """ Why: #1 Alexa reference """ |
253 | 253 |
254 def __init__(self, page_set): | 254 def __init__(self, page_set): |
255 super(Page16, self).__init__( | 255 super(Page16, self).__init__( |
256 # pylint: disable=C0301 | 256 # pylint: disable=C0301 |
257 url='http://answers.yahoo.com/question/index?qid=20110117024343AAopj8f', | 257 url='http://answers.yahoo.com/question/index?qid=20110117024343AAopj8f', |
258 page_set=page_set) | 258 page_set=page_set) |
259 | 259 |
260 def RunNavigateSteps(self, action_runner): | 260 def RunNavigateSteps(self, action_runner): |
261 action_runner.RunAction(NavigateAction()) | 261 action_runner.NavigateToPage(self) |
262 action_runner.RunAction(WaitAction( | 262 action_runner.RunAction(WaitAction( |
263 { | 263 { |
264 'text': 'Other Answers (1 - 20 of 149)', | 264 'text': 'Other Answers (1 - 20 of 149)', |
265 'condition': 'element' | 265 'condition': 'element' |
266 })) | 266 })) |
267 action_runner.RunAction(ClickElementAction( | 267 action_runner.RunAction(ClickElementAction( |
268 { | 268 { |
269 'text': 'Other Answers (1 - 20 of 149)' | 269 'text': 'Other Answers (1 - 20 of 149)' |
270 })) | 270 })) |
271 | 271 |
272 | 272 |
273 class Page17(KeyMobileSitesPage): | 273 class Page17(KeyMobileSitesPage): |
274 | 274 |
275 """ Why: productivity, top google properties """ | 275 """ Why: productivity, top google properties """ |
276 | 276 |
277 def __init__(self, page_set): | 277 def __init__(self, page_set): |
278 super(Page17, self).__init__( | 278 super(Page17, self).__init__( |
279 url='https://mail.google.com/mail/', | 279 url='https://mail.google.com/mail/', |
280 page_set=page_set) | 280 page_set=page_set) |
281 | 281 |
282 self.credentials = 'google' | 282 self.credentials = 'google' |
283 | 283 |
284 def RunNavigateSteps(self, action_runner): | 284 def RunNavigateSteps(self, action_runner): |
285 action_runner.RunAction(NavigateAction()) | 285 action_runner.NavigateToPage(self) |
286 action_runner.RunAction(WaitAction( | 286 action_runner.RunAction(WaitAction( |
287 { | 287 { |
288 'javascript': 'document.getElementById("og_user_warning") !== null' | 288 'javascript': 'document.getElementById("og_user_warning") !== null' |
289 })) | 289 })) |
290 action_runner.RunAction(WaitAction( | 290 action_runner.RunAction(WaitAction( |
291 { | 291 { |
292 'javascript': 'document.getElementById("og_user_warning") === null' | 292 'javascript': 'document.getElementById("og_user_warning") === null' |
293 })) | 293 })) |
294 | 294 |
295 def RunSmoothness(self, action_runner): | 295 def RunSmoothness(self, action_runner): |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 351 |
352 def __init__(self, page_set): | 352 def __init__(self, page_set): |
353 super(Page21, self).__init__( | 353 super(Page21, self).__init__( |
354 url='http://groupcloned.com', | 354 url='http://groupcloned.com', |
355 page_set=page_set) | 355 page_set=page_set) |
356 | 356 |
357 self.disabled = ('Page behaves non-deterministically, replaced with test' | 357 self.disabled = ('Page behaves non-deterministically, replaced with test' |
358 'version for now') | 358 'version for now') |
359 | 359 |
360 def RunNavigateSteps(self, action_runner): | 360 def RunNavigateSteps(self, action_runner): |
361 action_runner.RunAction(NavigateAction()) | 361 action_runner.NavigateToPage(self) |
362 action_runner.RunAction(WaitAction({'seconds': 5})) | 362 action_runner.RunAction(WaitAction({'seconds': 5})) |
363 action_runner.RunAction(WaitAction( | 363 action_runner.RunAction(WaitAction( |
364 { | 364 { |
365 'javascript': ''' | 365 'javascript': ''' |
366 document.getElementById("element-19") !== null && | 366 document.getElementById("element-19") !== null && |
367 document.getElementById("element-19").contentDocument | 367 document.getElementById("element-19").contentDocument |
368 .getElementById("element-22") !== null && | 368 .getElementById("element-22") !== null && |
369 document.getElementById("element-19").contentDocument | 369 document.getElementById("element-19").contentDocument |
370 .getElementsByClassName( | 370 .getElementsByClassName( |
371 "container list-item gc-list-item stretched").length !== 0''' | 371 "container list-item gc-list-item stretched").length !== 0''' |
(...skipping 16 matching lines...) Expand all Loading... |
388 class Page22(KeyMobileSitesPage): | 388 class Page22(KeyMobileSitesPage): |
389 | 389 |
390 """ Why: crbug.com/172906 """ | 390 """ Why: crbug.com/172906 """ |
391 | 391 |
392 def __init__(self, page_set): | 392 def __init__(self, page_set): |
393 super(Page22, self).__init__( | 393 super(Page22, self).__init__( |
394 url='http://groupcloned.com/test/list-images-variable/index.html', | 394 url='http://groupcloned.com/test/list-images-variable/index.html', |
395 page_set=page_set) | 395 page_set=page_set) |
396 | 396 |
397 def RunNavigateSteps(self, action_runner): | 397 def RunNavigateSteps(self, action_runner): |
398 action_runner.RunAction(NavigateAction()) | 398 action_runner.NavigateToPage(self) |
399 action_runner.RunAction(WaitAction( | 399 action_runner.RunAction(WaitAction( |
400 { | 400 { |
401 'javascript': 'document.getElementById("element-5") !== null' | 401 'javascript': 'document.getElementById("element-5") !== null' |
402 })) | 402 })) |
403 | 403 |
404 def RunSmoothness(self, action_runner): | 404 def RunSmoothness(self, action_runner): |
405 action_runner.RunAction(ScrollAction( | 405 action_runner.RunAction(ScrollAction( |
406 { | 406 { |
407 'scroll_distance_function': ''' | 407 'scroll_distance_function': ''' |
408 function() { | 408 function() { |
(...skipping 19 matching lines...) Expand all Loading... |
428 class Page24(KeyMobileSitesPage): | 428 class Page24(KeyMobileSitesPage): |
429 | 429 |
430 """ Why: Google News: accelerated scrolling version """ | 430 """ Why: Google News: accelerated scrolling version """ |
431 | 431 |
432 def __init__(self, page_set): | 432 def __init__(self, page_set): |
433 super(Page24, self).__init__( | 433 super(Page24, self).__init__( |
434 url='http://mobile-news.sandbox.google.com/news/pt1', | 434 url='http://mobile-news.sandbox.google.com/news/pt1', |
435 page_set=page_set) | 435 page_set=page_set) |
436 | 436 |
437 def RunNavigateSteps(self, action_runner): | 437 def RunNavigateSteps(self, action_runner): |
438 action_runner.RunAction(NavigateAction()) | 438 action_runner.NavigateToPage(self) |
439 action_runner.RunAction(WaitAction( | 439 action_runner.RunAction(WaitAction( |
440 { | 440 { |
441 'javascript': ('typeof NEWS_telemetryReady !== "undefined" && ' | 441 'javascript': ('typeof NEWS_telemetryReady !== "undefined" && ' |
442 'NEWS_telemetryReady == true') | 442 'NEWS_telemetryReady == true') |
443 })) | 443 })) |
444 | 444 |
445 | 445 |
446 class Page25(KeyMobileSitesPage): | 446 class Page25(KeyMobileSitesPage): |
447 | 447 |
448 """ | 448 """ |
449 Why: Google News: this iOS version is slower than accelerated scrolling | 449 Why: Google News: this iOS version is slower than accelerated scrolling |
450 """ | 450 """ |
451 | 451 |
452 def __init__(self, page_set): | 452 def __init__(self, page_set): |
453 super(Page25, self).__init__( | 453 super(Page25, self).__init__( |
454 url='http://mobile-news.sandbox.google.com/news/pt0', | 454 url='http://mobile-news.sandbox.google.com/news/pt0', |
455 page_set=page_set) | 455 page_set=page_set) |
456 | 456 |
457 def RunNavigateSteps(self, action_runner): | 457 def RunNavigateSteps(self, action_runner): |
458 action_runner.RunAction(NavigateAction()) | 458 action_runner.NavigateToPage(self) |
459 action_runner.RunAction(WaitAction( | 459 action_runner.RunAction(WaitAction( |
460 { | 460 { |
461 'javascript': 'document.getElementById(":h") != null' | 461 'javascript': 'document.getElementById(":h") != null' |
462 })) | 462 })) |
463 action_runner.RunAction(WaitAction( | 463 action_runner.RunAction(WaitAction( |
464 { | 464 { |
465 'seconds': 1 | 465 'seconds': 1 |
466 })) | 466 })) |
467 | 467 |
468 def RunSmoothness(self, action_runner): | 468 def RunSmoothness(self, action_runner): |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 'http://www.deviantart.com/', | 583 'http://www.deviantart.com/', |
584 # Why: Top search engine | 584 # Why: Top search engine |
585 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' | 585 ('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'), | 586 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), |
587 # Why: Top search engine | 587 # Why: Top search engine |
588 'http://www.bing.com/search?q=sloths' | 588 'http://www.bing.com/search?q=sloths' |
589 ] | 589 ] |
590 | 590 |
591 for url in urls_list: | 591 for url in urls_list: |
592 self.AddPage(KeyMobileSitesPage(url, self)) | 592 self.AddPage(KeyMobileSitesPage(url, self)) |
OLD | NEW |