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

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

Issue 218393010: DevTools: Fix PostOrder calculation algorithm in heap snapshot. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressing comments Created 6 years, 8 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
« no previous file with comments | « no previous file | LayoutTests/inspector/profiler/heap-snapshot-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.inspectorView.showPanel("profiles"); 9 WebInspector.inspectorView.showPanel("profiles");
10 10
(...skipping 12 matching lines...) Expand all
23 error = "Failure (" + message + "):"; 23 error = "Failure (" + message + "):";
24 else 24 else
25 error = "Failure:"; 25 error = "Failure:";
26 throw new Error(error + " expected <" + expected + "> found <" + fou nd + ">"); 26 throw new Error(error + " expected <" + expected + "> found <" + fou nd + ">");
27 } 27 }
28 } 28 }
29 29
30 function runTestSuiteInWorker() 30 function runTestSuiteInWorker()
31 { 31 {
32 var testSuite = [ 32 var testSuite = [
33 function postOrderIndexBug()
34 {
35 var builder = new InspectorTest.HeapSnapshotBuilder();
36 var node1 = new InspectorTest.HeapNode("Node1");
37 var node2 = new InspectorTest.HeapNode("Node2");
38 builder.rootNode.linkNode(node1, InspectorTest.HeapEdge.Type.int ernal);
39 builder.rootNode.linkNode(node2, InspectorTest.HeapEdge.Type.int ernal);
40 node2.linkNode(node1, InspectorTest.HeapEdge.Type.internal);
41 var snapshot = builder.createJSHeapSnapshot();
42 var postOrderIndexes = snapshot._buildPostOrderIndex().nodeOrdin al2PostOrderIndex;
43 var nodeOrdinals = snapshot._buildPostOrderIndex().postOrderInde x2NodeOrdinal;
44 InspectorTest.assertEquals(JSON.stringify(new Uint32Array([2, 0, 1])), JSON.stringify(postOrderIndexes), "postOrderIndexes");
45 InspectorTest.assertEquals(JSON.stringify(new Uint32Array([1, 2, 0])), JSON.stringify(nodeOrdinals), "nodeOrdinals");
46 },
47
33 function heapSnapshotNodeSimpleTest() 48 function heapSnapshotNodeSimpleTest()
34 { 49 {
35 var snapshot = InspectorTest.createJSHeapSnapshotMockObject(); 50 var snapshot = InspectorTest.createJSHeapSnapshotMockObject();
36 var nodeRoot = snapshot.createNode(snapshot._rootNodeIndex); 51 var nodeRoot = snapshot.createNode(snapshot._rootNodeIndex);
37 InspectorTest.assertEquals("", nodeRoot.name(), "root name"); 52 InspectorTest.assertEquals("", nodeRoot.name(), "root name");
38 InspectorTest.assertEquals("hidden", nodeRoot.type(), "root type "); 53 InspectorTest.assertEquals("hidden", nodeRoot.type(), "root type ");
39 InspectorTest.assertEquals(2, nodeRoot.edgesCount(), "root edges "); 54 InspectorTest.assertEquals(2, nodeRoot.edgesCount(), "root edges ");
40 var nodeE = snapshot.createNode(15); 55 var nodeE = snapshot.createNode(15);
41 InspectorTest.assertEquals("E", nodeE.name(), "E name"); 56 InspectorTest.assertEquals("E", nodeE.name(), "E name");
42 InspectorTest.assertEquals("object", nodeE.type(), "E type"); 57 InspectorTest.assertEquals("object", nodeE.type(), "E type");
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 var expected = [0, 6, 12, 18, 21, 21, 21]; 138 var expected = [0, 6, 12, 18, 21, 21, 21];
124 InspectorTest.assertEquals(expected.length, actual.length, "Edge indexes size"); 139 InspectorTest.assertEquals(expected.length, actual.length, "Edge indexes size");
125 for (var i = 0; i < expected.length; ++i) 140 for (var i = 0; i < expected.length; ++i)
126 InspectorTest.assertEquals(expected[i], actual[i], "Edge ind exes"); 141 InspectorTest.assertEquals(expected[i], actual[i], "Edge ind exes");
127 }, 142 },
128 143
129 function heapSnapshotPostOrderIndexTest() 144 function heapSnapshotPostOrderIndexTest()
130 { 145 {
131 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress()); 146 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress());
132 var postOrderIndex2NodeOrdinal = snapshot._buildPostOrderIndex() .postOrderIndex2NodeOrdinal; 147 var postOrderIndex2NodeOrdinal = snapshot._buildPostOrderIndex() .postOrderIndex2NodeOrdinal;
133 var expected = [4,5,3,2,1,0]; 148 var expected = [5,3,4,2,1,0];
134 for (var i = 0; i < expected.length; ++i) 149 for (var i = 0; i < expected.length; ++i)
135 InspectorTest.assertEquals(expected[i], postOrderIndex2NodeO rdinal[i], "Post ordered indexes"); 150 InspectorTest.assertEquals(expected[i], postOrderIndex2NodeO rdinal[i], "Post ordered indexes");
136 }, 151 },
137 152
138 function heapSnapshotDominatorsTreeTest() 153 function heapSnapshotDominatorsTreeTest()
139 { 154 {
140 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress()); 155 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress());
141 var result = snapshot._buildPostOrderIndex(); 156 var result = snapshot._buildPostOrderIndex();
142 var dominatorsTree = snapshot._buildDominatorTree(result.postOrd erIndex2NodeOrdinal, result.nodeOrdinal2PostOrderIndex); 157 var dominatorsTree = snapshot._buildDominatorTree(result.postOrd erIndex2NodeOrdinal, result.nodeOrdinal2PostOrderIndex);
143 var expected = [0, 0, 0, 0, 2, 3]; 158 var expected = [0, 0, 0, 0, 2, 3];
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 </script> 412 </script>
398 </head> 413 </head>
399 414
400 <body onload="runTest()"> 415 <body onload="runTest()">
401 <p> 416 <p>
402 This test checks HeapSnapshots module. 417 This test checks HeapSnapshots module.
403 </p> 418 </p>
404 419
405 </body> 420 </body>
406 </html> 421 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/profiler/heap-snapshot-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698