OLD | NEW |
1 // This script is supposed to be evaluated in dummy inspector front-end which is
loaded from | 1 // This script is supposed to be evaluated in dummy inspector front-end which is
loaded from |
2 // ../../../http/tests/inspector-protocol/resources/protocol-test.html and the r
elative paths | 2 // ../../../http/tests/inspector-protocol/resources/protocol-test.html and the r
elative paths |
3 // below are relative to that location. | 3 // below are relative to that location. |
4 | 4 |
5 if (!window.WebInspector) | 5 if (!window.WebInspector) |
6 window.WebInspector = {}; | 6 window.WebInspector = {}; |
7 InspectorTest.importScript("../../../../../Source/devtools/front_end/HeapSnapsho
t.js"); | 7 InspectorTest.importScript("../../../../../Source/devtools/front_end/HeapSnapsho
t.js"); |
8 InspectorTest.importScript("../../../../../Source/devtools/front_end/JSHeapSnaps
hot.js"); | 8 InspectorTest.importScript("../../../../../Source/devtools/front_end/JSHeapSnaps
hot.js"); |
9 | 9 |
| 10 InspectorTest.fail = function(message) |
| 11 { |
| 12 InspectorTest.log("FAIL: " + message); |
| 13 InspectorTest.completeTest(); |
| 14 } |
| 15 |
| 16 InspectorTest.assert = function(result, message) |
| 17 { |
| 18 if (!result) |
| 19 InspectorTest.fail(message); |
| 20 } |
| 21 |
10 InspectorTest.takeHeapSnapshot = function(callback) | 22 InspectorTest.takeHeapSnapshot = function(callback) |
11 { | 23 { |
12 InspectorTest.eventHandler["HeapProfiler.addProfileHeader"] = function(messa
geObject) | 24 InspectorTest.eventHandler["HeapProfiler.addProfileHeader"] = function(messa
geObject) |
13 { | 25 { |
14 var profileId = messageObject["params"]["header"]["uid"]; | 26 var profileId = messageObject["params"]["header"]["uid"]; |
15 InspectorTest.sendCommand("HeapProfiler.getHeapSnapshot", { "uid": profi
leId }, didGetHeapSnapshot); | 27 InspectorTest.sendCommand("HeapProfiler.getHeapSnapshot", { "uid": profi
leId }, didGetHeapSnapshot); |
16 | 28 |
17 function didGetHeapSnapshot(messageObject) | 29 function didGetHeapSnapshot(messageObject) |
18 { | 30 { |
19 InspectorTest.log("SUCCESS: didGetHeapSnapshot"); | 31 InspectorTest.log("SUCCESS: didGetHeapSnapshot"); |
(...skipping 10 matching lines...) Expand all Loading... |
30 InspectorTest.eventHandler["HeapProfiler.finishHeapSnapshot"] = function(mes
sageObject) | 42 InspectorTest.eventHandler["HeapProfiler.finishHeapSnapshot"] = function(mes
sageObject) |
31 { | 43 { |
32 var serializedSnapshot = chunks.join(""); | 44 var serializedSnapshot = chunks.join(""); |
33 var parsed = JSON.parse(serializedSnapshot); | 45 var parsed = JSON.parse(serializedSnapshot); |
34 var snapshot = new WebInspector.JSHeapSnapshot(parsed); | 46 var snapshot = new WebInspector.JSHeapSnapshot(parsed); |
35 callback(snapshot); | 47 callback(snapshot); |
36 } | 48 } |
37 | 49 |
38 InspectorTest.sendCommand("HeapProfiler.takeHeapSnapshot", {}); | 50 InspectorTest.sendCommand("HeapProfiler.takeHeapSnapshot", {}); |
39 } | 51 } |
OLD | NEW |