| 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 import story |
| 4 from telemetry.page import page as page_module | 5 from telemetry.page import page as page_module |
| 5 from telemetry.page import page_set as page_set_module | |
| 6 from telemetry.page import shared_page_state | 6 from telemetry.page import shared_page_state |
| 7 | 7 |
| 8 | 8 |
| 9 class PolymerPage(page_module.Page): | 9 class PolymerPage(page_module.Page): |
| 10 | 10 |
| 11 def __init__(self, url, page_set, run_no_page_interactions): | 11 def __init__(self, url, page_set, run_no_page_interactions): |
| 12 """ Base class for all polymer pages. | 12 """ Base class for all polymer pages. |
| 13 | 13 |
| 14 Args: | 14 Args: |
| 15 run_no_page_interactions: whether the page will run any interactions after | 15 run_no_page_interactions: whether the page will run any interactions after |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 action_runner.TapElement(element_function=element_function) | 208 action_runner.TapElement(element_function=element_function) |
| 209 action_runner.Wait(1) # wait for e.g. animations on the widget | 209 action_runner.Wait(1) # wait for e.g. animations on the widget |
| 210 | 210 |
| 211 def SwipeWidget(self, action_runner, element_function): | 211 def SwipeWidget(self, action_runner, element_function): |
| 212 with action_runner.CreateInteraction('Swipe_Widget'): | 212 with action_runner.CreateInteraction('Swipe_Widget'): |
| 213 action_runner.SwipeElement(element_function=element_function, | 213 action_runner.SwipeElement(element_function=element_function, |
| 214 left_start_ratio=0.75, | 214 left_start_ratio=0.75, |
| 215 speed_in_pixels_per_second=300) | 215 speed_in_pixels_per_second=300) |
| 216 | 216 |
| 217 | 217 |
| 218 class PolymerPageSet(page_set_module.PageSet): | 218 class PolymerPageSet(story.StorySet): |
| 219 | 219 |
| 220 def __init__(self, run_no_page_interactions=False): | 220 def __init__(self, run_no_page_interactions=False): |
| 221 super(PolymerPageSet, self).__init__( | 221 super(PolymerPageSet, self).__init__( |
| 222 archive_data_file='data/polymer.json', | 222 archive_data_file='data/polymer.json', |
| 223 bucket=page_set_module.PUBLIC_BUCKET) | 223 cloud_storage_bucket=story.PUBLIC_BUCKET) |
| 224 | 224 |
| 225 self.AddUserStory(PolymerCalculatorPage(self, run_no_page_interactions)) | 225 self.AddUserStory(PolymerCalculatorPage(self, run_no_page_interactions)) |
| 226 self.AddUserStory(PolymerShadowPage(self, run_no_page_interactions)) | 226 self.AddUserStory(PolymerShadowPage(self, run_no_page_interactions)) |
| 227 | 227 |
| 228 # Polymer Sampler subpages that are interesting to tap / swipe elements on | 228 # Polymer Sampler subpages that are interesting to tap / swipe elements on |
| 229 TAPPABLE_PAGES = [ | 229 TAPPABLE_PAGES = [ |
| 230 'paper-button', | 230 'paper-button', |
| 231 'paper-checkbox', | 231 'paper-checkbox', |
| 232 'paper-fab', | 232 'paper-fab', |
| 233 'paper-icon-button', | 233 'paper-icon-button', |
| (...skipping 16 matching lines...) Expand all Loading... |
| 250 for p in SCROLLABLE_PAGES: | 250 for p in SCROLLABLE_PAGES: |
| 251 self.AddUserStory(PolymerSampler( | 251 self.AddUserStory(PolymerSampler( |
| 252 self, p, run_no_page_interactions=run_no_page_interactions, | 252 self, p, run_no_page_interactions=run_no_page_interactions, |
| 253 scrolling_page=True)) | 253 scrolling_page=True)) |
| 254 | 254 |
| 255 for page in self: | 255 for page in self: |
| 256 assert (page.__class__.RunPageInteractions == | 256 assert (page.__class__.RunPageInteractions == |
| 257 PolymerPage.RunPageInteractions), ( | 257 PolymerPage.RunPageInteractions), ( |
| 258 'Pages in this page set must not override PolymerPage\' ' | 258 'Pages in this page set must not override PolymerPage\' ' |
| 259 'RunPageInteractions method.') | 259 'RunPageInteractions method.') |
| OLD | NEW |