Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: LayoutTests/inspector/profiler/heap-snapshot-loader.html

Issue 98273008: [DevTools] Send heap snapshot to the frontend immediatly when it is ready (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed test crash Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="heap-snapshot-test.js"></script> 4 <script src="heap-snapshot-test.js"></script>
5 <script> 5 <script>
6 6
7 function test() 7 function test()
8 { 8 {
9 WebInspector.showPanel("profiles"); 9 WebInspector.showPanel("profiles");
10 var source = InspectorTest.createHeapSnapshotMockRaw(); 10 var source = InspectorTest.createHeapSnapshotMockRaw();
11 var sourceStringified = JSON.stringify(source); 11 var sourceStringified = JSON.stringify(source);
12 var partSize = sourceStringified.length >> 3; 12 var partSize = sourceStringified.length >> 3;
13 13
14 function injectMockProfile(callback) { 14 function injectMockProfile(callback) {
15 var dispatcher = InspectorBackend._domainDispatchers["HeapProfiler"]; 15 var dispatcher = InspectorBackend._domainDispatchers["HeapProfiler"];
16 var panel = WebInspector.panels.profiles; 16 var panel = WebInspector.panels.profiles;
17 panel._reset(); 17 panel._reset();
18 18
19 var profileType = WebInspector.ProfileTypeRegistry.instance.heapSnapsho tProfileType; 19 var profileType = WebInspector.ProfileTypeRegistry.instance.heapSnapsho tProfileType;
20 20
21 InspectorTest.override(HeapProfilerAgent, "getHeapSnapshot", getHeapSnap shotMock); 21 InspectorTest.override(HeapProfilerAgent, "takeHeapSnapshot", takeHeapSn apshotMock);
22 function getHeapSnapshotMock(uid, callback) { 22 function takeHeapSnapshotMock(reportProgress, callback) {
23 if (reportProgress) {
24 profileType.reportHeapSnapshotProgress(50, 100, false);
25 profileType.reportHeapSnapshotProgress(100, 100, true);
26 }
23 for (var i = 0, l = sourceStringified.length; i < l; i += partSize) 27 for (var i = 0, l = sourceStringified.length; i < l; i += partSize)
24 dispatcher.addHeapSnapshotChunk(uid, sourceStringified.slice(i, i + partSize)); 28 dispatcher.addHeapSnapshotChunk(-1, sourceStringified.slice(i, i + partSize));
25 setTimeout(callback, 0); 29 setTimeout(callback, 0);
26 } 30 }
27 31
28 function tempFileReady() 32 function tempFileReady()
29 { 33 {
30 callback(this); 34 callback(this);
31 } 35 }
32 InspectorTest.addSniffer(WebInspector.HeapProfileHeader.prototype, "_did WriteToTempFile", tempFileReady); 36 InspectorTest.addSniffer(WebInspector.HeapProfileHeader.prototype, "_did WriteToTempFile", tempFileReady);
33 profileType._profileBeingRecorded = new WebInspector.HeapProfileHeader(p rofileType, "Snapshotting"); 37 profileType._takeHeapSnapshot(function() {});
34 profileType.addProfile(profileType._profileBeingRecorded);
35
36 dispatcher.addProfileHeader({
37 typeId: WebInspector.HeapSnapshotProfileType.TypeId,
38 title: "heapSnapshotSaveToFileTest",
39 uid: 42
40 });
41 } 38 }
42 39
43 WebInspector.log = function(message) { 40 WebInspector.log = function(message) {
44 InspectorTest.addResult("WebInspector.log: " + message); 41 InspectorTest.addResult("WebInspector.log: " + message);
45 } 42 }
46 43
47 InspectorTest.runTestSuite([ 44 InspectorTest.runTestSuite([
48 function heapSnapshotSaveToFileTest(next) 45 function heapSnapshotSaveToFileTest(next)
49 { 46 {
50 function snapshotLoaded(profileHeader) 47 function snapshotLoaded(profileHeader)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 </script> 133 </script>
137 </head> 134 </head>
138 135
139 <body onload="runTest()"> 136 <body onload="runTest()">
140 <p> 137 <p>
141 This test checks HeapSnapshots loader. 138 This test checks HeapSnapshots loader.
142 </p> 139 </p>
143 140
144 </body> 141 </body>
145 </html> 142 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698