Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: tools/telemetry/telemetry/page/action_runner.py

Issue 1087023003: [Telemetry] Remove action_runner.BeginGestureInteraction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/perf/page_sets/key_desktop_move_cases.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 class ActionRunner(object): 28 class ActionRunner(object):
29 29
30 def __init__(self, tab, skip_waits=False): 30 def __init__(self, tab, skip_waits=False):
31 self._tab = tab 31 self._tab = tab
32 self._skip_waits = skip_waits 32 self._skip_waits = skip_waits
33 33
34 def _RunAction(self, action): 34 def _RunAction(self, action):
35 action.WillRunAction(self._tab) 35 action.WillRunAction(self._tab)
36 action.RunAction(self._tab) 36 action.RunAction(self._tab)
37 37
38 # TODO(nednguyen): remove this API when crbug.com/475090 is fixed.
39 def _BeginInteraction(self, label, repeatable=False):
40 """Marks the beginning of an interaction record.
41
42 An interaction record is a labeled time period containing
43 interaction that developers care about. Each set of metrics
44 specified in flags will be calculated for this time period.. The
45 End() method in the returned object must be called once to mark
46 the end of the timeline.
47
48 Args:
49 label: A label for this particular interaction. This can be any
50 user-defined string, but must not contain '/'.
51 repeatable: Whether other interactions may use the same logical name
52 as this interaction. All interactions with the same logical name must
53 have the same flags.
54 """
55 flags = []
56 if repeatable:
57 flags.append(timeline_interaction_record.REPEATABLE)
58
59 interaction = Interaction(self._tab, label, flags)
60 interaction.Begin()
61 return interaction
62
63 # TODO(nednguyen): remove this API when crbug.com/475090 is fixed.
64 def BeginGestureInteraction(self, label, repeatable=False):
65 """Marks the beginning of a gesture-based interaction record.
66
67 This is similar to normal interaction record, but it will
68 auto-narrow the interaction time period to only include the
69 synthetic gesture event output by Chrome. This is typically use to
70 reduce noise in gesture-based analysis (e.g., analysis for a
71 swipe/scroll).
72
73 The interaction record label will be prepended with 'Gesture_'.
74
75 Args:
76 label: A label for this particular interaction. This can be any
77 user-defined string, but must not contain '/'.
78 repeatable: Whether other interactions may use the same logical name
79 as this interaction. All interactions with the same logical name must
80 have the same flags.
81 """
82 return self._BeginInteraction('Gesture_' + label, repeatable)
83
84 def CreateInteraction(self, label, repeatable=False): 38 def CreateInteraction(self, label, repeatable=False):
85 """ Create an action.Interaction object that issues interaction record. 39 """ Create an action.Interaction object that issues interaction record.
86 40
87 An interaction record is a labeled time period containing 41 An interaction record is a labeled time period containing
88 interaction that developers care about. Each set of metrics 42 interaction that developers care about. Each set of metrics
89 specified in flags will be calculated for this time period. 43 specified in flags will be calculated for this time period.
90 44
91 To mark the start of interaction record, call Begin() method on the returned 45 To mark the start of interaction record, call Begin() method on the returned
92 object. To mark the finish of interaction record, call End() method on 46 object. To mark the finish of interaction record, call End() method on
93 it. Or better yet, use the with statement to create an 47 it. Or better yet, use the with statement to create an
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 self._action_runner.ExecuteJavaScript('console.time("%s");' % 660 self._action_runner.ExecuteJavaScript('console.time("%s");' %
707 timeline_interaction_record.GetJavaScriptMarker( 661 timeline_interaction_record.GetJavaScriptMarker(
708 self._label, self._flags)) 662 self._label, self._flags))
709 663
710 def End(self): 664 def End(self):
711 assert self._started 665 assert self._started
712 self._started = False 666 self._started = False
713 self._action_runner.ExecuteJavaScript('console.timeEnd("%s");' % 667 self._action_runner.ExecuteJavaScript('console.timeEnd("%s");' %
714 timeline_interaction_record.GetJavaScriptMarker( 668 timeline_interaction_record.GetJavaScriptMarker(
715 self._label, self._flags)) 669 self._label, self._flags))
OLDNEW
« no previous file with comments | « tools/perf/page_sets/key_desktop_move_cases.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698