| 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 # With default top_start_ratio=0.5 the corresponding element in this page |
| 134 # will not be in the root scroller. |
| 135 action_runner.ScrollPage(top_start_ratio=0.01) |
| 128 | 136 |
| 129 class KeyMobileSitesSmoothPageSet(story.StorySet): | 137 class KeyMobileSitesSmoothPageSet(story.StorySet): |
| 130 | 138 |
| 131 """ Key mobile sites with smooth interactions. """ | 139 """ Key mobile sites with smooth interactions. """ |
| 132 | 140 |
| 133 def __init__(self): | 141 def __init__(self): |
| 134 super(KeyMobileSitesSmoothPageSet, self).__init__( | 142 super(KeyMobileSitesSmoothPageSet, self).__init__( |
| 135 archive_data_file='data/key_mobile_sites_smooth.json', | 143 archive_data_file='data/key_mobile_sites_smooth.json', |
| 136 cloud_storage_bucket=story.PARTNER_BUCKET) | 144 cloud_storage_bucket=story.PARTNER_BUCKET) |
| 137 | 145 |
| 138 | 146 |
| 139 # Add pages with predefined classes that contain custom navigation logic. | 147 # Add pages with predefined classes that contain custom navigation logic. |
| 140 predefined_page_classes = [ | 148 predefined_page_classes = [ |
| 141 key_mobile_sites_pages.CapitolVolkswagenPage, | 149 key_mobile_sites_pages.CapitolVolkswagenPage, |
| 142 key_mobile_sites_pages.TheVergeArticlePage, | 150 key_mobile_sites_pages.TheVergeArticlePage, |
| 143 key_mobile_sites_pages.CnnArticlePage, | |
| 144 key_mobile_sites_pages.FacebookPage, | 151 key_mobile_sites_pages.FacebookPage, |
| 145 key_mobile_sites_pages.YoutubeMobilePage, | 152 key_mobile_sites_pages.YoutubeMobilePage, |
| 146 key_mobile_sites_pages.YahooAnswersPage, | 153 key_mobile_sites_pages.YahooAnswersPage, |
| 147 key_mobile_sites_pages.GoogleNewsMobilePage, | 154 key_mobile_sites_pages.GoogleNewsMobilePage, |
| 148 ] | 155 ] |
| 149 for page_class in predefined_page_classes: | 156 for page_class in predefined_page_classes: |
| 150 self.AddStory( | 157 self.AddStory( |
| 151 _CreatePageClassWithSmoothInteractions(page_class)(self)) | 158 _CreatePageClassWithSmoothInteractions(page_class)(self)) |
| 152 | 159 |
| 153 self.AddStory( | 160 self.AddStory( |
| 154 _CreatePageClassWithSmoothInteractions(LinkedInSmoothPage)(self)) | 161 _CreatePageClassWithSmoothInteractions(LinkedInSmoothPage)(self)) |
| 155 self.AddStory(WowwikiSmoothPage(self)) | 162 self.AddStory(WowwikiSmoothPage(self)) |
| 156 | 163 |
| 157 # Add pages with custom page interaction logic. | 164 # Add pages with custom page interaction logic. |
| 158 | 165 |
| 159 # Page behaves non-deterministically, replaced with test version for now. | 166 # Page behaves non-deterministically, replaced with test version for now. |
| 160 # self.AddStory(GroupClonedSmoothPage(self)) | 167 # self.AddStory(GroupClonedSmoothPage(self)) |
| 161 # mean_input_event_latency cannot be tracked correctly for | 168 # mean_input_event_latency cannot be tracked correctly for |
| 162 # GroupClonedListImagesPage. | 169 # GroupClonedListImagesPage. |
| 163 # See crbug.com/409086. | 170 # See crbug.com/409086. |
| 164 # self.AddStory(GroupClonedListImagesSmoothPage(self)) | 171 # self.AddStory(GroupClonedListImagesSmoothPage(self)) |
| 165 self.AddStory(GoogleNewsMobile2SmoothPage(self)) | 172 self.AddStory(GoogleNewsMobile2SmoothPage(self)) |
| 166 self.AddStory(AmazonNicolasCageSmoothPage(self)) | 173 self.AddStory(AmazonNicolasCageSmoothPage(self)) |
| 174 self.AddStory(CNNArticleSmoothPage(self)) |
| 167 | 175 |
| 168 # Add pages with custom labels. | 176 # Add pages with custom labels. |
| 169 | 177 |
| 170 # Why: Top news site. | 178 # Why: Top news site. |
| 171 self.AddStory(KeyMobileSitesSmoothPage( | 179 self.AddStory(KeyMobileSitesSmoothPage( |
| 172 url='http://nytimes.com/', page_set=self, labels=['fastpath'])) | 180 url='http://nytimes.com/', page_set=self, labels=['fastpath'])) |
| 173 | 181 |
| 174 # Why: Image-heavy site. | 182 # Why: Image-heavy site. |
| 175 self.AddStory(KeyMobileSitesSmoothPage( | 183 self.AddStory(KeyMobileSitesSmoothPage( |
| 176 url='http://cuteoverload.com', page_set=self, labels=['fastpath'])) | 184 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&' | 281 ('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'), | 282 'rsv_sug=0&rsv_sug4=3824&rsv_sug1=3&inputT=4920'), |
| 275 # Why: Top search engine | 283 # Why: Top search engine |
| 276 'http://www.bing.com/search?q=sloths', | 284 'http://www.bing.com/search?q=sloths', |
| 277 # Why: Good example of poor initial scrolling | 285 # Why: Good example of poor initial scrolling |
| 278 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' | 286 'http://ftw.usatoday.com/2014/05/spelling-bee-rules-shenanigans' |
| 279 ] | 287 ] |
| 280 | 288 |
| 281 for url in urls_list: | 289 for url in urls_list: |
| 282 self.AddStory(KeyMobileSitesSmoothPage(url, self)) | 290 self.AddStory(KeyMobileSitesSmoothPage(url, self)) |
| OLD | NEW |