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