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 from page_sets import key_mobile_sites_pages | 7 from page_sets import key_mobile_sites_pages |
| 8 from page_sets import repaint_helpers |
8 | 9 |
9 | 10 |
10 def _RepaintContinously(action_runner): | |
11 with action_runner.CreateInteraction('Repaint'): | |
12 action_runner.RepaintContinuously(seconds=5) | |
13 | 11 |
14 | 12 def _CreatePageClassWithRepaintInteractions(page_cls, mode, height, width): |
15 def _CreatePageClassWithRepaintInteractions(page_cls): | |
16 class DerivedRepaintPage(page_cls): # pylint: disable=W0232 | 13 class DerivedRepaintPage(page_cls): # pylint: disable=W0232 |
17 | 14 |
18 def RunPageInteractions(self, action_runner): | 15 def RunPageInteractions(self, action_runner): |
19 _RepaintContinously(action_runner) | 16 repaint_helpers.Repaint( |
| 17 action_runner, mode=mode, width=width, height=height) |
| 18 |
20 return DerivedRepaintPage | 19 return DerivedRepaintPage |
21 | 20 |
22 | 21 |
23 class KeyMobileSitesRepaintPage(page_module.Page): | 22 class KeyMobileSitesRepaintPage(page_module.Page): |
24 | 23 |
25 def __init__(self, url, page_set, name='', labels=None): | 24 def __init__(self, url, page_set, mode, height, width, name='', labels=None): |
26 super(KeyMobileSitesRepaintPage, self).__init__( | 25 super(KeyMobileSitesRepaintPage, self).__init__( |
27 url=url, page_set=page_set, name=name, | 26 url=url, page_set=page_set, name=name, |
28 credentials_path='data/credentials.json', labels=labels) | 27 credentials_path='data/credentials.json', labels=labels) |
29 self.user_agent_type = 'mobile' | 28 self.user_agent_type = 'mobile' |
30 self.archive_data_file = 'data/key_mobile_sites_repaint.json' | 29 self.archive_data_file = 'data/key_mobile_sites_repaint.json' |
| 30 self._mode = mode |
| 31 self._width = width |
| 32 self._height = height |
31 | 33 |
32 def RunPageInteractions(self, action_runner): | 34 def RunPageInteractions(self, action_runner): |
33 _RepaintContinously(action_runner) | 35 repaint_helpers.Repaint( |
| 36 action_runner, mode=self._mode, width=self._width, height=self._height) |
34 | 37 |
35 | 38 |
36 class KeyMobileSitesRepaintPageSet(page_set_module.PageSet): | 39 class KeyMobileSitesRepaintPageSet(page_set_module.PageSet): |
37 | 40 |
38 """ Key mobile sites with repaint interactions. """ | 41 """ Key mobile sites with repaint interactions. """ |
39 | 42 |
40 def __init__(self): | 43 def __init__(self, mode='viewport', width=None, height=None): |
41 super(KeyMobileSitesRepaintPageSet, self).__init__( | 44 super(KeyMobileSitesRepaintPageSet, self).__init__( |
42 user_agent_type='mobile', | 45 user_agent_type='mobile', |
43 archive_data_file='data/key_mobile_sites_repaint.json', | 46 archive_data_file='data/key_mobile_sites_repaint.json', |
44 bucket=page_set_module.PARTNER_BUCKET) | 47 bucket=page_set_module.PARTNER_BUCKET) |
45 | 48 |
46 | 49 |
47 # Add pages with predefined classes that contain custom navigation logic. | 50 # Add pages with predefined classes that contain custom navigation logic. |
48 predefined_page_classes = [ | 51 predefined_page_classes = [ |
49 key_mobile_sites_pages.CapitolVolkswagenPage, | 52 key_mobile_sites_pages.CapitolVolkswagenPage, |
50 key_mobile_sites_pages.TheVergeArticlePage, | 53 key_mobile_sites_pages.TheVergeArticlePage, |
51 key_mobile_sites_pages.CnnArticlePage, | 54 key_mobile_sites_pages.CnnArticlePage, |
52 key_mobile_sites_pages.FacebookPage, | 55 key_mobile_sites_pages.FacebookPage, |
53 key_mobile_sites_pages.YoutubeMobilePage, | 56 key_mobile_sites_pages.YoutubeMobilePage, |
54 key_mobile_sites_pages.LinkedInPage, | 57 key_mobile_sites_pages.LinkedInPage, |
55 key_mobile_sites_pages.YahooAnswersPage, | 58 key_mobile_sites_pages.YahooAnswersPage, |
56 key_mobile_sites_pages.GmailPage, | 59 key_mobile_sites_pages.GmailPage, |
57 key_mobile_sites_pages.GoogleNewsMobilePage, | 60 key_mobile_sites_pages.GoogleNewsMobilePage, |
58 key_mobile_sites_pages.GoogleNewsMobile2Page, | 61 key_mobile_sites_pages.GoogleNewsMobile2Page, |
59 key_mobile_sites_pages.AmazonNicolasCagePage, | 62 key_mobile_sites_pages.AmazonNicolasCagePage, |
60 # Page behaves non-deterministically, replaced with test version for now. | 63 # Page behaves non-deterministically, replaced with test version for now. |
61 # key_mobile_sites_pages.GroupClonedPage, | 64 # key_mobile_sites_pages.GroupClonedPage, |
62 | 65 |
63 # mean_input_event_latency cannot be tracked correctly for | 66 # mean_input_event_latency cannot be tracked correctly for |
64 # GroupClonedListImagesPage. See crbug.com/409086. | 67 # GroupClonedListImagesPage. See crbug.com/409086. |
65 # key_mobile_sites_pages.GroupClonedListImagesPage, | 68 # key_mobile_sites_pages.GroupClonedListImagesPage, |
66 ] | 69 ] |
67 for page_class in predefined_page_classes: | 70 for page_class in predefined_page_classes: |
68 self.AddUserStory( | 71 self.AddUserStory( |
69 _CreatePageClassWithRepaintInteractions(page_class)(self)) | 72 _CreatePageClassWithRepaintInteractions( |
| 73 page_class, mode=mode, height=height, width=width)(self)) |
70 | 74 |
71 # Add pages with custom labels. | 75 # Add pages with custom labels. |
72 | 76 |
73 # Why: Top news site. | 77 # Why: Top news site. |
74 self.AddUserStory(KeyMobileSitesRepaintPage( | 78 self.AddUserStory(KeyMobileSitesRepaintPage( |
75 url='http://nytimes.com/', page_set=self, labels=['fastpath'])) | 79 url='http://nytimes.com/', page_set=self, labels=['fastpath'], |
| 80 mode=mode, height=height, width=width)) |
76 | 81 |
77 # Why: Image-heavy site. | 82 # Why: Image-heavy site. |
78 self.AddUserStory(KeyMobileSitesRepaintPage( | 83 self.AddUserStory(KeyMobileSitesRepaintPage( |
79 url='http://cuteoverload.com', page_set=self, labels=['fastpath'])) | 84 url='http://cuteoverload.com', page_set=self, labels=['fastpath'], |
| 85 mode=mode, height=height, width=width)) |
80 | 86 |
81 # Why: #11 (Alexa global), google property; some blogger layouts | 87 # Why: #11 (Alexa global), google property; some blogger layouts |
82 # have infinite scroll but more interesting. | 88 # have infinite scroll but more interesting. |
83 self.AddUserStory(KeyMobileSitesRepaintPage( | 89 self.AddUserStory(KeyMobileSitesRepaintPage( |
84 url='http://googlewebmastercentral.blogspot.com/', | 90 url='http://googlewebmastercentral.blogspot.com/', |
85 page_set=self, name='Blogger')) | 91 page_set=self, name='Blogger', mode=mode, height=height, width=width)) |
86 | 92 |
87 # Why: #18 (Alexa global), Picked an interesting post """ | 93 # Why: #18 (Alexa global), Picked an interesting post """ |
88 self.AddUserStory(KeyMobileSitesRepaintPage( | 94 self.AddUserStory(KeyMobileSitesRepaintPage( |
89 # pylint: disable=line-too-long | 95 # pylint: disable=line-too-long |
90 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks
-for-august-2012/', | 96 url='http://en.blog.wordpress.com/2012/09/04/freshly-pressed-editors-picks
-for-august-2012/', |
91 page_set=self, | 97 page_set=self, |
92 name='Wordpress')) | 98 name='Wordpress', mode=mode, height=height, width=width)) |
93 | 99 |
94 # Why: #6 (Alexa) most visited worldwide, picked an interesting page | 100 # Why: #6 (Alexa) most visited worldwide, picked an interesting page |
95 self.AddUserStory(KeyMobileSitesRepaintPage( | 101 self.AddUserStory(KeyMobileSitesRepaintPage( |
96 url='http://en.wikipedia.org/wiki/Wikipedia', | 102 url='http://en.wikipedia.org/wiki/Wikipedia', |
97 page_set=self, | 103 page_set=self, |
98 name='Wikipedia (1 tab)')) | 104 name='Wikipedia (1 tab)', mode=mode, height=height, width=width)) |
99 | |
100 | 105 |
101 # Why: #8 (Alexa global), picked an interesting page | 106 # Why: #8 (Alexa global), picked an interesting page |
102 # Forbidden (Rate Limit Exceeded) | 107 # Forbidden (Rate Limit Exceeded) |
103 # self.AddUserStory(KeyMobileSitesRepaintPage( | 108 # self.AddUserStory(KeyMobileSitesRepaintPage( |
104 # url='http://twitter.com/katyperry', page_set=self, name='Twitter')) | 109 # url='http://twitter.com/katyperry', page_set=self, name='Twitter')) |
105 | 110 |
106 # Why: #37 (Alexa global) """ | 111 # Why: #37 (Alexa global) """ |
107 self.AddUserStory(KeyMobileSitesRepaintPage( | 112 self.AddUserStory(KeyMobileSitesRepaintPage( |
108 url='http://pinterest.com', | 113 url='http://pinterest.com', |
109 page_set=self, | 114 page_set=self, |
110 name='Pinterest')) | 115 name='Pinterest', mode=mode, height=height, width=width)) |
111 | 116 |
112 # Why: #1 sports. | 117 # Why: #1 sports. |
113 # Fails often; crbug.com/249722' | 118 # Fails often; crbug.com/249722' |
114 # self.AddUserStory(KeyMobileSitesRepaintPage( | 119 # self.AddUserStory(KeyMobileSitesRepaintPage( |
115 # url='http://espn.go.com', page_set=self, name='ESPN')) | 120 # url='http://espn.go.com', page_set=self, name='ESPN')) |
116 # Why: crbug.com/231413 | 121 # Why: crbug.com/231413 |
117 # Doesn't scroll; crbug.com/249736 | 122 # Doesn't scroll; crbug.com/249736 |
118 # self.AddUserStory(KeyMobileSitesRepaintPage( | 123 # self.AddUserStory(KeyMobileSitesRepaintPage( |
119 # url='http://forecast.io', page_set=self)) | 124 # url='http://forecast.io', page_set=self)) |
120 # Why: crbug.com/169827 | 125 # Why: crbug.com/169827 |
121 self.AddUserStory(KeyMobileSitesRepaintPage( | 126 self.AddUserStory(KeyMobileSitesRepaintPage( |
122 url='http://slashdot.org/', page_set=self, labels=['fastpath'])) | 127 url='http://slashdot.org/', page_set=self, labels=['fastpath'], |
| 128 mode=mode, width=width, height=height)) |
123 | 129 |
124 # Why: #5 Alexa news """ | 130 # Why: #5 Alexa news """ |
125 | 131 |
126 self.AddUserStory(KeyMobileSitesRepaintPage( | 132 self.AddUserStory(KeyMobileSitesRepaintPage( |
127 url='http://www.reddit.com/r/programming/comments/1g96ve', | 133 url='http://www.reddit.com/r/programming/comments/1g96ve', |
128 page_set=self, labels=['fastpath'])) | 134 page_set=self, labels=['fastpath'], |
| 135 mode=mode, width=width, height=height)) |
129 | 136 |
130 # Why: Problematic use of fixed position elements """ | 137 # Why: Problematic use of fixed position elements """ |
131 self.AddUserStory(KeyMobileSitesRepaintPage( | 138 self.AddUserStory(KeyMobileSitesRepaintPage( |
132 url='http://www.boingboing.net', page_set=self, labels=['fastpath'])) | 139 url='http://www.boingboing.net', page_set=self, labels=['fastpath'], |
| 140 mode=mode, width=width, height=height)) |
133 | 141 |
134 # Add simple pages with no custom navigation logic or labels. | 142 # Add simple pages with no custom navigation logic or labels. |
135 urls_list = [ | 143 urls_list = [ |
136 # Why: Social; top Google property; Public profile; infinite scrolls. | 144 # Why: Social; top Google property; Public profile; infinite scrolls. |
137 # pylint: disable=line-too-long | 145 # pylint: disable=line-too-long |
138 'https://plus.google.com/app/basic/110031535020051778989/posts?source=appp
romo', | 146 'https://plus.google.com/app/basic/110031535020051778989/posts?source=appp
romo', |
139 # Why: crbug.com/242544 | 147 # Why: crbug.com/242544 |
140 ('http://www.androidpolice.com/2012/10/03/rumor-evidence-mounts-that-an-' | 148 ('http://www.androidpolice.com/2012/10/03/rumor-evidence-mounts-that-an-' |
141 'lg-optimus-g-nexus-is-coming-along-with-a-nexus-phone-certification-' | 149 'lg-optimus-g-nexus-is-coming-along-with-a-nexus-phone-certification-' |
142 'program/'), | 150 'program/'), |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 # Why: Top search engine | 184 # Why: Top search engine |
177 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' | 185 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' |
178 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), | 186 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), |
179 # Why: Top search engine | 187 # Why: Top search engine |
180 'http://www.bing.com/search?q=sloths', | 188 'http://www.bing.com/search?q=sloths', |
181 # Why: Good example of poor initial scrolling | 189 # Why: Good example of poor initial scrolling |
182 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' | 190 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' |
183 ] | 191 ] |
184 | 192 |
185 for url in urls_list: | 193 for url in urls_list: |
186 self.AddUserStory(KeyMobileSitesRepaintPage(url, self)) | 194 self.AddUserStory(KeyMobileSitesRepaintPage( |
| 195 url, self, mode=mode, height=height, width=width)) |
OLD | NEW |