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 shared_page_state | 5 from telemetry.page import shared_page_state |
| 6 from telemetry import story | 6 from telemetry import story |
| 7 | 7 |
| 8 from page_sets import key_mobile_sites_pages | 8 from page_sets import key_mobile_sites_pages |
| 9 | 9 |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 | 118 |
| 119 class AmazonNicolasCageSmoothPage( | 119 class AmazonNicolasCageSmoothPage( |
| 120 key_mobile_sites_pages.AmazonNicolasCagePage): | 120 key_mobile_sites_pages.AmazonNicolasCagePage): |
| 121 | 121 |
| 122 def RunPageInteractions(self, action_runner): | 122 def RunPageInteractions(self, action_runner): |
| 123 with action_runner.CreateGestureInteraction('ScrollAction'): | 123 with action_runner.CreateGestureInteraction('ScrollAction'): |
| 124 action_runner.ScrollElement( | 124 action_runner.ScrollElement( |
| 125 selector='#search', | 125 selector='#search', |
| 126 distance_expr='document.body.scrollHeight - window.innerHeight') | 126 distance_expr='document.body.scrollHeight - window.innerHeight') |
| 127 | 127 |
| 128 class CNNArticleSmoothPage( | |
| 129 key_mobile_sites_pages.CnnArticlePage): | |
| 130 | |
| 131 def RunPageInteractions(self, action_runner): | |
| 132 with action_runner.CreateGestureInteraction('ScrollAction'): | |
| 133 action_runner.ScrollElement( | |
| 134 element_function='document.getElementsByTagName("body")[0]', | |
| 135 distance_expr='document.body.scrollHeight - window.innerHeight', | |
| 136 top_start_ratio=0.01) | |
|
sullivan
2016/08/24 14:40:03
Reading the bug, we need to do this because the de
Navid Zolghadr
2016/08/24 15:05:15
Done.
| |
| 128 | 137 |
| 129 class KeyMobileSitesSmoothPageSet(story.StorySet): | 138 class KeyMobileSitesSmoothPageSet(story.StorySet): |
| 130 | 139 |
| 131 """ Key mobile sites with smooth interactions. """ | 140 """ Key mobile sites with smooth interactions. """ |
| 132 | 141 |
| 133 def __init__(self): | 142 def __init__(self): |
| 134 super(KeyMobileSitesSmoothPageSet, self).__init__( | 143 super(KeyMobileSitesSmoothPageSet, self).__init__( |
| 135 archive_data_file='data/key_mobile_sites_smooth.json', | 144 archive_data_file='data/key_mobile_sites_smooth.json', |
| 136 cloud_storage_bucket=story.PARTNER_BUCKET) | 145 cloud_storage_bucket=story.PARTNER_BUCKET) |
| 137 | 146 |
| 138 | 147 |
| 139 # Add pages with predefined classes that contain custom navigation logic. | 148 # Add pages with predefined classes that contain custom navigation logic. |
| 140 predefined_page_classes = [ | 149 predefined_page_classes = [ |
| 141 key_mobile_sites_pages.CapitolVolkswagenPage, | 150 key_mobile_sites_pages.CapitolVolkswagenPage, |
| 142 key_mobile_sites_pages.TheVergeArticlePage, | 151 key_mobile_sites_pages.TheVergeArticlePage, |
| 143 key_mobile_sites_pages.CnnArticlePage, | |
| 144 key_mobile_sites_pages.FacebookPage, | 152 key_mobile_sites_pages.FacebookPage, |
| 145 key_mobile_sites_pages.YoutubeMobilePage, | 153 key_mobile_sites_pages.YoutubeMobilePage, |
| 146 key_mobile_sites_pages.YahooAnswersPage, | 154 key_mobile_sites_pages.YahooAnswersPage, |
| 147 key_mobile_sites_pages.GoogleNewsMobilePage, | 155 key_mobile_sites_pages.GoogleNewsMobilePage, |
| 148 ] | 156 ] |
| 149 for page_class in predefined_page_classes: | 157 for page_class in predefined_page_classes: |
| 150 self.AddStory( | 158 self.AddStory( |
| 151 _CreatePageClassWithSmoothInteractions(page_class)(self)) | 159 _CreatePageClassWithSmoothInteractions(page_class)(self)) |
| 152 | 160 |
| 153 self.AddStory( | 161 self.AddStory( |
| 154 _CreatePageClassWithSmoothInteractions(LinkedInSmoothPage)(self)) | 162 _CreatePageClassWithSmoothInteractions(LinkedInSmoothPage)(self)) |
| 155 self.AddStory(WowwikiSmoothPage(self)) | 163 self.AddStory(WowwikiSmoothPage(self)) |
| 156 | 164 |
| 157 # Add pages with custom page interaction logic. | 165 # Add pages with custom page interaction logic. |
| 158 | 166 |
| 159 # Page behaves non-deterministically, replaced with test version for now. | 167 # Page behaves non-deterministically, replaced with test version for now. |
| 160 # self.AddStory(GroupClonedSmoothPage(self)) | 168 # self.AddStory(GroupClonedSmoothPage(self)) |
| 161 # mean_input_event_latency cannot be tracked correctly for | 169 # mean_input_event_latency cannot be tracked correctly for |
| 162 # GroupClonedListImagesPage. | 170 # GroupClonedListImagesPage. |
| 163 # See crbug.com/409086. | 171 # See crbug.com/409086. |
| 164 # self.AddStory(GroupClonedListImagesSmoothPage(self)) | 172 # self.AddStory(GroupClonedListImagesSmoothPage(self)) |
| 165 self.AddStory(GoogleNewsMobile2SmoothPage(self)) | 173 self.AddStory(GoogleNewsMobile2SmoothPage(self)) |
| 166 self.AddStory(AmazonNicolasCageSmoothPage(self)) | 174 self.AddStory(AmazonNicolasCageSmoothPage(self)) |
| 175 self.AddStory(CNNArticleSmoothPage(self)) | |
| 167 | 176 |
| 168 # Add pages with custom labels. | 177 # Add pages with custom labels. |
| 169 | 178 |
| 170 # Why: Top news site. | 179 # Why: Top news site. |
| 171 self.AddStory(KeyMobileSitesSmoothPage( | 180 self.AddStory(KeyMobileSitesSmoothPage( |
| 172 url='http://nytimes.com/', page_set=self, labels=['fastpath'])) | 181 url='http://nytimes.com/', page_set=self, labels=['fastpath'])) |
| 173 | 182 |
| 174 # Why: Image-heavy site. | 183 # Why: Image-heavy site. |
| 175 self.AddStory(KeyMobileSitesSmoothPage( | 184 self.AddStory(KeyMobileSitesSmoothPage( |
| 176 url='http://cuteoverload.com', page_set=self, labels=['fastpath'])) | 185 url='http://cuteoverload.com', page_set=self, labels=['fastpath'])) |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' | 282 ('http://www.baidu.com/s?wd=barack+obama&rsv_bp=0&rsv_spt=3&rsv_sug3=9&' |
| 274 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), | 283 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), |
| 275 # Why: Top search engine | 284 # Why: Top search engine |
| 276 'http://www.bing.com/search?q=sloths', | 285 'http://www.bing.com/search?q=sloths', |
| 277 # Why: Good example of poor initial scrolling | 286 # Why: Good example of poor initial scrolling |
| 278 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' | 287 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' |
| 279 ] | 288 ] |
| 280 | 289 |
| 281 for url in urls_list: | 290 for url in urls_list: |
| 282 self.AddStory(KeyMobileSitesSmoothPage(url, self)) | 291 self.AddStory(KeyMobileSitesSmoothPage(url, self)) |
| OLD | NEW |