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

Side by Side Diff: tools/telemetry/telemetry/internal/actions/scroll.py

Issue 1428733002: Update telemetry tests to be agnostic to ScrollTopLeftInterop mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
1 # Copyright 2012 The Chromium Authors. All rights reserved. 1 # Copyright 2012 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 import os 4 import os
5 5
6 from telemetry.internal.actions import page_action 6 from telemetry.internal.actions import page_action
7 7
8 8
9 class ScrollAction(page_action.PageAction): 9 class ScrollAction(page_action.PageAction):
10 # TODO(chrishenry): Ignore attributes, to be deleted when usage in 10 # TODO(chrishenry): Ignore attributes, to be deleted when usage in
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 done_callback = 'function() { window.__scrollActionDone = true; }' 72 done_callback = 'function() { window.__scrollActionDone = true; }'
73 tab.ExecuteJavaScript(""" 73 tab.ExecuteJavaScript("""
74 window.__scrollActionDone = false; 74 window.__scrollActionDone = false;
75 window.__scrollAction = new __ScrollAction(%s, %s);""" 75 window.__scrollAction = new __ScrollAction(%s, %s);"""
76 % (done_callback, self._distance_func)) 76 % (done_callback, self._distance_func))
77 77
78 def RunAction(self, tab): 78 def RunAction(self, tab):
79 if (self._selector is None and self._text is None and 79 if (self._selector is None and self._text is None and
80 self._element_function is None): 80 self._element_function is None):
81 self._element_function = 'document.body' 81 self._element_function = 'document.scrollingElement'
82 82
83 gesture_source_type = self._synthetic_gesture_source 83 gesture_source_type = self._synthetic_gesture_source
84 if self._use_touch: 84 if self._use_touch:
85 gesture_source_type = 'chrome.gpuBenchmarking.TOUCH_INPUT' 85 gesture_source_type = 'chrome.gpuBenchmarking.TOUCH_INPUT'
86 86
87 code = ''' 87 code = '''
88 function(element, info) { 88 function(element, info) {
89 if (!element) { 89 if (!element) {
90 throw Error('Cannot find element: ' + info); 90 throw Error('Cannot find element: ' + info);
91 } 91 }
92 window.__scrollAction.start({ 92 window.__scrollAction.start({
93 element: element, 93 element: element,
94 left_start_ratio: %s, 94 left_start_ratio: %s,
95 top_start_ratio: %s, 95 top_start_ratio: %s,
96 direction: '%s', 96 direction: '%s',
97 speed: %s, 97 speed: %s,
98 gesture_source_type: %s 98 gesture_source_type: %s
99 }); 99 });
100 }''' % (self._left_start_ratio, 100 }''' % (self._left_start_ratio,
101 self._top_start_ratio, 101 self._top_start_ratio,
102 self._direction, 102 self._direction,
103 self._speed, 103 self._speed,
104 gesture_source_type) 104 gesture_source_type)
105 page_action.EvaluateCallbackWithElement( 105 page_action.EvaluateCallbackWithElement(
106 tab, code, selector=self._selector, text=self._text, 106 tab, code, selector=self._selector, text=self._text,
107 element_function=self._element_function) 107 element_function=self._element_function)
108 tab.WaitForJavaScriptExpression('window.__scrollActionDone', 60) 108 tab.WaitForJavaScriptExpression('window.__scrollActionDone', 60)
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/internal/actions/scroll.js ('k') | tools/telemetry/telemetry/internal/actions/scroll_bounce.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698