OLD | NEW |
---|---|
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 | 4 |
5 import re | 5 import re |
6 | 6 |
7 from py_trace_event import trace_event | |
8 | |
7 from telemetry import decorators | 9 from telemetry import decorators |
8 | 10 |
11 | |
petrcermak
2016/09/07 09:38:24
nit: there should be only 2 blank lines (please re
nednguyen
2016/09/07 17:26:12
Done.
| |
12 | |
9 GESTURE_SOURCE_DEFAULT = 'DEFAULT' | 13 GESTURE_SOURCE_DEFAULT = 'DEFAULT' |
10 GESTURE_SOURCE_MOUSE = 'MOUSE' | 14 GESTURE_SOURCE_MOUSE = 'MOUSE' |
11 GESTURE_SOURCE_TOUCH = 'TOUCH' | 15 GESTURE_SOURCE_TOUCH = 'TOUCH' |
12 SUPPORTED_GESTURE_SOURCES = (GESTURE_SOURCE_DEFAULT, | 16 SUPPORTED_GESTURE_SOURCES = (GESTURE_SOURCE_DEFAULT, |
13 GESTURE_SOURCE_MOUSE, | 17 GESTURE_SOURCE_MOUSE, |
14 GESTURE_SOURCE_TOUCH) | 18 GESTURE_SOURCE_TOUCH) |
15 | 19 |
16 class PageActionNotSupported(Exception): | 20 class PageActionNotSupported(Exception): |
17 pass | 21 pass |
18 | 22 |
19 class PageActionFailed(Exception): | 23 class PageActionFailed(Exception): |
20 pass | 24 pass |
21 | 25 |
22 | 26 |
23 class PageAction(object): | 27 class PageAction(object): |
24 """Represents an action that a user might try to perform to a page.""" | 28 """Represents an action that a user might try to perform to a page.""" |
25 | 29 |
30 __metaclass__ = trace_event.TracedMetaClass | |
31 | |
26 def WillRunAction(self, tab): | 32 def WillRunAction(self, tab): |
27 """Override to do action-specific setup before | 33 """Override to do action-specific setup before |
28 Test.WillRunAction is called.""" | 34 Test.WillRunAction is called.""" |
29 pass | 35 pass |
30 | 36 |
31 def RunAction(self, tab): | 37 def RunAction(self, tab): |
32 raise NotImplementedError() | 38 raise NotImplementedError() |
33 | 39 |
34 def CleanUp(self, tab): | 40 def CleanUp(self, tab): |
35 pass | 41 pass |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 if tab.EvaluateJavaScript(""" | 133 if tab.EvaluateJavaScript(""" |
128 typeof chrome.gpuBenchmarking.gestureSourceTypeSupported === | 134 typeof chrome.gpuBenchmarking.gestureSourceTypeSupported === |
129 'undefined'"""): | 135 'undefined'"""): |
130 return (tab.browser.platform.GetOSName() != 'mac' or | 136 return (tab.browser.platform.GetOSName() != 'mac' or |
131 gesture_source_type.lower() != 'touch') | 137 gesture_source_type.lower() != 'touch') |
132 | 138 |
133 return tab.EvaluateJavaScript(""" | 139 return tab.EvaluateJavaScript(""" |
134 chrome.gpuBenchmarking.gestureSourceTypeSupported( | 140 chrome.gpuBenchmarking.gestureSourceTypeSupported( |
135 chrome.gpuBenchmarking.%s_INPUT)""" | 141 chrome.gpuBenchmarking.%s_INPUT)""" |
136 % (gesture_source_type.upper())) | 142 % (gesture_source_type.upper())) |
OLD | NEW |