| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 telemetry.core.timeline.bounds as timeline_bounds | 5 import telemetry.core.timeline.bounds as timeline_bounds |
| 6 | 6 |
| 7 class PageActionNotSupported(Exception): | 7 class PageActionNotSupported(Exception): |
| 8 pass | 8 pass |
| 9 | 9 |
| 10 class PageActionFailed(Exception): | 10 class PageActionFailed(Exception): |
| 11 pass | 11 pass |
| 12 | 12 |
| 13 class PageActionInvalidTimelineMarker(Exception): | 13 class PageActionInvalidTimelineMarker(Exception): |
| 14 pass | 14 pass |
| 15 | 15 |
| 16 class PageAction(object): | 16 class PageAction(object): |
| 17 """Represents an action that a user might try to perform to a page.""" | 17 """Represents an action that a user might try to perform to a page.""" |
| 18 _next_timeline_marker_id = 0 | 18 _next_timeline_marker_id = 0 |
| 19 | 19 |
| 20 def __init__(self, attributes=None): | 20 def __init__(self, attributes=None): |
| 21 if attributes: | 21 if attributes: |
| 22 for k, v in attributes.iteritems(): | 22 self.SetAttributes(attributes) |
| 23 setattr(self, k, v) | |
| 24 self._timeline_marker_base_name = None | 23 self._timeline_marker_base_name = None |
| 25 self._timeline_marker_id = None | 24 self._timeline_marker_id = None |
| 26 | 25 |
| 26 def SetAttributes(self, attributes): |
| 27 for k, v in attributes.iteritems(): |
| 28 setattr(self, k, v) |
| 29 |
| 27 def CustomizeBrowserOptionsForPageSet(self, options): | 30 def CustomizeBrowserOptionsForPageSet(self, options): |
| 28 """Override to add action-specific options to the BrowserOptions | 31 """Override to add action-specific options to the BrowserOptions |
| 29 object. These options will be set for the whole page set. | 32 object. These options will be set for the whole page set. |
| 30 | 33 |
| 31 If the browser is not being restarted for every page in the page set then | 34 If the browser is not being restarted for every page in the page set then |
| 32 all browser options required for the action must be set here. This, however, | 35 all browser options required for the action must be set here. This, however, |
| 33 requires that they do not conflict with options require by other actions | 36 requires that they do not conflict with options require by other actions |
| 34 used up by the page set. | 37 used up by the page set. |
| 35 """ | 38 """ |
| 36 pass | 39 pass |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 106 |
| 104 def GetActiveRangeOnTimeline(self, timeline): | 107 def GetActiveRangeOnTimeline(self, timeline): |
| 105 active_range = timeline_bounds.Bounds() | 108 active_range = timeline_bounds.Bounds() |
| 106 | 109 |
| 107 if self._GetUniqueTimelineMarkerName(): | 110 if self._GetUniqueTimelineMarkerName(): |
| 108 active_range.AddEvent( | 111 active_range.AddEvent( |
| 109 timeline.GetEventOfName(self._GetUniqueTimelineMarkerName(), | 112 timeline.GetEventOfName(self._GetUniqueTimelineMarkerName(), |
| 110 True, True)) | 113 True, True)) |
| 111 | 114 |
| 112 return active_range | 115 return active_range |
| OLD | NEW |