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