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

Side by Side Diff: LayoutTests/inspector/console/console-timeline.html

Issue 24027002: DevTools: implement console.timeline/timelineEnd. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review comments addressed. Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/console-test.js"></script>
5 <script src="../../http/tests/inspector/timeline-test.js"></script>
6 <script>
7
8 function startStopTimeline()
9 {
10 console.timeStamp("timestamp 0");
11 console.timeline("one");
12 console.timeStamp("timestamp 1");
13 console.timelineEnd("one");
14 console.timeStamp("timestamp 2");
15 }
16
17 function startStopMultiple()
18 {
19 console.timeStamp("timestamp 0");
20 console.timeline("one");
21 console.timeStamp("timestamp 1");
22 console.timeline("one");
23 console.timeline("two");
24 console.timeline("two");
25 console.timelineEnd("two");
26 console.timeStamp("timestamp 2");
27 console.timelineEnd("one");
28 console.timeStamp("timestamp 3");
29 console.timelineEnd("two");
30 console.timeStamp("timestamp 4");
31 console.timelineEnd("one");
32 console.timeStamp("timestamp 5");
33 }
34
35 function stopUnknown()
36 {
37 console.timeStamp("timestamp 0");
38 console.timeline("one");
39 console.timeStamp("timestamp 1");
40 console.timelineEnd("two");
41 console.timeStamp("timestamp 2");
42 console.timelineEnd("one");
43 console.timeStamp("timestamp 3");
44 }
45
46 function startTimeline()
47 {
48 console.timeStamp("timestamp 0");
49 console.timeline("one");
50 console.timeStamp("timestamp 1");
51 console.timeline("two");
52 console.timeStamp("timestamp 2");
53 }
54
55 function test()
56 {
57 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineEventRecorded, eventRecorded);
58 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineStarted, timelineStarted);
59 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineStopped, timelineStopped);
60
61 InspectorTest.runTestSuite([
62 function testStartStopTimeline(next)
63 {
64 InspectorTest.evaluateInPage("startStopTimeline()", next);
65 },
66
67 function testStartStopMultiple(next)
68 {
69 InspectorTest.evaluateInPage("startStopMultiple()", next);
70 },
71
72 function testStopUnknown(next)
73 {
74 InspectorTest.evaluateInPage("stopUnknown()", next);
75 },
76
77 function testStartFromPanel(next)
78 {
79 var panel = WebInspector.panel("timeline");
80 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco rdingStarted, recordingStarted);
81 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco rdingStopped, recordingStopped);
82 panel._toggleTimelineButtonClicked();
83
84 function recordingStarted()
85 {
86 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStarted, recordingStarted);
87 InspectorTest.evaluateInPage("startStopTimeline()", step2);
88 }
89
90 function step2()
91 {
92 panel._toggleTimelineButtonClicked();
93 }
94
95 function recordingStopped()
96 {
97 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStopped, recordingStopped);
98 next();
99 }
100 },
101
102 function testStopFromPanel(next)
103 {
104 var panel = WebInspector.panel("timeline");
105 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco rdingStopped, recordingStopped);
106
107 InspectorTest.evaluateInPage("startTimeline()", step2);
108
109 function step2()
110 {
111 panel._toggleTimelineButtonClicked();
112 }
113
114 function recordingStopped()
115 {
116 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStopped, recordingStopped);
117 next();
118 }
119 },
120
121 function testRacyStart(next)
122 {
123 var panel = WebInspector.panel("timeline");
124
125 WebInspector.timelineManager.addEventListener(WebInspector.Timelin eManager.EventTypes.TimelineStarted, timelineStarted);
126 WebInspector.timelineManager.addEventListener(WebInspector.Timelin eManager.EventTypes.TimelineStopped, timelineStopped);
127
128 InspectorTest.evaluateInPage("startTimeline()");
129 panel._toggleTimelineButtonClicked();
130
131 function timelineStarted()
132 {
133 WebInspector.timelineManager.removeEventListener(WebInspector.T imelineManager.EventTypes.TimelineStarted, timelineStarted);
134 panel._toggleTimelineButtonClicked();
135 }
136
137 function timelineStopped()
138 {
139 WebInspector.timelineManager.removeEventListener(WebInspector.T imelineManager.EventTypes.TimelineStopped, timelineStopped);
140 next();
141 }
142 },
143
144 function testRacyStart2(next)
145 {
146 var panel = WebInspector.panel("timeline");
147
148 WebInspector.timelineManager.addEventListener(WebInspector.Timelin eManager.EventTypes.TimelineStarted, timelineStarted);
149 WebInspector.timelineManager.addEventListener(WebInspector.Timelin eManager.EventTypes.TimelineStopped, timelineStopped);
150
151 panel._toggleTimelineButtonClicked();
152 InspectorTest.evaluateInPage("startTimeline()");
153
154 function timelineStarted()
155 {
156 WebInspector.timelineManager.removeEventListener(WebInspector.T imelineManager.EventTypes.TimelineStarted, timelineStarted);
157 // Fool listener order execution.
158 setTimeout(function() { panel._toggleTimelineButtonClicked(); } , 0);
159 }
160
161 function timelineStopped()
162 {
163 WebInspector.timelineManager.removeEventListener(WebInspector.T imelineManager.EventTypes.TimelineStopped, timelineStopped);
164 next();
165 }
166 }
167 ]);
168
169 function eventRecorded(event)
170 {
171 function print(record)
172 {
173 if (record.type === "TimeStamp")
174 InspectorTest.addResult(record.data.message);
175
176 for (var i = 0; record.children && i < record.children.length; ++i)
177 print(record.children[i]);
178 }
179 print(event.data);
180 }
181
182 function timelineStarted(event)
183 {
184 InspectorTest.addResult("Timeline started from " + (event.data ? "consol e." : "panel"));
185 }
186
187 function timelineStopped(event)
188 {
189 InspectorTest.addResult("Timeline stopped from " + (event.data ? "consol e." : "panel"));
190 }
191 }
192
193 </script>
194 </head>
195
196 <body onload="runTest()">
197 <p>
198 Tests console.timeline and timelineEnd commands.
199 </p>
200
201 </body>
202 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698