Web Inspector: Add Heap domain start/stop tracking commands
[WebKit-https.git] / LayoutTests / inspector / heap / tracking.html
1 <!doctype html>
2 <html>
3 <head>
4 <script src="../../http/tests/inspector/resources/protocol-test.js"></script>
5 <script>
6 function test()
7 {
8     let suite = ProtocolTest.createAsyncSuite("Heap.startTracking and Heap.stopTracking");
9
10     suite.addTestCase({
11         name: "StartAndStopTrackingIncludeSnapshots",
12         test: function(resolve, reject) {
13             InspectorProtocol.awaitEvent({event: "Heap.trackingStart"}).then((messageObject) => {
14                 ProtocolTest.log("Heap.trackingStart");
15                 ProtocolTest.expectThat(typeof messageObject.params.timestamp === "number", "Should have a timestamp when starting.");
16                 ProtocolTest.expectThat(typeof messageObject.params.snapshotData === "string", "Should have snapshotData when starting.");
17                 InspectorProtocol.sendCommand("Heap.stopTracking", {});
18             });
19
20             InspectorProtocol.awaitEvent({event: "Heap.trackingComplete"}).then((messageObject) => {
21                 ProtocolTest.log("Heap.trackingComplete");
22                 ProtocolTest.expectThat(typeof messageObject.params.timestamp === "number", "Should have a timestamp when stopping.");
23                 ProtocolTest.expectThat(typeof messageObject.params.snapshotData === "string", "Should have snapshotData when stopping.");
24                 resolve();
25             });
26
27             InspectorProtocol.sendCommand("Heap.startTracking", {});
28         }
29     });
30
31     suite.runTestCasesAndFinish();
32 }
33 </script>
34 </head>
35 <body onload="runTest()">
36 <p>Tests that Heap.startTracking and Heap.stopTracking trigger trackingStart and trackingComplete events with expected data.</p>
37 </body>
38 </html>