4 <script src="../../http/tests/inspector/resources/protocol-test.js"></script>
8 let suite = ProtocolTest.createAsyncSuite("Heap.startTracking and Heap.stopTracking");
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", {});
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.");
27 InspectorProtocol.sendCommand("Heap.startTracking", {});
31 suite.runTestCasesAndFinish();
35 <body onload="runTest()">
36 <p>Tests that Heap.startTracking and Heap.stopTracking trigger trackingStart and trackingComplete events with expected data.</p>