| 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 |
| 8 self['Common'] = {}; |
| 9 self['Profiler'] = {}; |
| 10 self['HeapSnapshotWorker'] = {}; |
| 11 |
| 7 InspectorTest.importScript("../../../../../Source/devtools/front_end/platform/ut
ilities.js"); | 12 InspectorTest.importScript("../../../../../Source/devtools/front_end/platform/ut
ilities.js"); |
| 8 InspectorTest.importScript("../../../../../Source/devtools/front_end/common/UISt
ring.js"); | 13 InspectorTest.importScript("../../../../../Source/devtools/front_end/common/UISt
ring.js"); |
| 9 InspectorTest.importScript("../../../../../Source/devtools/front_end/profiler/He
apSnapshotCommon.js"); | 14 InspectorTest.importScript("../../../../../Source/devtools/front_end/profiler/He
apSnapshotCommon.js"); |
| 10 InspectorTest.importScript("../../../../../Source/devtools/front_end/heap_snapsh
ot_worker/HeapSnapshot.js"); | 15 InspectorTest.importScript("../../../../../Source/devtools/front_end/heap_snapsh
ot_worker/HeapSnapshot.js"); |
| 11 InspectorTest.importScript("../../../../../Source/devtools/front_end/heap_snapsh
ot_worker/JSHeapSnapshot.js"); | 16 InspectorTest.importScript("../../../../../Source/devtools/front_end/heap_snapsh
ot_worker/JSHeapSnapshot.js"); |
| 12 InspectorTest.importScript("../../../../../Source/devtools/front_end/common/Text
Utils.js"); | 17 InspectorTest.importScript("../../../../../Source/devtools/front_end/common/Text
Utils.js"); |
| 13 InspectorTest.importScript("../../../../../Source/devtools/front_end/heap_snapsh
ot_worker/HeapSnapshotLoader.js"); | 18 InspectorTest.importScript("../../../../../Source/devtools/front_end/heap_snapsh
ot_worker/HeapSnapshotLoader.js"); |
| 14 | 19 |
| 15 InspectorTest.fail = function(message) | 20 InspectorTest.fail = function(message) |
| 16 { | 21 { |
| 17 InspectorTest.log("FAIL: " + message); | 22 InspectorTest.log("FAIL: " + message); |
| 18 InspectorTest.completeTest(); | 23 InspectorTest.completeTest(); |
| 19 } | 24 } |
| 20 | 25 |
| 21 InspectorTest._takeHeapSnapshotInternal = function(command, callback) | 26 InspectorTest._takeHeapSnapshotInternal = function(command, callback) |
| 22 { | 27 { |
| 23 var loader = new WebInspector.HeapSnapshotLoader(); | 28 var loader = new HeapSnapshotWorker.HeapSnapshotLoader(); |
| 24 InspectorTest.eventHandler["HeapProfiler.addHeapSnapshotChunk"] = function(m
essageObject) | 29 InspectorTest.eventHandler["HeapProfiler.addHeapSnapshotChunk"] = function(m
essageObject) |
| 25 { | 30 { |
| 26 loader.write(messageObject["params"]["chunk"]); | 31 loader.write(messageObject["params"]["chunk"]); |
| 27 } | 32 } |
| 28 | 33 |
| 29 function didTakeHeapSnapshot(messageObject) | 34 function didTakeHeapSnapshot(messageObject) |
| 30 { | 35 { |
| 31 InspectorTest.log("Took heap snapshot"); | 36 InspectorTest.log("Took heap snapshot"); |
| 32 loader.close(); | 37 loader.close(); |
| 33 var snapshot = loader.buildSnapshot(false); | 38 var snapshot = loader.buildSnapshot(false); |
| 34 InspectorTest.log("Parsed snapshot"); | 39 InspectorTest.log("Parsed snapshot"); |
| 35 callback(snapshot); | 40 callback(snapshot); |
| 36 } | 41 } |
| 37 InspectorTest.sendCommand(command, {}, didTakeHeapSnapshot); | 42 InspectorTest.sendCommand(command, {}, didTakeHeapSnapshot); |
| 38 } | 43 } |
| 39 | 44 |
| 40 InspectorTest.takeHeapSnapshot = function(callback) | 45 InspectorTest.takeHeapSnapshot = function(callback) |
| 41 { | 46 { |
| 42 InspectorTest._takeHeapSnapshotInternal("HeapProfiler.takeHeapSnapshot", cal
lback); | 47 InspectorTest._takeHeapSnapshotInternal("HeapProfiler.takeHeapSnapshot", cal
lback); |
| 43 } | 48 } |
| 44 | 49 |
| 45 InspectorTest.stopRecordingHeapTimeline = function(callback) | 50 InspectorTest.stopRecordingHeapTimeline = function(callback) |
| 46 { | 51 { |
| 47 InspectorTest._takeHeapSnapshotInternal("HeapProfiler.stopTrackingHeapObject
s", callback); | 52 InspectorTest._takeHeapSnapshotInternal("HeapProfiler.stopTrackingHeapObject
s", callback); |
| 48 } | 53 } |
| OLD | NEW |