Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tools/perf/page_sets/polymer.py

Issue 1104573002: [Telemetry] Remove support for automatic record creation in smoothness controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to make sure CQ_EXTRA_TRYBOTS activated Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/perf/page_sets/key_silk_cases.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, run_no_page_interactions): 9 def __init__(self, url, page_set, run_no_page_interactions):
10 """ Base class for all polymer pages. 10 """ Base class for all polymer pages.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 super(PolymerCalculatorPage, self).__init__( 46 super(PolymerCalculatorPage, self).__init__(
47 url=('http://www.polymer-project.org/components/paper-calculator/' 47 url=('http://www.polymer-project.org/components/paper-calculator/'
48 'demo.html'), 48 'demo.html'),
49 page_set=page_set, run_no_page_interactions=run_no_page_interactions) 49 page_set=page_set, run_no_page_interactions=run_no_page_interactions)
50 50
51 def PerformPageInteractions(self, action_runner): 51 def PerformPageInteractions(self, action_runner):
52 self.TapButton(action_runner) 52 self.TapButton(action_runner)
53 self.SlidePanel(action_runner) 53 self.SlidePanel(action_runner)
54 54
55 def TapButton(self, action_runner): 55 def TapButton(self, action_runner):
56 with action_runner.CreateInteraction('Action_TapAction'): 56 with action_runner.CreateInteraction('PolymerAnimation', repeatable=True):
57 action_runner.TapElement(element_function=''' 57 action_runner.TapElement(element_function='''
58 document.querySelector( 58 document.querySelector(
59 'body /deep/ #outerPanels' 59 'body /deep/ #outerPanels'
60 ).querySelector( 60 ).querySelector(
61 '#standard' 61 '#standard'
62 ).shadowRoot.querySelector( 62 ).shadowRoot.querySelector(
63 'paper-calculator-key[label="5"]' 63 'paper-calculator-key[label="5"]'
64 )''') 64 )''')
65 action_runner.Wait(2) 65 action_runner.Wait(2)
66 66
67 def SlidePanel(self, action_runner): 67 def SlidePanel(self, action_runner):
68 # only bother with this interaction if the drawer is hidden 68 # only bother with this interaction if the drawer is hidden
69 opened = action_runner.EvaluateJavaScript(''' 69 opened = action_runner.EvaluateJavaScript('''
70 (function() { 70 (function() {
71 var outer = document.querySelector("body /deep/ #outerPanels"); 71 var outer = document.querySelector("body /deep/ #outerPanels");
72 return outer.opened || outer.wideMode; 72 return outer.opened || outer.wideMode;
73 }());''') 73 }());''')
74 if not opened: 74 if not opened:
75 with action_runner.CreateInteraction('Action_SwipeAction'): 75 with action_runner.CreateInteraction('PolymerAnimation', repeatable=True):
76 action_runner.SwipeElement( 76 action_runner.SwipeElement(
77 left_start_ratio=0.1, top_start_ratio=0.2, 77 left_start_ratio=0.1, top_start_ratio=0.2,
78 direction='left', distance=300, speed_in_pixels_per_second=5000, 78 direction='left', distance=300, speed_in_pixels_per_second=5000,
79 element_function=''' 79 element_function='''
80 document.querySelector( 80 document.querySelector(
81 'body /deep/ #outerPanels' 81 'body /deep/ #outerPanels'
82 ).querySelector( 82 ).querySelector(
83 '#advanced' 83 '#advanced'
84 ).shadowRoot.querySelector( 84 ).shadowRoot.querySelector(
85 '.handle-bar' 85 '.handle-bar'
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 def PerformPageInteractions(self, action_runner): 148 def PerformPageInteractions(self, action_runner):
149 #TODO(wiltzius) Add interactions for input elements and shadow pages 149 #TODO(wiltzius) Add interactions for input elements and shadow pages
150 if self.scrolling_page: 150 if self.scrolling_page:
151 # Only bother scrolling the page if its been marked as worthwhile 151 # Only bother scrolling the page if its been marked as worthwhile
152 self.ScrollContentPane(action_runner) 152 self.ScrollContentPane(action_runner)
153 self.TouchEverything(action_runner) 153 self.TouchEverything(action_runner)
154 154
155 def ScrollContentPane(self, action_runner): 155 def ScrollContentPane(self, action_runner):
156 element_function = (self.iframe_js + '.querySelector(' 156 element_function = (self.iframe_js + '.querySelector('
157 '"core-scroll-header-panel").$.mainContainer') 157 '"core-scroll-header-panel").$.mainContainer')
158 with action_runner.CreateInteraction('Scroll_Page'): 158 with action_runner.CreateInteraction('Scroll_Page', repeatable=True):
159 action_runner.ScrollElement(use_touch=True, 159 action_runner.ScrollElement(use_touch=True,
160 direction='down', 160 direction='down',
161 distance='900', 161 distance='900',
162 element_function=element_function) 162 element_function=element_function)
163 with action_runner.CreateInteraction('Scroll_Page'): 163 with action_runner.CreateInteraction('Scroll_Page', repeatable=True):
164 action_runner.ScrollElement(use_touch=True, 164 action_runner.ScrollElement(use_touch=True,
165 direction='up', 165 direction='up',
166 distance='900', 166 distance='900',
167 element_function=element_function) 167 element_function=element_function)
168 168
169 def TouchEverything(self, action_runner): 169 def TouchEverything(self, action_runner):
170 tappable_types = [ 170 tappable_types = [
171 'paper-button', 171 'paper-button',
172 'paper-checkbox', 172 'paper-checkbox',
173 'paper-fab', 173 'paper-fab',
(...skipping 20 matching lines...) Expand all
194 for i in range(action_runner.EvaluateJavaScript(roles_count_query)): 194 for i in range(action_runner.EvaluateJavaScript(roles_count_query)):
195 element_query = element_list_query + ("[%d]" % i) 195 element_query = element_list_query + ("[%d]" % i)
196 if action_runner.EvaluateJavaScript( 196 if action_runner.EvaluateJavaScript(
197 element_query + '.offsetParent != null'): 197 element_query + '.offsetParent != null'):
198 # Only try to tap on visible elements (offsetParent != null) 198 # Only try to tap on visible elements (offsetParent != null)
199 action_runner.ExecuteJavaScript(element_query + '.scrollIntoView()') 199 action_runner.ExecuteJavaScript(element_query + '.scrollIntoView()')
200 action_runner.Wait(1) # wait for page to settle after scrolling 200 action_runner.Wait(1) # wait for page to settle after scrolling
201 action_function(action_runner, element_query) 201 action_function(action_runner, element_query)
202 202
203 def TapWidget(self, action_runner, element_function): 203 def TapWidget(self, action_runner, element_function):
204 with action_runner.CreateInteraction('Tap_Widget'): 204 with action_runner.CreateInteraction('Tap_Widget', repeatable=True):
205 action_runner.TapElement(element_function=element_function) 205 action_runner.TapElement(element_function=element_function)
206 action_runner.Wait(1) # wait for e.g. animations on the widget 206 action_runner.Wait(1) # wait for e.g. animations on the widget
207 207
208 def SwipeWidget(self, action_runner, element_function): 208 def SwipeWidget(self, action_runner, element_function):
209 with action_runner.CreateInteraction('Swipe_Widget'): 209 with action_runner.CreateInteraction('Swipe_Widget'):
210 action_runner.SwipeElement(element_function=element_function, 210 action_runner.SwipeElement(element_function=element_function,
211 left_start_ratio=0.75, 211 left_start_ratio=0.75,
212 speed_in_pixels_per_second=300) 212 speed_in_pixels_per_second=300)
213 213
214 214
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 for p in SCROLLABLE_PAGES: 248 for p in SCROLLABLE_PAGES:
249 self.AddUserStory(PolymerSampler( 249 self.AddUserStory(PolymerSampler(
250 self, p, run_no_page_interactions=run_no_page_interactions, 250 self, p, run_no_page_interactions=run_no_page_interactions,
251 scrolling_page=True)) 251 scrolling_page=True))
252 252
253 for page in self: 253 for page in self:
254 assert (page.__class__.RunPageInteractions == 254 assert (page.__class__.RunPageInteractions ==
255 PolymerPage.RunPageInteractions), ( 255 PolymerPage.RunPageInteractions), (
256 'Pages in this page set must not override PolymerPage\' ' 256 'Pages in this page set must not override PolymerPage\' '
257 'RunPageInteractions method.') 257 'RunPageInteractions method.')
OLDNEW
« no previous file with comments | « tools/perf/page_sets/key_silk_cases.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698