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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 url=('http://www.polymer-project.org/components/paper-elements/demo.html#' | 105 url=('http://www.polymer-project.org/components/paper-elements/demo.html#' |
106 + anchor), | 106 + anchor), |
107 page_set=page_set) | 107 page_set=page_set) |
108 self.scrolling_page = scrolling_page | 108 self.scrolling_page = scrolling_page |
109 self.iframe_js = 'document.querySelector("sampler-scaffold").$.frame' | 109 self.iframe_js = 'document.querySelector("sampler-scaffold").$.frame' |
110 | 110 |
111 def RunNavigateSteps(self, action_runner): | 111 def RunNavigateSteps(self, action_runner): |
112 #FIXME(wiltzius) workaround for crbug.com/391672 | 112 #FIXME(wiltzius) workaround for crbug.com/391672 |
113 action_runner.ExecuteJavaScript('window.location.href="about:blank";') | 113 action_runner.ExecuteJavaScript('window.location.href="about:blank";') |
114 super(PolymerSampler, self).RunNavigateSteps(action_runner) | 114 super(PolymerSampler, self).RunNavigateSteps(action_runner) |
115 #FIXME(wiltzius) this should wait for iframe to load and all load | 115 waitForLoadJS = """ |
116 # animations to end | 116 window.Polymer.whenPolymerReady(function() { |
117 action_runner.Wait(5) | 117 %s.contentWindow.Polymer.whenPolymerReady(function() { |
| 118 window.__polymer_ready = true; |
| 119 }) |
| 120 }); |
| 121 """ % self.iframe_js |
| 122 action_runner.ExecuteJavaScript(waitForLoadJS) |
| 123 action_runner.WaitForJavaScriptCondition( |
| 124 'window.__polymer_ready') |
118 | 125 |
119 def RunSmoothness(self, action_runner): | 126 def RunSmoothness(self, action_runner): |
120 #TODO(wiltzius) Add interactions for input elements and shadow pages | 127 #TODO(wiltzius) Add interactions for input elements and shadow pages |
121 if self.scrolling_page: | 128 if self.scrolling_page: |
122 # Only bother scrolling the page if its been marked as worthwhile | 129 # Only bother scrolling the page if its been marked as worthwhile |
123 self.ScrollContentPane(action_runner) | 130 self.ScrollContentPane(action_runner) |
124 self.TouchEverything(action_runner) | 131 self.TouchEverything(action_runner) |
125 | 132 |
126 def ScrollContentPane(self, action_runner): | 133 def ScrollContentPane(self, action_runner): |
127 element_function = (self.iframe_js + '.contentDocument.querySelector(' | 134 element_function = (self.iframe_js + '.contentDocument.querySelector(' |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 for p in TAPPABLE_PAGES: | 222 for p in TAPPABLE_PAGES: |
216 self.AddPage(PolymerSampler(self, p)) | 223 self.AddPage(PolymerSampler(self, p)) |
217 | 224 |
218 # Polymer Sampler subpages that are interesting to scroll | 225 # Polymer Sampler subpages that are interesting to scroll |
219 SCROLLABLE_PAGES = [ | 226 SCROLLABLE_PAGES = [ |
220 # crbug.com/394756 | 227 # crbug.com/394756 |
221 # 'core-scroll-header-panel', | 228 # 'core-scroll-header-panel', |
222 ] | 229 ] |
223 for p in SCROLLABLE_PAGES: | 230 for p in SCROLLABLE_PAGES: |
224 self.AddPage(PolymerSampler(self, p, scrolling_page=True)) | 231 self.AddPage(PolymerSampler(self, p, scrolling_page=True)) |
OLD | NEW |