OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
4 <script> | 4 <script> |
5 | 5 |
| 6 function testFunction() |
| 7 { |
| 8 console.timeStamp("Timestamp"); |
| 9 setTimeout(function() { |
| 10 console.timeStamp("Timestamp in timer"); |
| 11 }); |
| 12 } |
| 13 |
6 function test() | 14 function test() |
7 { | 15 { |
8 InspectorTest.eventHandler["Timeline.eventRecorded"] = eventRecorded; | 16 InspectorTest.eventHandler["Timeline.eventRecorded"] = eventRecorded; |
9 InspectorTest.sendCommand("Timeline.start", { "bufferEvents": true }, onStar
t); | 17 InspectorTest.log("Recording started"); |
| 18 InspectorTest.sendCommand("Timeline.start", { bufferEvents: true, liveEvents
: "TimerFire" }, onStart); |
10 | 19 |
11 function onStart(response) | 20 function onStart(response) |
12 { | 21 { |
13 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "0" }, onE
valuate); | 22 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "testFunct
ion()" }); |
14 } | 23 } |
15 | 24 |
16 function onEvaluate(response) | 25 function eventRecorded(event) |
17 { | 26 { |
18 InspectorTest.sendCommand("Timeline.stop", {}, onStop); | 27 InspectorTest.sendCommand("Timeline.stop", {}, onStop); |
| 28 InspectorTest.log(" Event recorded: " + event.params.record.type); |
19 } | 29 } |
20 | 30 |
21 function onStop(response) | 31 function onStop(response) |
22 { | 32 { |
| 33 InspectorTest.log("Recording stopped"); |
| 34 InspectorTest.log("Events:"); |
23 var events = response.result.events; | 35 var events = response.result.events; |
24 for (var i = 0; i < events.length; ++i) { | 36 for (var i = 0; i < events.length; ++i) |
25 if (events[i].type === "GCEvent") | 37 dump(events[i], ""); |
26 continue; | |
27 InspectorTest.log("Recording stopped: " + events[i].type); | |
28 } | |
29 InspectorTest.completeTest(); | 38 InspectorTest.completeTest(); |
30 } | 39 } |
31 | 40 |
32 function eventRecorded(message) | 41 function dump(event, prefix) |
33 { | 42 { |
34 InspectorTest.log("Event recorded: " + message); | 43 var eventTypes = { "FunctionCall":true, "TimeStamp":true, "TimerInstall"
:true, "TimerFire":true }; |
| 44 if (!(event.type in eventTypes)) |
| 45 return; |
| 46 InspectorTest.log(prefix + event.type); |
| 47 for (var i = 0; event.children && i < event.children.length; ++i) |
| 48 dump(event.children[i], " " + prefix); |
35 } | 49 } |
36 } | 50 } |
37 </script> | 51 </script> |
38 </head> | 52 </head> |
39 <body onLoad="runTest();"> | 53 <body onLoad="runTest();"> |
40 </body> | 54 </body> |
41 </html> | 55 </html> |
OLD | NEW |