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 | 8 |
9 | 9 |
10 def _IssueMarkerAndScroll(action_runner): | 10 def _IssueMarkerAndScroll(action_runner): |
(...skipping 22 matching lines...) Expand all Loading... | |
33 self.archive_data_file = 'data/key_mobile_sites.json' | 33 self.archive_data_file = 'data/key_mobile_sites.json' |
34 self.action_on_load_complete = action_on_load_complete | 34 self.action_on_load_complete = action_on_load_complete |
35 | 35 |
36 def RunPageInteractions(self, action_runner): | 36 def RunPageInteractions(self, action_runner): |
37 if self.action_on_load_complete: | 37 if self.action_on_load_complete: |
38 action_runner.WaitForJavaScriptCondition( | 38 action_runner.WaitForJavaScriptCondition( |
39 'document.readyState == "complete"', 30) | 39 'document.readyState == "complete"', 30) |
40 _IssueMarkerAndScroll(action_runner) | 40 _IssueMarkerAndScroll(action_runner) |
41 | 41 |
42 | 42 |
43 class LinkedInSmoothPage(key_mobile_sites_pages.LinkedInPage): | |
44 | |
45 def __init__(self, page_set): | |
46 super(LinkedInSmoothPage, self).__init__(page_set=page_set) | |
47 | |
48 # Linkedin has expensive shader compilation so it can benefit from shader | |
49 # cache from reload. | |
50 def RunNavigateSteps(self, action_runner): | |
51 super(LinkedInSmoothPage, self).RunNavigateSteps(action_runner) | |
52 action_runner.ScrollPage() | |
53 action_runner.ReloadPage() | |
54 super(LinkedInSmoothPage, self).RunNavigateSteps(action_runner) | |
55 | |
56 | |
57 class WowwikiSmoothPage(KeyMobileSitesSmoothPage): | |
58 """# Why: Mobile wiki.""" | |
nednguyen
2015/03/03 19:16:41
You don't need the "#" here
Yufeng Shen (Slow to review)
2015/03/03 19:22:54
Done.
| |
59 def __init__(self, page_set): | |
60 super(WowwikiSmoothPage, self).__init__( | |
61 url='http://www.wowwiki.com/World_of_Warcraft:_Mists_of_Pandaria', | |
62 page_set=page_set) | |
63 | |
64 # Wowwiki has expensive shader compilation so it can benefit from shader | |
65 # cache from reload. | |
66 def RunNavigateSteps(self, action_runner): | |
67 super(WowwikiSmoothPage, self).RunNavigateSteps(action_runner) | |
68 action_runner.ScrollPage() | |
69 action_runner.ReloadPage() | |
70 super(WowwikiSmoothPage, self).RunNavigateSteps(action_runner) | |
71 | |
72 | |
43 class GmailSmoothPage(key_mobile_sites_pages.GmailPage): | 73 class GmailSmoothPage(key_mobile_sites_pages.GmailPage): |
44 | 74 |
45 def RunPageInteractions(self, action_runner): | 75 def RunPageInteractions(self, action_runner): |
46 interaction = action_runner.BeginGestureInteraction( | 76 interaction = action_runner.BeginGestureInteraction( |
47 'ScrollAction', is_smooth=True) | 77 'ScrollAction', is_smooth=True) |
48 action_runner.ScrollElement(element_function=( | 78 action_runner.ScrollElement(element_function=( |
49 'document.getElementById("views").childNodes[1].firstChild')) | 79 'document.getElementById("views").childNodes[1].firstChild')) |
50 interaction.End() | 80 interaction.End() |
51 interaction = action_runner.BeginGestureInteraction( | 81 interaction = action_runner.BeginGestureInteraction( |
52 'ScrollAction', is_smooth=True) | 82 'ScrollAction', is_smooth=True) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 bucket=page_set_module.PARTNER_BUCKET) | 152 bucket=page_set_module.PARTNER_BUCKET) |
123 | 153 |
124 | 154 |
125 # Add pages with predefined classes that contain custom navigation logic. | 155 # Add pages with predefined classes that contain custom navigation logic. |
126 predefined_page_classes = [ | 156 predefined_page_classes = [ |
127 key_mobile_sites_pages.CapitolVolkswagenPage, | 157 key_mobile_sites_pages.CapitolVolkswagenPage, |
128 key_mobile_sites_pages.TheVergeArticlePage, | 158 key_mobile_sites_pages.TheVergeArticlePage, |
129 key_mobile_sites_pages.CnnArticlePage, | 159 key_mobile_sites_pages.CnnArticlePage, |
130 key_mobile_sites_pages.FacebookPage, | 160 key_mobile_sites_pages.FacebookPage, |
131 key_mobile_sites_pages.YoutubeMobilePage, | 161 key_mobile_sites_pages.YoutubeMobilePage, |
132 key_mobile_sites_pages.LinkedInPage, | |
133 key_mobile_sites_pages.YahooAnswersPage, | 162 key_mobile_sites_pages.YahooAnswersPage, |
134 key_mobile_sites_pages.GoogleNewsMobilePage, | 163 key_mobile_sites_pages.GoogleNewsMobilePage, |
135 ] | 164 ] |
136 for page_class in predefined_page_classes: | 165 for page_class in predefined_page_classes: |
137 self.AddUserStory( | 166 self.AddUserStory( |
138 _CreatePageClassWithSmoothInteractions(page_class)(self)) | 167 _CreatePageClassWithSmoothInteractions(page_class)(self)) |
139 | 168 |
169 self.AddUserStory( | |
170 _CreatePageClassWithSmoothInteractions(LinkedInSmoothPage)(self)) | |
171 self.AddUserStory(WowwikiSmoothPage(self)) | |
172 | |
140 # Add pages with custom page interaction logic. | 173 # Add pages with custom page interaction logic. |
141 | 174 |
142 # Page behaves non-deterministically, replaced with test version for now. | 175 # Page behaves non-deterministically, replaced with test version for now. |
143 # self.AddUserStory(GroupClonedSmoothPage(self)) | 176 # self.AddUserStory(GroupClonedSmoothPage(self)) |
144 # mean_input_event_latency cannot be tracked correctly for | 177 # mean_input_event_latency cannot be tracked correctly for |
145 # GroupClonedListImagesPage. | 178 # GroupClonedListImagesPage. |
146 # See crbug.com/409086. | 179 # See crbug.com/409086. |
147 # self.AddUserStory(GroupClonedListImagesSmoothPage(self)) | 180 # self.AddUserStory(GroupClonedListImagesSmoothPage(self)) |
148 self.AddUserStory(GoogleNewsMobile2SmoothPage(self)) | 181 self.AddUserStory(GoogleNewsMobile2SmoothPage(self)) |
149 self.AddUserStory(AmazonNicolasCageSmoothPage(self)) | 182 self.AddUserStory(AmazonNicolasCageSmoothPage(self)) |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 # Why: #1 Alexa sports | 279 # Why: #1 Alexa sports |
247 'http://sports.yahoo.com/', | 280 'http://sports.yahoo.com/', |
248 # Why: Top tech blog | 281 # Why: Top tech blog |
249 'http://techcrunch.com', | 282 'http://techcrunch.com', |
250 # Why: #6 Alexa sports | 283 # Why: #6 Alexa sports |
251 'http://mlb.com/', | 284 'http://mlb.com/', |
252 # Why: #14 Alexa California | 285 # Why: #14 Alexa California |
253 'http://www.sfgate.com/', | 286 'http://www.sfgate.com/', |
254 # Why: Non-latin character set | 287 # Why: Non-latin character set |
255 'http://worldjournal.com/', | 288 'http://worldjournal.com/', |
256 # Why: Mobile wiki | |
257 'http://www.wowwiki.com/World_of_Warcraft:_Mists_of_Pandaria', | |
258 # Why: #15 Alexa news | 289 # Why: #15 Alexa news |
259 'http://online.wsj.com/home-page', | 290 'http://online.wsj.com/home-page', |
260 # Why: Image-heavy mobile site | 291 # Why: Image-heavy mobile site |
261 'http://www.deviantart.com/', | 292 'http://www.deviantart.com/', |
262 # Why: Top search engine | 293 # Why: Top search engine |
263 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' | 294 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' |
264 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), | 295 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), |
265 # Why: Top search engine | 296 # Why: Top search engine |
266 'http://www.bing.com/search?q=sloths', | 297 'http://www.bing.com/search?q=sloths', |
267 # Why: Good example of poor initial scrolling | 298 # Why: Good example of poor initial scrolling |
268 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' | 299 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' |
269 ] | 300 ] |
270 | 301 |
271 for url in urls_list: | 302 for url in urls_list: |
272 self.AddUserStory(KeyMobileSitesSmoothPage(url, self)) | 303 self.AddUserStory(KeyMobileSitesSmoothPage(url, self)) |
OLD | NEW |