OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 telemetry.core.timeline.bounds as timeline_bounds | 5 import telemetry.core.timeline.bounds as timeline_bounds |
6 from telemetry.page.actions import page_action | 6 from telemetry.page.actions import page_action |
7 from telemetry.page.actions import wait | 7 from telemetry.page.actions import wait |
8 | 8 |
9 class GestureAction(page_action.PageAction): | 9 class GestureAction(page_action.PageAction): |
10 def __init__(self, attributes=None): | 10 def __init__(self, attributes=None): |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 tab.ExecuteJavaScript( | 24 tab.ExecuteJavaScript( |
25 'console.timeEnd("' + self._GetUniqueTimelineMarkerName() + '")') | 25 'console.timeEnd("' + self._GetUniqueTimelineMarkerName() + '")') |
26 | 26 |
27 if self.wait_action: | 27 if self.wait_action: |
28 self.wait_action.RunAction(page, tab, previous_action) | 28 self.wait_action.RunAction(page, tab, previous_action) |
29 | 29 |
30 def RunGesture(self, page, tab, previous_action): | 30 def RunGesture(self, page, tab, previous_action): |
31 raise NotImplementedError() | 31 raise NotImplementedError() |
32 | 32 |
33 def CustomizeBrowserOptions(self, options): | 33 def CustomizeBrowserOptionsForPageSet(self, options): |
34 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') | 34 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') |
35 | 35 |
36 def GetActiveRangeOnTimeline(self, timeline): | 36 def GetActiveRangeOnTimeline(self, timeline): |
37 action_range = super(GestureAction, self).GetActiveRangeOnTimeline(timeline) | 37 action_range = super(GestureAction, self).GetActiveRangeOnTimeline(timeline) |
38 if action_range.is_empty: | 38 if action_range.is_empty: |
39 raise page_action.PageActionInvalidTimelineMarker( | 39 raise page_action.PageActionInvalidTimelineMarker( |
40 'Gesture action requires timeline marker to determine active range.') | 40 'Gesture action requires timeline marker to determine active range.') |
41 | 41 |
42 # The synthetic gesture controller inserts a trace marker to precisely | 42 # The synthetic gesture controller inserts a trace marker to precisely |
43 # demarcate when the gesture was running. Find the trace marker that belongs | 43 # demarcate when the gesture was running. Find the trace marker that belongs |
(...skipping 11 matching lines...) Expand all Loading... |
55 raise page_action.PageActionInvalidTimelineMarker( | 55 raise page_action.PageActionInvalidTimelineMarker( |
56 'More than one possible synthetic gesture marker found in timeline.') | 56 'More than one possible synthetic gesture marker found in timeline.') |
57 | 57 |
58 active_range = timeline_bounds.Bounds.CreateFromEvent(gesture_events[0]) | 58 active_range = timeline_bounds.Bounds.CreateFromEvent(gesture_events[0]) |
59 | 59 |
60 if self.wait_action: | 60 if self.wait_action: |
61 active_range.AddBounds( | 61 active_range.AddBounds( |
62 self.wait_action.GetActiveRangeOnTimeline(timeline)) | 62 self.wait_action.GetActiveRangeOnTimeline(timeline)) |
63 | 63 |
64 return active_range | 64 return active_range |
OLD | NEW |