| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 logging | 5 import logging |
| 6 import time | 6 import time |
| 7 import urlparse | 7 import urlparse |
| 8 | 8 |
| 9 from telemetry.core import exceptions | 9 from telemetry.core import exceptions |
| 10 from telemetry.internal.actions.drag import DragAction | 10 from telemetry.internal.actions.drag import DragAction |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 def __init__(self, tab, skip_waits=False): | 45 def __init__(self, tab, skip_waits=False): |
| 46 self._tab = tab | 46 self._tab = tab |
| 47 self._skip_waits = skip_waits | 47 self._skip_waits = skip_waits |
| 48 | 48 |
| 49 @property | 49 @property |
| 50 def tab(self): | 50 def tab(self): |
| 51 """Returns the tab on which actions are performed.""" | 51 """Returns the tab on which actions are performed.""" |
| 52 return self._tab | 52 return self._tab |
| 53 | 53 |
| 54 def _RunAction(self, action): | 54 def _RunAction(self, action): |
| 55 action.WillRunAction(self._tab) | 55 try: |
| 56 action.RunAction(self._tab) | 56 if action.SimulatesUserInput(): |
| 57 self._tab.browser.SetInteractivityBoost(True) |
| 58 action.WillRunAction(self._tab) |
| 59 action.RunAction(self._tab) |
| 60 finally: |
| 61 if action.SimulatesUserInput(): |
| 62 self._tab.browser.SetInteractivityBoost(False) |
| 57 | 63 |
| 58 def CreateInteraction(self, label, repeatable=False): | 64 def CreateInteraction(self, label, repeatable=False): |
| 59 """ Create an action.Interaction object that issues interaction record. | 65 """ Create an action.Interaction object that issues interaction record. |
| 60 | 66 |
| 61 An interaction record is a labeled time period containing | 67 An interaction record is a labeled time period containing |
| 62 interaction that developers care about. Each set of metrics | 68 interaction that developers care about. Each set of metrics |
| 63 specified in flags will be calculated for this time period. | 69 specified in flags will be calculated for this time period. |
| 64 | 70 |
| 65 To mark the start of interaction record, call Begin() method on the returned | 71 To mark the start of interaction record, call Begin() method on the returned |
| 66 object. To mark the finish of interaction record, call End() method on | 72 object. To mark the finish of interaction record, call End() method on |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 marker=timeline_interaction_record.GetJavaScriptMarker( | 858 marker=timeline_interaction_record.GetJavaScriptMarker( |
| 853 self._label, self._flags)) | 859 self._label, self._flags)) |
| 854 | 860 |
| 855 def End(self): | 861 def End(self): |
| 856 assert self._started | 862 assert self._started |
| 857 self._started = False | 863 self._started = False |
| 858 self._action_runner.ExecuteJavaScript( | 864 self._action_runner.ExecuteJavaScript( |
| 859 'console.timeEnd({{ marker }});', | 865 'console.timeEnd({{ marker }});', |
| 860 marker=timeline_interaction_record.GetJavaScriptMarker( | 866 marker=timeline_interaction_record.GetJavaScriptMarker( |
| 861 self._label, self._flags)) | 867 self._label, self._flags)) |
| OLD | NEW |