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 from telemetry.page import page as page_module | 4 from telemetry.page import page as page_module |
5 from telemetry.page import page_set as page_set_module | 5 from telemetry.page import page_set as page_set_module |
6 | 6 |
7 | 7 |
8 class KeyMobileSitesPage(page_module.Page): | 8 class KeyMobileSitesPage(page_module.Page): |
9 | 9 |
10 def __init__(self, url, page_set, name=''): | 10 def __init__(self, url, page_set, name='', labels=None): |
11 super(KeyMobileSitesPage, self).__init__( | 11 super(KeyMobileSitesPage, self).__init__( |
12 url=url, page_set=page_set, name=name, | 12 url=url, page_set=page_set, name=name, |
13 credentials_path='data/credentials.json') | 13 credentials_path='data/credentials.json', labels=labels) |
14 self.user_agent_type = 'mobile' | 14 self.user_agent_type = 'mobile' |
15 self.archive_data_file = 'data/key_mobile_sites.json' | 15 self.archive_data_file = 'data/key_mobile_sites.json' |
16 | 16 |
17 def RunSmoothness(self, action_runner): | 17 def RunSmoothness(self, action_runner): |
18 interaction = action_runner.BeginGestureInteraction( | 18 interaction = action_runner.BeginGestureInteraction( |
19 'ScrollAction', is_smooth=True) | 19 'ScrollAction', is_smooth=True) |
20 action_runner.ScrollPage() | 20 action_runner.ScrollPage() |
21 interaction.End() | 21 interaction.End() |
22 | 22 |
23 def RunRepaint(self, action_runner): | 23 def RunRepaint(self, action_runner): |
24 action_runner.RepaintContinuously(seconds=5) | 24 action_runner.RepaintContinuously(seconds=5) |
25 | 25 |
26 | 26 |
27 class Page1(KeyMobileSitesPage): | 27 class Page1(KeyMobileSitesPage): |
28 | 28 |
29 """ Why: Top news site """ | 29 """ Why: Top news site """ |
30 | 30 |
31 def __init__(self, page_set): | 31 def __init__(self, page_set): |
32 super(Page1, self).__init__( | 32 super(Page1, self).__init__( |
33 url='http://nytimes.com/', | 33 url='http://nytimes.com/', page_set=page_set, labels=['fastpath']) |
34 page_set=page_set) | |
35 | |
36 self.fastpath = True | |
37 | 34 |
38 | 35 |
39 class Page2(KeyMobileSitesPage): | 36 class Page2(KeyMobileSitesPage): |
40 | 37 |
41 """ Why: Typical mobile business site """ | 38 """ Why: Typical mobile business site """ |
42 | 39 |
43 def __init__(self, page_set): | 40 def __init__(self, page_set): |
44 super(Page2, self).__init__( | 41 super(Page2, self).__init__( |
45 url=('http://iphone.capitolvolkswagen.com/index.htm' | 42 url=('http://iphone.capitolvolkswagen.com/index.htm' |
46 '#new-inventory_p_2Fsb-new_p_2Ehtm_p_3Freset_p_3DInventoryListing'), | 43 '#new-inventory_p_2Fsb-new_p_2Ehtm_p_3Freset_p_3DInventoryListing'), |
47 page_set=page_set) | 44 page_set=page_set) |
48 | 45 |
49 def RunNavigateSteps(self, action_runner): | 46 def RunNavigateSteps(self, action_runner): |
50 action_runner.NavigateToPage(self) | 47 action_runner.NavigateToPage(self) |
51 action_runner.WaitForElement(text='Next 35') | 48 action_runner.WaitForElement(text='Next 35') |
52 action_runner.WaitForJavaScriptCondition( | 49 action_runner.WaitForJavaScriptCondition( |
53 'document.body.scrollHeight > 2560') | 50 'document.body.scrollHeight > 2560') |
54 | 51 |
55 | 52 |
56 class Page3(KeyMobileSitesPage): | 53 class Page3(KeyMobileSitesPage): |
57 | 54 |
58 """ Why: Image-heavy site """ | 55 """ Why: Image-heavy site """ |
59 | 56 |
60 def __init__(self, page_set): | 57 def __init__(self, page_set): |
61 super(Page3, self).__init__( | 58 super(Page3, self).__init__( |
62 url='http://cuteoverload.com', | 59 url='http://cuteoverload.com', page_set=page_set, labels=['fastpath']) |
63 page_set=page_set) | |
64 | |
65 self.fastpath = True | |
66 | 60 |
67 | 61 |
68 class Page4(KeyMobileSitesPage): | 62 class Page4(KeyMobileSitesPage): |
69 | 63 |
70 """ Why: Top tech blog """ | 64 """ Why: Top tech blog """ |
71 | 65 |
72 def __init__(self, page_set): | 66 def __init__(self, page_set): |
73 super(Page4, self).__init__( | 67 super(Page4, self).__init__( |
74 # pylint: disable=C0301 | 68 # pylint: disable=C0301 |
75 url='http://www.theverge.com/2012/10/28/3568746/amazon-7-inch-fire-hd-ipad
-mini-ad-ballsy', | 69 url='http://www.theverge.com/2012/10/28/3568746/amazon-7-inch-fire-hd-ipad
-mini-ad-ballsy', |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 interaction.End() | 275 interaction.End() |
282 | 276 |
283 | 277 |
284 class Page18(KeyMobileSitesPage): | 278 class Page18(KeyMobileSitesPage): |
285 | 279 |
286 """ Why: crbug.com/169827 """ | 280 """ Why: crbug.com/169827 """ |
287 | 281 |
288 def __init__(self, page_set): | 282 def __init__(self, page_set): |
289 super(Page18, self).__init__( | 283 super(Page18, self).__init__( |
290 url='http://slashdot.org/', | 284 url='http://slashdot.org/', |
291 page_set=page_set) | 285 page_set=page_set, labels=['fastpath']) |
292 | |
293 self.fastpath = True | |
294 | 286 |
295 | 287 |
296 class Page19(KeyMobileSitesPage): | 288 class Page19(KeyMobileSitesPage): |
297 | 289 |
298 """ Why: #5 Alexa news """ | 290 """ Why: #5 Alexa news """ |
299 | 291 |
300 def __init__(self, page_set): | 292 def __init__(self, page_set): |
301 super(Page19, self).__init__( | 293 super(Page19, self).__init__( |
302 url='http://www.reddit.com/r/programming/comments/1g96ve', | 294 url='http://www.reddit.com/r/programming/comments/1g96ve', |
303 page_set=page_set) | 295 page_set=page_set, labels=['fastpath']) |
304 | |
305 self.fastpath = True | |
306 | 296 |
307 | 297 |
308 class Page20(KeyMobileSitesPage): | 298 class Page20(KeyMobileSitesPage): |
309 | 299 |
310 """ Why: Problematic use of fixed position elements """ | 300 """ Why: Problematic use of fixed position elements """ |
311 | 301 |
312 def __init__(self, page_set): | 302 def __init__(self, page_set): |
313 super(Page20, self).__init__( | 303 super(Page20, self).__init__( |
314 url='http://www.boingboing.net', | 304 url='http://www.boingboing.net', page_set=page_set, labels=['fastpath']) |
315 page_set=page_set) | |
316 | |
317 self.fastpath = True | |
318 | 305 |
319 | 306 |
320 class Page21(KeyMobileSitesPage): | 307 class Page21(KeyMobileSitesPage): |
321 | 308 |
322 """ Why: crbug.com/172906 """ | 309 """ Why: crbug.com/172906 """ |
323 | 310 |
324 def __init__(self, page_set): | 311 def __init__(self, page_set): |
325 super(Page21, self).__init__( | 312 super(Page21, self).__init__( |
326 url='http://groupcloned.com', | 313 url='http://groupcloned.com', |
327 page_set=page_set) | 314 page_set=page_set) |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' | 525 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' |
539 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), | 526 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), |
540 # Why: Top search engine | 527 # Why: Top search engine |
541 'http://www.bing.com/search?q=sloths', | 528 'http://www.bing.com/search?q=sloths', |
542 # Why: Good example of poor initial scrolling | 529 # Why: Good example of poor initial scrolling |
543 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' | 530 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' |
544 ] | 531 ] |
545 | 532 |
546 for url in urls_list: | 533 for url in urls_list: |
547 self.AddPage(KeyMobileSitesPage(url, self)) | 534 self.AddPage(KeyMobileSitesPage(url, self)) |
OLD | NEW |