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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.inspectorView.showPanel("timeline"); | 80 WebInspector.inspectorView.showPanel("timeline"); |
81 var panel = WebInspector.inspectorView.panel("timeline"); | 81 var panel = WebInspector.inspectorView.panel("timeline"); |
82 panel._model._currentTarget = WebInspector.targetManager.mainTarget(); | 82 panel._model._currentTarget = WebInspector.targetManager.mainTarget(); |
83 panel._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded,
eventRecorded, this); | |
84 | 83 |
85 InspectorTest.runTestSuite([ | 84 InspectorTest.runTestSuite([ |
86 function testStartStopTimeline(next) | 85 function testStartStopTimeline(next) |
87 { | 86 { |
88 InspectorTest.evaluateInPage("startStopTimeline()"); | 87 InspectorTest.evaluateWithTimeline("startStopTimeline()", allEventsR
eceived); |
89 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStopped, allEventsReceived, this); | |
90 | 88 |
91 function allEventsReceived() | 89 function allEventsReceived() |
92 { | 90 { |
93 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStopped, allEventsReceived, this); | 91 printTimelineAndTimestampEvents(); |
94 next(); | 92 next(); |
95 } | 93 } |
96 }, | 94 }, |
97 | 95 |
98 function testStartStopMultiple(next) | 96 function testStartStopMultiple(next) |
99 { | 97 { |
100 InspectorTest.evaluateInPage("startStopMultiple()"); | 98 InspectorTest.evaluateWithTimeline("startStopMultiple()", allEventsR
eceived); |
101 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStopped, allEventsReceived, this); | |
102 | 99 |
103 function allEventsReceived() | 100 function allEventsReceived() |
104 { | 101 { |
105 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStopped, allEventsReceived, this); | 102 printTimelineAndTimestampEvents(); |
106 next(); | 103 next(); |
107 } | 104 } |
108 }, | 105 }, |
109 | 106 |
110 function testStartMultipleStopInsideEvals(next) | 107 function testStartMultipleStopInsideEvals(next) |
111 { | 108 { |
112 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStopped, finish, this); | 109 InspectorTest.startTimeline(step1); |
113 | 110 |
114 InspectorTest.evaluateInPage("startMultiple()", step2); | 111 function step1() |
| 112 { |
| 113 InspectorTest.evaluateInPage("startMultiple()", step2); |
| 114 } |
115 | 115 |
116 function step2() | 116 function step2() |
117 { | 117 { |
118 InspectorTest.evaluateInPage("stopTwo()", step3); | 118 InspectorTest.evaluateInPage("stopTwo()", step3); |
119 } | 119 } |
120 | 120 |
121 function step3() | 121 function step3() |
122 { | 122 { |
123 InspectorTest.evaluateInPage("stopOne()", function() {}); | 123 InspectorTest.evaluateInPage("stopOne()", step4); |
| 124 } |
| 125 |
| 126 function step4() |
| 127 { |
| 128 InspectorTest.stopTimeline(finish); |
124 } | 129 } |
125 | 130 |
126 function finish() | 131 function finish() |
127 { | 132 { |
128 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStopped, finish, this); | 133 printTimelineAndTimestampEvents(); |
129 next(); | 134 next(); |
130 } | 135 } |
131 }, | 136 }, |
132 | 137 |
133 function testStopUnknown(next) | 138 function testStopUnknown(next) |
134 { | 139 { |
135 InspectorTest.evaluateInPage("stopUnknown()", next); | 140 InspectorTest.evaluateWithTimeline("stopUnknown()", allEventsReceive
d); |
| 141 |
| 142 function allEventsReceived() |
| 143 { |
| 144 printTimelineAndTimestampEvents(); |
| 145 next(); |
| 146 } |
136 }, | 147 }, |
137 | 148 |
138 function testStartFromPanel(next) | 149 function testStartFromPanel(next) |
139 { | 150 { |
140 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStarted, recordingStarted); | 151 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStarted, recordingStarted); |
141 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStopped, finish, this); | 152 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStopped, finish); |
142 panel._toggleTimelineButtonClicked(); | 153 panel._toggleTimelineButtonClicked(); |
143 | 154 |
144 function recordingStarted() | 155 function recordingStarted() |
145 { | 156 { |
146 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStarted, recordingStarted); | 157 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStarted, recordingStarted); |
147 InspectorTest.evaluateInPage("startStopTimeline()", step2); | 158 InspectorTest.evaluateInPage("startStopTimeline()", step2); |
148 } | 159 } |
149 | 160 |
150 function step2() | 161 function step2() |
151 { | 162 { |
152 panel._toggleTimelineButtonClicked(); | 163 panel._toggleTimelineButtonClicked(); |
153 } | 164 } |
154 | 165 |
155 function finish() | 166 function finish() |
156 { | 167 { |
157 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStopped, finish, this); | 168 printTimelineAndTimestampEvents(); |
| 169 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStopped, finish); |
158 next(); | 170 next(); |
159 } | 171 } |
160 }, | 172 }, |
161 | 173 |
162 function testStopFromPanel(next) | 174 function testStopFromPanel(next) |
163 { | 175 { |
164 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStopped, finish, this); | 176 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStopped, finish); |
165 | 177 |
166 InspectorTest.evaluateInPage("startTimeline()", step2); | 178 InspectorTest.startTimeline(step1); |
| 179 |
| 180 function step1() |
| 181 { |
| 182 InspectorTest.evaluateInPage("startTimeline()", step2); |
| 183 } |
167 | 184 |
168 function step2() | 185 function step2() |
169 { | 186 { |
170 panel._toggleTimelineButtonClicked(); | 187 panel._toggleTimelineButtonClicked(); |
171 } | 188 } |
172 | 189 |
173 function finish() | 190 function finish() |
174 { | 191 { |
175 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStopped, finish, this); | 192 printTimelineAndTimestampEvents(); |
| 193 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStopped, finish); |
176 next(); | 194 next(); |
177 } | 195 } |
178 }, | 196 }, |
179 | 197 |
180 function testRacyStart(next) | 198 function testRacyStart(next) |
181 { | 199 { |
182 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStarted, timelineStarted); | 200 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStopped, finish); |
183 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStopped, finish, this); | 201 InspectorTest.evaluateInPage("startTimeline()", timelineStarted); |
184 | |
185 InspectorTest.evaluateInPage("startTimeline()"); | |
186 panel._toggleTimelineButtonClicked(); | 202 panel._toggleTimelineButtonClicked(); |
187 | 203 |
188 function timelineStarted() | 204 function timelineStarted() |
189 { | 205 { |
190 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStarted, timelineStarted); | |
191 panel._toggleTimelineButtonClicked(); | 206 panel._toggleTimelineButtonClicked(); |
192 } | 207 } |
193 | 208 |
194 function finish() | 209 function finish() |
195 { | 210 { |
196 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStopped, finish, this); | 211 printTimelineAndTimestampEvents(); |
| 212 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStopped, finish); |
197 next(); | 213 next(); |
198 } | 214 } |
199 }, | 215 }, |
200 | 216 |
201 function testRacyStart2(next) | 217 function testRacyStart2(next) |
202 { | 218 { |
203 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStarted, timelineStarted); | 219 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStopped, finish); |
204 panel._model.addEventListener(WebInspector.TimelineModel.Events.Reco
rdingStopped, finish, this); | |
205 | 220 |
206 panel._toggleTimelineButtonClicked(); | 221 panel._toggleTimelineButtonClicked(); |
207 InspectorTest.evaluateInPage("startTimeline()"); | 222 InspectorTest.evaluateInPage("startTimeline()", timelineStarted); |
208 | 223 |
209 function timelineStarted() | 224 function timelineStarted() |
210 { | 225 { |
211 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStarted, timelineStarted); | |
212 // Fool listener order execution. | 226 // Fool listener order execution. |
213 setTimeout(panel._toggleTimelineButtonClicked.bind(panel)); | 227 setTimeout(panel._toggleTimelineButtonClicked.bind(panel)); |
214 } | 228 } |
215 | 229 |
216 function finish() | 230 function finish() |
217 { | 231 { |
218 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStopped, finish, this); | 232 panel._model.removeEventListener(WebInspector.TimelineModel.Even
ts.RecordingStopped, finish); |
| 233 printTimelineAndTimestampEvents(); |
219 next(); | 234 next(); |
220 } | 235 } |
221 } | 236 } |
222 ]); | 237 ]); |
223 | 238 |
224 function eventRecorded(event) | 239 function printTimelineAndTimestampEvents() { |
225 { | 240 panel._tracingModel.sortedProcesses().forEach(function(process) |
226 function print(record) | |
227 { | 241 { |
228 if (record.type() === "TimeStamp") | 242 process.sortedThreads().forEach(function(thread) |
229 InspectorTest.addResult(record.data().message); | 243 { |
230 | 244 thread.events().forEach(function(event) |
231 for (var i = 0; i < record.children().length; ++i) | 245 { |
232 print(record.children()[i]); | 246 if (event.category === WebInspector.TracingModel.ConsoleEvent
Category) |
233 } | 247 InspectorTest.addResult(event.name); |
234 print(event.data); | 248 else if (event.name === WebInspector.TracingTimelineModel.Rec
ordType.TimeStamp) |
| 249 InspectorTest.addResult(event.args["data"]["message"]); |
| 250 }); |
| 251 }); |
| 252 }); |
235 } | 253 } |
236 } | 254 } |
237 | 255 |
238 </script> | 256 </script> |
239 </head> | 257 </head> |
240 | 258 |
241 <body onload="runTest()"> | 259 <body onload="runTest()"> |
242 <p> | 260 <p> |
243 Tests console.timeline and timelineEnd commands. | 261 Tests console.timeline and timelineEnd commands. |
244 </p> | 262 </p> |
245 | 263 |
246 </body> | 264 </body> |
247 </html> | 265 </html> |
OLD | NEW |