OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="../../http/tests/inspector/console-test.js"></script> | 4 <script src="../../http/tests/inspector/console-test.js"></script> |
5 <script src="../../http/tests/inspector/timeline-test.js"></script> | 5 <script src="../../http/tests/inspector/timeline-test.js"></script> |
6 <script> | 6 <script> |
7 | 7 |
8 function startStopTimeline() | 8 function startStopTimeline() |
9 { | 9 { |
10 console.timeStamp("timestamp 0"); | 10 console.timeStamp("timestamp 0"); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 console.timeStamp("timestamp 0"); | 71 console.timeStamp("timestamp 0"); |
72 console.timeline("one"); | 72 console.timeline("one"); |
73 console.timeStamp("timestamp 1"); | 73 console.timeStamp("timestamp 1"); |
74 console.timeline("two"); | 74 console.timeline("two"); |
75 console.timeStamp("timestamp 2"); | 75 console.timeStamp("timestamp 2"); |
76 } | 76 } |
77 | 77 |
78 function test() | 78 function test() |
79 { | 79 { |
80 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineEventRecorded, eventRecorded); | 80 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineEventRecorded, eventRecorded); |
81 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineStarted, timelineStarted); | |
82 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.E ventTypes.TimelineStopped, timelineStopped); | |
83 | 81 |
84 InspectorTest.runTestSuite([ | 82 InspectorTest.runTestSuite([ |
85 function testStartStopTimeline(next) | 83 function testStartStopTimeline(next) |
86 { | 84 { |
87 InspectorTest.evaluateInPage("startStopTimeline()", next); | 85 InspectorTest.evaluateInPage("startStopTimeline()", next); |
88 }, | 86 }, |
89 | 87 |
90 function testStartStopMultiple(next) | 88 function testStartStopMultiple(next) |
91 { | 89 { |
92 InspectorTest.evaluateInPage("startStopMultiple()", next); | 90 InspectorTest.evaluateInPage("startStopMultiple()", next); |
93 }, | 91 }, |
94 | 92 |
95 function testStartMultipleStopInsideEvals(next) | 93 function testStartMultipleStopInsideEvals(next) |
96 { | 94 { |
97 var panel = WebInspector.inspectorView.panel("timeline"); | 95 var panel = WebInspector.inspectorView.panel("timeline"); |
98 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco rdingStopped, recordingStopped); | 96 InspectorTest.addSniffer(panel._model._timelineManager, "_processBuf feredEvents", next); |
yurys
2014/07/17 10:42:24
Can we use an event for this?
| |
99 | 97 |
100 InspectorTest.evaluateInPage("startMultiple()", step2); | 98 InspectorTest.evaluateInPage("startMultiple()", step2); |
101 | 99 |
102 function step2() | 100 function step2() |
103 { | 101 { |
104 InspectorTest.evaluateInPage("stopTwo()", step3); | 102 InspectorTest.evaluateInPage("stopTwo()", step3); |
105 } | 103 } |
106 | 104 |
107 function step3() | 105 function step3() |
108 { | 106 { |
109 InspectorTest.evaluateInPage("stopOne()", function() {}); | 107 InspectorTest.evaluateInPage("stopOne()", function() {}); |
110 } | 108 } |
111 | |
112 function recordingStopped() | |
113 { | |
114 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStopped, recordingStopped); | |
115 next(); | |
116 } | |
117 }, | 109 }, |
118 | 110 |
119 function testStopUnknown(next) | 111 function testStopUnknown(next) |
120 { | 112 { |
121 InspectorTest.evaluateInPage("stopUnknown()", next); | 113 InspectorTest.evaluateInPage("stopUnknown()", next); |
122 }, | 114 }, |
123 | 115 |
124 function testStartFromPanel(next) | 116 function testStartFromPanel(next) |
125 { | 117 { |
126 var panel = WebInspector.inspectorView.panel("timeline"); | 118 var panel = WebInspector.inspectorView.panel("timeline"); |
127 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco rdingStarted, recordingStarted); | 119 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco rdingStarted, recordingStarted); |
128 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco rdingStopped, recordingStopped); | 120 InspectorTest.addSniffer(panel._model._timelineManager, "_processBuf feredEvents", next); |
129 panel._toggleTimelineButtonClicked(); | 121 panel._toggleTimelineButtonClicked(); |
130 | 122 |
131 function recordingStarted() | 123 function recordingStarted() |
132 { | 124 { |
133 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStarted, recordingStarted); | 125 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStarted, recordingStarted); |
134 InspectorTest.evaluateInPage("startStopTimeline()", step2); | 126 InspectorTest.evaluateInPage("startStopTimeline()", step2); |
135 } | 127 } |
136 | 128 |
137 function step2() | 129 function step2() |
138 { | 130 { |
139 panel._toggleTimelineButtonClicked(); | 131 panel._toggleTimelineButtonClicked(); |
140 } | 132 } |
141 | |
142 function recordingStopped() | |
143 { | |
144 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStopped, recordingStopped); | |
145 next(); | |
146 } | |
147 }, | 133 }, |
148 | 134 |
149 function testStopFromPanel(next) | 135 function testStopFromPanel(next) |
150 { | 136 { |
151 var panel = WebInspector.inspectorView.panel("timeline"); | 137 var panel = WebInspector.inspectorView.panel("timeline"); |
152 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco rdingStopped, recordingStopped); | 138 InspectorTest.addSniffer(panel._model._timelineManager, "_processBuf feredEvents", next); |
153 | 139 |
154 InspectorTest.evaluateInPage("startTimeline()", step2); | 140 InspectorTest.evaluateInPage("startTimeline()", step2); |
155 | 141 |
156 function step2() | 142 function step2() |
157 { | 143 { |
158 panel._toggleTimelineButtonClicked(); | 144 panel._toggleTimelineButtonClicked(); |
159 } | 145 } |
160 | |
161 function recordingStopped() | |
162 { | |
163 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStopped, recordingStopped); | |
164 next(); | |
165 } | |
166 }, | 146 }, |
167 | 147 |
168 function testRacyStart(next) | 148 function testRacyStart(next) |
169 { | 149 { |
170 var panel = WebInspector.inspectorView.panel("timeline"); | 150 var panel = WebInspector.inspectorView.panel("timeline"); |
171 | 151 |
172 WebInspector.timelineManager.addEventListener(WebInspector.Timelin eManager.EventTypes.TimelineStarted, timelineStarted); | 152 WebInspector.timelineManager.addEventListener(WebInspector.TimelineM anager.EventTypes.TimelineStarted, timelineStarted); |
173 WebInspector.timelineManager.addEventListener(WebInspector.Timelin eManager.EventTypes.TimelineStopped, timelineStopped); | 153 InspectorTest.addSniffer(panel._model._timelineManager, "_processBuf feredEvents", next); |
174 | |
175 InspectorTest.evaluateInPage("startTimeline()"); | |
176 panel._toggleTimelineButtonClicked(); | |
177 | 154 |
178 function timelineStarted() | 155 InspectorTest.evaluateInPage("startTimeline()"); |
179 { | 156 panel._toggleTimelineButtonClicked(); |
180 WebInspector.timelineManager.removeEventListener(WebInspector.T imelineManager.EventTypes.TimelineStarted, timelineStarted); | |
181 panel._toggleTimelineButtonClicked(); | |
182 } | |
183 | 157 |
184 function timelineStopped() | 158 function timelineStarted() |
185 { | 159 { |
186 WebInspector.timelineManager.removeEventListener(WebInspector.T imelineManager.EventTypes.TimelineStopped, timelineStopped); | 160 WebInspector.timelineManager.removeEventListener(WebInspector.Ti melineManager.EventTypes.TimelineStarted, timelineStarted); |
187 setTimeout(next); // Fool listeners order so that timeline pan el got this notification first. | 161 panel._toggleTimelineButtonClicked(); |
188 } | 162 } |
189 }, | 163 }, |
190 | 164 |
191 function testRacyStart2(next) | 165 function testRacyStart2(next) |
192 { | 166 { |
193 var panel = WebInspector.inspectorView.panel("timeline"); | 167 var panel = WebInspector.inspectorView.panel("timeline"); |
194 | 168 |
195 WebInspector.timelineManager.addEventListener(WebInspector.Timelin eManager.EventTypes.TimelineStarted, timelineStarted); | 169 WebInspector.timelineManager.addEventListener(WebInspector.TimelineM anager.EventTypes.TimelineStarted, timelineStarted); |
196 WebInspector.timelineManager.addEventListener(WebInspector.Timelin eManager.EventTypes.TimelineStopped, timelineStopped); | 170 InspectorTest.addSniffer(panel._model._timelineManager, "_processBuf feredEvents", next); |
197 | |
198 panel._toggleTimelineButtonClicked(); | |
199 InspectorTest.evaluateInPage("startTimeline()"); | |
200 | 171 |
201 function timelineStarted() | 172 panel._toggleTimelineButtonClicked(); |
202 { | 173 InspectorTest.evaluateInPage("startTimeline()"); |
203 WebInspector.timelineManager.removeEventListener(WebInspector.T imelineManager.EventTypes.TimelineStarted, timelineStarted); | |
204 // Fool listener order execution. | |
205 setTimeout(panel._toggleTimelineButtonClicked.bind(panel)); | |
206 } | |
207 | 174 |
208 function timelineStopped() | 175 function timelineStarted() |
209 { | 176 { |
210 WebInspector.timelineManager.removeEventListener(WebInspector.T imelineManager.EventTypes.TimelineStopped, timelineStopped); | 177 WebInspector.timelineManager.removeEventListener(WebInspector.Ti melineManager.EventTypes.TimelineStarted, timelineStarted); |
211 setTimeout(next); // Fool listeners order so that timeline pan el got this notification first. | 178 // Fool listener order execution. |
212 } | 179 setTimeout(panel._toggleTimelineButtonClicked.bind(panel)); |
213 } | 180 } |
181 } | |
214 ]); | 182 ]); |
215 | 183 |
216 function eventRecorded(event) | 184 function eventRecorded(event) |
217 { | 185 { |
218 function print(record) | 186 function print(record) |
219 { | 187 { |
220 if (record.type === "TimeStamp") | 188 if (record.type === "TimeStamp") |
221 InspectorTest.addResult(record.data.message); | 189 InspectorTest.addResult(record.data.message); |
222 | 190 |
223 for (var i = 0; record.children && i < record.children.length; ++i) | 191 for (var i = 0; record.children && i < record.children.length; ++i) |
224 print(record.children[i]); | 192 print(record.children[i]); |
225 } | 193 } |
226 print(event.data); | 194 print(event.data); |
227 } | 195 } |
228 | |
229 function timelineStarted(event) | |
230 { | |
231 InspectorTest.addResult("Timeline started from " + (event.data ? "consol e." : "panel")); | |
232 } | |
233 | |
234 function timelineStopped(event) | |
235 { | |
236 InspectorTest.addResult("Timeline stopped from " + (event.data ? "consol e." : "panel")); | |
237 } | |
238 } | 196 } |
239 | 197 |
240 </script> | 198 </script> |
241 </head> | 199 </head> |
242 | 200 |
243 <body onload="runTest()"> | 201 <body onload="runTest()"> |
244 <p> | 202 <p> |
245 Tests console.timeline and timelineEnd commands. | 203 Tests console.timeline and timelineEnd commands. |
246 </p> | 204 </p> |
247 | 205 |
248 </body> | 206 </body> |
249 </html> | 207 </html> |
OLD | NEW |