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 panel._model._currentTarget = WebInspector.targetManager.mainTarget( ); |
97 InspectorTest.addSniffer(panel._model._currentTarget.timelineManager , "_processBufferedEvents", next); | |
99 | 98 |
100 InspectorTest.evaluateInPage("startMultiple()", step2); | 99 InspectorTest.evaluateInPage("startMultiple()", step2); |
101 | 100 |
102 function step2() | 101 function step2() |
103 { | 102 { |
104 InspectorTest.evaluateInPage("stopTwo()", step3); | 103 InspectorTest.evaluateInPage("stopTwo()", step3); |
105 } | 104 } |
106 | 105 |
107 function step3() | 106 function step3() |
108 { | 107 { |
109 InspectorTest.evaluateInPage("stopOne()", function() {}); | 108 InspectorTest.evaluateInPage("stopOne()", function() {}); |
110 } | 109 } |
111 | |
112 function recordingStopped() | |
113 { | |
114 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStopped, recordingStopped); | |
115 next(); | |
116 } | |
117 }, | 110 }, |
118 | 111 |
119 function testStopUnknown(next) | 112 function testStopUnknown(next) |
120 { | 113 { |
121 InspectorTest.evaluateInPage("stopUnknown()", next); | 114 InspectorTest.evaluateInPage("stopUnknown()", next); |
122 }, | 115 }, |
123 | 116 |
124 function testStartFromPanel(next) | 117 function testStartFromPanel(next) |
125 { | 118 { |
126 var panel = WebInspector.inspectorView.panel("timeline"); | 119 var panel = WebInspector.inspectorView.panel("timeline"); |
127 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco rdingStarted, recordingStarted); | 120 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco rdingStarted, recordingStarted); |
128 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco rdingStopped, recordingStopped); | 121 InspectorTest.addSniffer(panel._model._currentTarget.timelineManager , "_processBufferedEvents", next); |
129 panel._toggleTimelineButtonClicked(); | 122 panel._toggleTimelineButtonClicked(); |
130 | 123 |
131 function recordingStarted() | 124 function recordingStarted() |
132 { | 125 { |
133 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStarted, recordingStarted); | 126 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStarted, recordingStarted); |
134 InspectorTest.evaluateInPage("startStopTimeline()", step2); | 127 InspectorTest.evaluateInPage("startStopTimeline()", step2); |
135 } | 128 } |
136 | 129 |
137 function step2() | 130 function step2() |
138 { | 131 { |
139 panel._toggleTimelineButtonClicked(); | 132 panel._toggleTimelineButtonClicked(); |
140 } | 133 } |
141 | |
142 function recordingStopped() | |
143 { | |
144 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStopped, recordingStopped); | |
145 next(); | |
146 } | |
147 }, | 134 }, |
148 | 135 |
149 function testStopFromPanel(next) | 136 function testStopFromPanel(next) |
150 { | 137 { |
151 var panel = WebInspector.inspectorView.panel("timeline"); | 138 var panel = WebInspector.inspectorView.panel("timeline"); |
152 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco rdingStopped, recordingStopped); | 139 InspectorTest.addSniffer(panel._model._currentTarget.timelineManager , "_processBufferedEvents", next); |
153 | 140 |
154 InspectorTest.evaluateInPage("startTimeline()", step2); | 141 InspectorTest.evaluateInPage("startTimeline()", step2); |
155 | 142 |
156 function step2() | 143 function step2() |
157 { | 144 { |
158 panel._toggleTimelineButtonClicked(); | 145 panel._toggleTimelineButtonClicked(); |
159 } | 146 } |
160 | |
161 function recordingStopped() | |
162 { | |
163 panel._model.removeEventListener(WebInspector.TimelineModel.Even ts.RecordingStopped, recordingStopped); | |
164 next(); | |
165 } | |
166 }, | 147 }, |
167 | 148 |
168 function testRacyStart(next) | 149 function testRacyStart(next) |
169 { | 150 { |
170 var panel = WebInspector.inspectorView.panel("timeline"); | 151 var panel = WebInspector.inspectorView.panel("timeline"); |
171 | 152 |
172 WebInspector.timelineManager.addEventListener(WebInspector.Timelin eManager.EventTypes.TimelineStarted, timelineStarted); | 153 WebInspector.timelineManager.addEventListener(WebInspector.TimelineM anager.EventTypes.TimelineStarted, timelineStarted); |
173 WebInspector.timelineManager.addEventListener(WebInspector.Timelin eManager.EventTypes.TimelineStopped, timelineStopped); | 154 InspectorTest.addSniffer(panel._model._currentTarget.timelineManager , "_processBufferedEvents", next); |
yurys
2014/07/24 16:58:37
Consider introducing event for this.
loislo
2014/07/28 14:00:05
Done.
| |
174 | |
175 InspectorTest.evaluateInPage("startTimeline()"); | |
176 panel._toggleTimelineButtonClicked(); | |
177 | 155 |
178 function timelineStarted() | 156 InspectorTest.evaluateInPage("startTimeline()"); |
179 { | 157 panel._toggleTimelineButtonClicked(); |
180 WebInspector.timelineManager.removeEventListener(WebInspector.T imelineManager.EventTypes.TimelineStarted, timelineStarted); | |
181 panel._toggleTimelineButtonClicked(); | |
182 } | |
183 | 158 |
184 function timelineStopped() | 159 function timelineStarted() |
185 { | 160 { |
186 WebInspector.timelineManager.removeEventListener(WebInspector.T imelineManager.EventTypes.TimelineStopped, timelineStopped); | 161 WebInspector.timelineManager.removeEventListener(WebInspector.Ti melineManager.EventTypes.TimelineStarted, timelineStarted); |
187 setTimeout(next); // Fool listeners order so that timeline pan el got this notification first. | 162 panel._toggleTimelineButtonClicked(); |
188 } | 163 } |
189 }, | 164 }, |
190 | 165 |
191 function testRacyStart2(next) | 166 function testRacyStart2(next) |
192 { | 167 { |
193 var panel = WebInspector.inspectorView.panel("timeline"); | 168 var panel = WebInspector.inspectorView.panel("timeline"); |
194 | 169 |
195 WebInspector.timelineManager.addEventListener(WebInspector.Timelin eManager.EventTypes.TimelineStarted, timelineStarted); | 170 WebInspector.timelineManager.addEventListener(WebInspector.TimelineM anager.EventTypes.TimelineStarted, timelineStarted); |
196 WebInspector.timelineManager.addEventListener(WebInspector.Timelin eManager.EventTypes.TimelineStopped, timelineStopped); | 171 InspectorTest.addSniffer(panel._model._currentTarget.timelineManager , "_processBufferedEvents", next); |
197 | |
198 panel._toggleTimelineButtonClicked(); | |
199 InspectorTest.evaluateInPage("startTimeline()"); | |
200 | 172 |
201 function timelineStarted() | 173 panel._toggleTimelineButtonClicked(); |
202 { | 174 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 | 175 |
208 function timelineStopped() | 176 function timelineStarted() |
209 { | 177 { |
210 WebInspector.timelineManager.removeEventListener(WebInspector.T imelineManager.EventTypes.TimelineStopped, timelineStopped); | 178 WebInspector.timelineManager.removeEventListener(WebInspector.Ti melineManager.EventTypes.TimelineStarted, timelineStarted); |
211 setTimeout(next); // Fool listeners order so that timeline pan el got this notification first. | 179 // Fool listener order execution. |
212 } | 180 setTimeout(panel._toggleTimelineButtonClicked.bind(panel)); |
213 } | 181 } |
182 } | |
214 ]); | 183 ]); |
215 | 184 |
216 function eventRecorded(event) | 185 function eventRecorded(event) |
217 { | 186 { |
218 function print(record) | 187 function print(record) |
219 { | 188 { |
220 if (record.type === "TimeStamp") | 189 if (record.type === "TimeStamp") |
221 InspectorTest.addResult(record.data.message); | 190 InspectorTest.addResult(record.data.message); |
222 | 191 |
223 for (var i = 0; record.children && i < record.children.length; ++i) | 192 for (var i = 0; record.children && i < record.children.length; ++i) |
224 print(record.children[i]); | 193 print(record.children[i]); |
225 } | 194 } |
226 print(event.data); | 195 print(event.data); |
227 } | 196 } |
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 } | 197 } |
239 | 198 |
240 </script> | 199 </script> |
241 </head> | 200 </head> |
242 | 201 |
243 <body onload="runTest()"> | 202 <body onload="runTest()"> |
244 <p> | 203 <p> |
245 Tests console.timeline and timelineEnd commands. | 204 Tests console.timeline and timelineEnd commands. |
246 </p> | 205 </p> |
247 | 206 |
248 </body> | 207 </body> |
249 </html> | 208 </html> |
OLD | NEW |