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 test() | 6 function test() |
7 { | 7 { |
| 8 var log = []; |
8 InspectorTest.eventHandler["Timeline.eventRecorded"] = eventRecorded; | 9 InspectorTest.eventHandler["Timeline.eventRecorded"] = eventRecorded; |
9 | 10 |
10 InspectorTest.sendCommand("Timeline.start", {}); | 11 InspectorTest.sendCommand("Timeline.start", {}, timelineStarted); |
11 InspectorTest.sendCommand("Page.enable", {}, pageEnabled); | |
12 | 12 |
13 function pageEnabled() | 13 function timelineStarted() |
14 { | 14 { |
15 InspectorTest.log("Page enabled"); | 15 log.push("Timeline started"); |
16 InspectorTest.sendCommand("Page.disable", {}); | 16 InspectorTest.sendCommand("Page.enable", {}, pageAgentEnabled); |
17 InspectorTest.sendCommand("Timeline.stop", {}, pageDisabled); | |
18 } | 17 } |
19 | 18 |
20 function pageDisabled() | 19 function pageAgentEnabled() |
21 { | 20 { |
22 InspectorTest.log("Page disabled"); | 21 log.push("Page enabled"); |
| 22 InspectorTest.sendCommand("Page.disable", {}, pageAgentDisabled); |
| 23 } |
| 24 |
| 25 function pageAgentDisabled() |
| 26 { |
| 27 log.push("Page disabled"); |
| 28 InspectorTest.sendCommand("NotExistingCommand", {}, didRoundTripOverProt
ocol); |
| 29 } |
| 30 |
| 31 function didRoundTripOverProtocol() |
| 32 { |
| 33 InspectorTest.sendCommand("Timeline.stop", {}, timelineStopped); |
| 34 } |
| 35 |
| 36 function timelineStopped(next) |
| 37 { |
| 38 log.push("Timeline stopped"); |
| 39 for (var i = 0; i < log.length; ++i) |
| 40 InspectorTest.log(log[i]); |
23 InspectorTest.completeTest(); | 41 InspectorTest.completeTest(); |
24 } | 42 } |
25 | 43 |
26 function eventRecorded(msg) | 44 function eventRecorded(msg) |
27 { | 45 { |
28 var type = msg.params.record.type; | 46 if (msg.params.record.type === "Program") { |
29 if (type.indexOf("GC") !== -1) | 47 var children = msg.params.record.children; |
| 48 for (var i = 0; i < children.length; ++i) { |
| 49 var record = children[i]; |
| 50 if (record.type === "GCEvent") |
| 51 continue; |
| 52 log.push("Timeline.eventRecorded: " + record.type); |
| 53 } |
30 return; | 54 return; |
31 InspectorTest.log("Timeline.eventRecorded: " + type); | 55 } |
| 56 InspectorTest.log("FAIL: Unexpected records arrived"); |
| 57 InspectorTest.logObject(msg); |
32 } | 58 } |
33 } | 59 } |
34 | 60 |
35 </script> | 61 </script> |
36 </head> | 62 </head> |
37 <body onload="runTest()"> | 63 <body onload="runTest()"> |
38 </body> | 64 </body> |
39 </html> | 65 </html> |
OLD | NEW |