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

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

Issue 945393002: Adding support for diagonal scrolling to telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a bug which would take the minimum of two numbers (even though one would likely be negative).… Created 5 years, 9 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
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.page.actions import page_action 6 from telemetry.page.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
11 # other repo is cleaned up. 11 # other repo is cleaned up.
12 def __init__(self, selector=None, text=None, element_function=None, 12 def __init__(self, selector=None, text=None, element_function=None,
13 left_start_ratio=0.5, top_start_ratio=0.5, direction='down', 13 left_start_ratio=0.5, top_start_ratio=0.5, direction='down',
14 distance=None, distance_expr=None, 14 distance=None, distance_expr=None,
15 speed_in_pixels_per_second=800, use_touch=False): 15 speed_in_pixels_per_second=800, use_touch=False):
16 super(ScrollAction, self).__init__() 16 super(ScrollAction, self).__init__()
17 if direction not in ['down', 'up', 'left', 'right']: 17 if direction not in ['down', 'up', 'left', 'right',
18 'downleft', 'downright',
19 'upleft', 'upright']:
18 raise page_action.PageActionNotSupported( 20 raise page_action.PageActionNotSupported(
19 'Invalid scroll direction: %s' % self.direction) 21 'Invalid scroll direction: %s' % self.direction)
20 self._selector = selector 22 self._selector = selector
21 self._text = text 23 self._text = text
22 self._element_function = element_function 24 self._element_function = element_function
23 self._left_start_ratio = left_start_ratio 25 self._left_start_ratio = left_start_ratio
24 self._top_start_ratio = top_start_ratio 26 self._top_start_ratio = top_start_ratio
25 self._direction = direction 27 self._direction = direction
26 self._speed = speed_in_pixels_per_second 28 self._speed = speed_in_pixels_per_second
27 self._use_touch = use_touch 29 self._use_touch = use_touch
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 }); 88 });
87 }''' % (self._left_start_ratio, 89 }''' % (self._left_start_ratio,
88 self._top_start_ratio, 90 self._top_start_ratio,
89 self._direction, 91 self._direction,
90 self._speed, 92 self._speed,
91 gesture_source_type) 93 gesture_source_type)
92 page_action.EvaluateCallbackWithElement( 94 page_action.EvaluateCallbackWithElement(
93 tab, code, selector=self._selector, text=self._text, 95 tab, code, selector=self._selector, text=self._text,
94 element_function=self._element_function) 96 element_function=self._element_function)
95 tab.WaitForJavaScriptExpression('window.__scrollActionDone', 60) 97 tab.WaitForJavaScriptExpression('window.__scrollActionDone', 60)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698