Index: tools/telemetry/telemetry/page/actions/page_action.py |
diff --git a/tools/telemetry/telemetry/page/actions/page_action.py b/tools/telemetry/telemetry/page/actions/page_action.py |
index 0acc1e3f309c3d06b41d38a1af421c7d7e34c692..eca96a594f63ac63e7790027b025177df6dbdc4c 100644 |
--- a/tools/telemetry/telemetry/page/actions/page_action.py |
+++ b/tools/telemetry/telemetry/page/actions/page_action.py |
@@ -4,6 +4,8 @@ |
import re |
+from telemetry import decorators |
+ |
class PageActionNotSupported(Exception): |
pass |
@@ -14,11 +16,6 @@ class PageActionFailed(Exception): |
class PageAction(object): |
"""Represents an action that a user might try to perform to a page.""" |
- def __init__(self, attributes=None): |
- if attributes: |
- for k, v in attributes.iteritems(): |
- setattr(self, k, v) |
- |
def WillRunAction(self, tab): |
"""Override to do action-specific setup before |
Test.WillRunAction is called.""" |
@@ -30,7 +27,6 @@ class PageAction(object): |
def CleanUp(self, tab): |
pass |
- |
def EvaluateCallbackWithElement( |
tab, callback_js, selector=None, text=None, element_function=None, |
wait=False, timeout_in_seconds=60): |
@@ -114,3 +110,23 @@ def EvaluateCallbackWithElement( |
def _EscapeSelector(selector): |
return selector.replace('\'', '\\\'') |
+ |
+def GetGestureSourceTypeFromOptions(tab): |
+ gesture_source_type = tab.browser.synthetic_gesture_source_type |
+ return 'chrome.gpuBenchmarking.' + gesture_source_type.upper() + '_INPUT' |
+ |
+@decorators.Cache |
+def IsGestureSourceTypeSupported(tab, gesture_source_type): |
+ # TODO(dominikg): remove once support for |
+ # 'chrome.gpuBenchmarking.gestureSourceTypeSupported' has |
+ # been rolled into reference build. |
+ if tab.EvaluateJavaScript(""" |
+ typeof chrome.gpuBenchmarking.gestureSourceTypeSupported === |
+ 'undefined'"""): |
+ return (tab.browser.platform.GetOSName() != 'mac' or |
+ gesture_source_type.lower() != 'touch') |
+ |
+ return tab.EvaluateJavaScript(""" |
+ chrome.gpuBenchmarking.gestureSourceTypeSupported( |
+ chrome.gpuBenchmarking.%s_INPUT)""" |
+ % (gesture_source_type.upper())) |