| 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 class PolymerPage(page_module.Page): | 7 class PolymerPage(page_module.Page): |
| 8 | 8 |
| 9 def __init__(self, url, page_set): | 9 def __init__(self, url, page_set): |
| 10 super(PolymerPage, self).__init__( | 10 super(PolymerPage, self).__init__( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 | 24 |
| 25 class PolymerCalculatorPage(PolymerPage): | 25 class PolymerCalculatorPage(PolymerPage): |
| 26 | 26 |
| 27 def __init__(self, page_set): | 27 def __init__(self, page_set): |
| 28 super(PolymerCalculatorPage, self).__init__( | 28 super(PolymerCalculatorPage, self).__init__( |
| 29 url=('http://www.polymer-project.org/components/paper-calculator/' | 29 url=('http://www.polymer-project.org/components/paper-calculator/' |
| 30 'demo.html'), | 30 'demo.html'), |
| 31 page_set=page_set) | 31 page_set=page_set) |
| 32 | 32 |
| 33 def RunSmoothness(self, action_runner): | 33 def RunPageInteractions(self, action_runner): |
| 34 self.TapButton(action_runner) | 34 self.TapButton(action_runner) |
| 35 self.SlidePanel(action_runner) | 35 self.SlidePanel(action_runner) |
| 36 | 36 |
| 37 def TapButton(self, action_runner): | 37 def TapButton(self, action_runner): |
| 38 interaction = action_runner.BeginInteraction( | 38 interaction = action_runner.BeginInteraction( |
| 39 'Action_TapAction', is_smooth=True) | 39 'Action_TapAction', is_smooth=True) |
| 40 action_runner.TapElement(element_function=''' | 40 action_runner.TapElement(element_function=''' |
| 41 document.querySelector( | 41 document.querySelector( |
| 42 'body /deep/ #outerPanels' | 42 'body /deep/ #outerPanels' |
| 43 ).querySelector( | 43 ).querySelector( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 interaction.End() | 75 interaction.End() |
| 76 | 76 |
| 77 | 77 |
| 78 class PolymerShadowPage(PolymerPage): | 78 class PolymerShadowPage(PolymerPage): |
| 79 | 79 |
| 80 def __init__(self, page_set): | 80 def __init__(self, page_set): |
| 81 super(PolymerShadowPage, self).__init__( | 81 super(PolymerShadowPage, self).__init__( |
| 82 url='http://www.polymer-project.org/components/paper-shadow/demo.html', | 82 url='http://www.polymer-project.org/components/paper-shadow/demo.html', |
| 83 page_set=page_set) | 83 page_set=page_set) |
| 84 | 84 |
| 85 def RunSmoothness(self, action_runner): | 85 def RunPageInteractions(self, action_runner): |
| 86 action_runner.ExecuteJavaScript( | 86 action_runner.ExecuteJavaScript( |
| 87 "document.getElementById('fab').scrollIntoView()") | 87 "document.getElementById('fab').scrollIntoView()") |
| 88 action_runner.Wait(5) | 88 action_runner.Wait(5) |
| 89 self.AnimateShadow(action_runner, 'card') | 89 self.AnimateShadow(action_runner, 'card') |
| 90 #FIXME(wiltzius) disabling until this issue is fixed: | 90 #FIXME(wiltzius) disabling until this issue is fixed: |
| 91 # https://github.com/Polymer/paper-shadow/issues/12 | 91 # https://github.com/Polymer/paper-shadow/issues/12 |
| 92 #self.AnimateShadow(action_runner, 'fab') | 92 #self.AnimateShadow(action_runner, 'fab') |
| 93 | 93 |
| 94 def AnimateShadow(self, action_runner, eid): | 94 def AnimateShadow(self, action_runner, eid): |
| 95 for i in range(1, 6): | 95 for i in range(1, 6): |
| (...skipping 26 matching lines...) Expand all Loading... |
| 122 window.Polymer.whenPolymerReady(function() { | 122 window.Polymer.whenPolymerReady(function() { |
| 123 %s.contentWindow.Polymer.whenPolymerReady(function() { | 123 %s.contentWindow.Polymer.whenPolymerReady(function() { |
| 124 window.__polymer_ready = true; | 124 window.__polymer_ready = true; |
| 125 }) | 125 }) |
| 126 }); | 126 }); |
| 127 """ % self.iframe_js | 127 """ % self.iframe_js |
| 128 action_runner.ExecuteJavaScript(waitForLoadJS) | 128 action_runner.ExecuteJavaScript(waitForLoadJS) |
| 129 action_runner.WaitForJavaScriptCondition( | 129 action_runner.WaitForJavaScriptCondition( |
| 130 'window.__polymer_ready') | 130 'window.__polymer_ready') |
| 131 | 131 |
| 132 def RunSmoothness(self, action_runner): | 132 def RunPageInteractions(self, action_runner): |
| 133 #TODO(wiltzius) Add interactions for input elements and shadow pages | 133 #TODO(wiltzius) Add interactions for input elements and shadow pages |
| 134 if self.scrolling_page: | 134 if self.scrolling_page: |
| 135 # Only bother scrolling the page if its been marked as worthwhile | 135 # Only bother scrolling the page if its been marked as worthwhile |
| 136 self.ScrollContentPane(action_runner) | 136 self.ScrollContentPane(action_runner) |
| 137 self.TouchEverything(action_runner) | 137 self.TouchEverything(action_runner) |
| 138 | 138 |
| 139 def ScrollContentPane(self, action_runner): | 139 def ScrollContentPane(self, action_runner): |
| 140 element_function = (self.iframe_js + '.querySelector(' | 140 element_function = (self.iframe_js + '.querySelector(' |
| 141 '"core-scroll-header-panel").$.mainContainer') | 141 '"core-scroll-header-panel").$.mainContainer') |
| 142 interaction = action_runner.BeginInteraction('Scroll_Page', is_smooth=True) | 142 interaction = action_runner.BeginInteraction('Scroll_Page', is_smooth=True) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 ] | 229 ] |
| 230 for p in TAPPABLE_PAGES: | 230 for p in TAPPABLE_PAGES: |
| 231 self.AddUserStory(PolymerSampler(self, p)) | 231 self.AddUserStory(PolymerSampler(self, p)) |
| 232 | 232 |
| 233 # Polymer Sampler subpages that are interesting to scroll | 233 # Polymer Sampler subpages that are interesting to scroll |
| 234 SCROLLABLE_PAGES = [ | 234 SCROLLABLE_PAGES = [ |
| 235 'core-scroll-header-panel', | 235 'core-scroll-header-panel', |
| 236 ] | 236 ] |
| 237 for p in SCROLLABLE_PAGES: | 237 for p in SCROLLABLE_PAGES: |
| 238 self.AddUserStory(PolymerSampler(self, p, scrolling_page=True)) | 238 self.AddUserStory(PolymerSampler(self, p, scrolling_page=True)) |
| OLD | NEW |