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() | 6 function testFunction() |
7 { | 7 { |
8 console.timeStamp("Timestamp"); | 8 console.timeStamp("Timestamp"); |
9 } | 9 } |
10 | 10 |
11 function test() | 11 function test() |
12 { | 12 { |
13 InspectorTest.eventHandler["Timeline.eventRecorded"] = eventRecorded; | 13 InspectorTest.eventHandler["Timeline.eventRecorded"] = eventRecorded; |
| 14 InspectorTest.eventHandler["Timeline.stopped"] = timelineStopped; |
14 InspectorTest.log("Recording started"); | 15 InspectorTest.log("Recording started"); |
15 InspectorTest.sendCommand("Timeline.start", { bufferEvents: true }, onStart)
; | 16 InspectorTest.sendCommand("Timeline.start", { bufferEvents: true }, onStart)
; |
16 | 17 |
17 function onStart(response) | 18 function onStart(response) |
18 { | 19 { |
19 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "testFunct
ion()" }, didEvaluate); | 20 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "testFunct
ion()" }, didEvaluate); |
20 } | 21 } |
21 | 22 |
22 function didEvaluate(response) | 23 function didEvaluate(response) |
23 { | 24 { |
24 InspectorTest.sendCommand("Timeline.stop", {}, onStop); | 25 InspectorTest.sendCommand("Timeline.stop", {}, onStop); |
25 } | 26 } |
26 | 27 |
27 function eventRecorded(event) | 28 function eventRecorded(event) |
28 { | 29 { |
29 InspectorTest.log("FAIL: event recorded: " + event.params.record.type); | 30 InspectorTest.log("FAIL: event recorded: " + event.params.record.type); |
30 } | 31 } |
31 | 32 |
| 33 function timelineStopped(event) |
| 34 { |
| 35 InspectorTest.log("Timeline.stopped event has arrived."); |
| 36 InspectorTest.assert(!event.params.consoleTimeline, "It souldn't be even
t forced by console.timelineEnd"); |
| 37 InspectorTest.log("Events:"); |
| 38 var events = event.params.events; |
| 39 for (var i = 0; i < events.length; ++i) |
| 40 dump(events[i], ""); |
| 41 } |
| 42 |
32 function onStop(response) | 43 function onStop(response) |
33 { | 44 { |
34 InspectorTest.log("Recording stopped"); | 45 InspectorTest.log("Recording stopped"); |
35 InspectorTest.log("Events:"); | |
36 var events = response.result.events; | |
37 for (var i = 0; i < events.length; ++i) | |
38 dump(events[i], ""); | |
39 InspectorTest.completeTest(); | 46 InspectorTest.completeTest(); |
40 } | 47 } |
41 | 48 |
42 function dump(event, prefix) | 49 function dump(event, prefix) |
43 { | 50 { |
44 var eventTypes = { "FunctionCall":true, "TimeStamp":true, "TimerInstall"
:true, "TimerFire":true }; | 51 var eventTypes = { "FunctionCall":true, "TimeStamp":true, "TimerInstall"
:true, "TimerFire":true }; |
45 if (event.type in eventTypes) | 52 if (event.type in eventTypes) |
46 InspectorTest.log(prefix + event.type); | 53 InspectorTest.log(prefix + event.type); |
47 for (var i = 0; event.children && i < event.children.length; ++i) | 54 for (var i = 0; event.children && i < event.children.length; ++i) |
48 dump(event.children[i], " " + prefix); | 55 dump(event.children[i], " " + prefix); |
49 } | 56 } |
50 } | 57 } |
51 </script> | 58 </script> |
52 </head> | 59 </head> |
53 <body onLoad="runTest();"> | 60 <body onLoad="runTest();"> |
54 </body> | 61 </body> |
55 </html> | 62 </html> |
OLD | NEW |