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

Unified Diff: tools/telemetry/telemetry/page/actions/scroll.py

Issue 134243004: Telemetry: allow user to specify source type for synthetic gestures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-upload Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/telemetry/telemetry/page/actions/scroll.js ('k') | tools/telemetry/telemetry/page/actions/swipe.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/actions/scroll.py
diff --git a/tools/telemetry/telemetry/page/actions/scroll.py b/tools/telemetry/telemetry/page/actions/scroll.py
index cd5024d069a74f3c15ac546103f1fd8de3bcee2c..a3dcf30bf6d608633d60cc67bac43564399dae4d 100644
--- a/tools/telemetry/telemetry/page/actions/scroll.py
+++ b/tools/telemetry/telemetry/page/actions/scroll.py
@@ -3,10 +3,10 @@
# found in the LICENSE file.
import os
-from telemetry.page.actions import gesture_action
+from telemetry.page.actions.gesture_action import GestureAction
from telemetry.page.actions import page_action
-class ScrollAction(gesture_action.GestureAction):
+class ScrollAction(GestureAction):
def __init__(self, attributes=None):
super(ScrollAction, self).__init__(attributes)
self._SetTimelineMarkerBaseName('ScrollAction::RunAction')
@@ -25,12 +25,17 @@ class ScrollAction(gesture_action.GestureAction):
# Fail if this action requires touch and we can't send touch events.
# TODO(dominikg): Query synthetic gesture target to check if touch is
# supported.
- if (hasattr(self, 'scroll_requires_touch') and
- self.scroll_requires_touch and not
- tab.EvaluateJavaScript(
+ if hasattr(self, 'scroll_requires_touch'):
+ if (self.scroll_requires_touch and not
+ tab.EvaluateJavaScript(
'chrome.gpuBenchmarking.smoothScrollBySendsTouch()')):
- raise page_action.PageActionNotSupported(
- 'Touch scroll not supported for this browser')
+ raise page_action.PageActionNotSupported(
+ 'Touch scroll not supported for this browser')
+
+ if (GestureAction.GetGestureSourceTypeFromOptions(tab) ==
+ 'chrome.gpuBenchmarking.MOUSE_INPUT'):
+ raise page_action.PageActionNotSupported(
+ 'Scroll requires touch on this page but mouse input was requested')
distance_func = 'null'
if hasattr(self, 'scroll_distance_function'):
@@ -52,7 +57,7 @@ class ScrollAction(gesture_action.GestureAction):
top_start_percentage = 0.5
direction = 'down'
speed = 800
- gesture_source_type = 'chrome.gpuBenchmarking.DEFAULT_INPUT'
+ gesture_source_type = GestureAction.GetGestureSourceTypeFromOptions(tab)
if hasattr(self, 'left_start_percentage'):
left_start_percentage = self.left_start_percentage
if hasattr(self, 'top_start_percentage'):
« no previous file with comments | « tools/telemetry/telemetry/page/actions/scroll.js ('k') | tools/telemetry/telemetry/page/actions/swipe.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698