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