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

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

Issue 207523004: Always use global indexes for nodes and edges in the heap snapshot representation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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.inspectorView.showPanel("profiles"); 9 WebInspector.inspectorView.showPanel("profiles");
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 var names = []; 51 var names = [];
52 for (; iterator.hasNext(); iterator.next()) 52 for (; iterator.hasNext(); iterator.next())
53 names.push(iterator.item().name()); 53 names.push(iterator.item().name());
54 InspectorTest.assertEquals(",A,B,C,D,E", names.join(","), "node iterator"); 54 InspectorTest.assertEquals(",A,B,C,D,E", names.join(","), "node iterator");
55 }, 55 },
56 56
57 function heapSnapshotEdgeSimpleTest() 57 function heapSnapshotEdgeSimpleTest()
58 { 58 {
59 var snapshot = InspectorTest.createJSHeapSnapshotMockObject(); 59 var snapshot = InspectorTest.createJSHeapSnapshotMockObject();
60 var nodeRoot = snapshot.createNode(snapshot._rootNodeIndex); 60 var nodeRoot = snapshot.createNode(snapshot._rootNodeIndex);
61 var edgesRoot = nodeRoot.rawEdges(); 61 var edgeIterator = new WebInspector.HeapSnapshotEdgeIterator(nod eRoot);
62 InspectorTest.assertEquals(nodeRoot.edgesCount() * snapshot._edg eFieldsCount, edgesRoot.length, "rawEdges length"); 62 InspectorTest.assertEquals(true, edgeIterator.hasNext(), "has ed ges");
63 var edge = snapshot.createEdge(edgesRoot); 63 var edge = edgeIterator.item();
64 InspectorTest.assertEquals("shortcut", edge.type(), "edge type") ; 64 InspectorTest.assertEquals("shortcut", edge.type(), "edge type") ;
65 InspectorTest.assertEquals("a", edge.name(), "edge name"); 65 InspectorTest.assertEquals("a", edge.name(), "edge name");
66 InspectorTest.assertEquals("A", edge.node().name(), "edge node n ame"); 66 InspectorTest.assertEquals("A", edge.node().name(), "edge node n ame");
67
68 var edgesCount = 0;
69 for (; edgeIterator.hasNext(); edgeIterator.next()) {
alph 2014/03/21 08:30:39 s/[{}]//
yurys 2014/03/21 08:33:20 Done.
70 ++edgesCount;
71 }
72 InspectorTest.assertEquals(nodeRoot.edgesCount(), edgesCount, "e dges count");
67 }, 73 },
68 74
69 function heapSnapshotEdgeIteratorTest() 75 function heapSnapshotEdgeIteratorTest()
70 { 76 {
71 var snapshot = InspectorTest.createJSHeapSnapshotMockObject(); 77 var snapshot = InspectorTest.createJSHeapSnapshotMockObject();
72 var nodeRoot = snapshot.createNode(snapshot._rootNodeIndex); 78 var nodeRoot = snapshot.createNode(snapshot._rootNodeIndex);
73 var names = []; 79 var names = [];
74 for (var iterator = nodeRoot.edges(); iterator.hasNext(); iterat or.next()) 80 for (var iterator = nodeRoot.edges(); iterator.hasNext(); iterat or.next())
75 names.push(iterator.item().name()); 81 names.push(iterator.item().name());
76 InspectorTest.assertEquals("a,b", names.join(","), "edge iterato r"); 82 InspectorTest.assertEquals("a,b", names.join(","), "edge iterato r");
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 "M": false, 291 "M": false,
286 "N": false, 292 "N": false,
287 "Window": true 293 "Window": true
288 }; 294 };
289 for (var nodes = snapshot._allNodes(); nodes.hasNext(); nodes.ne xt()) { 295 for (var nodes = snapshot._allNodes(); nodes.hasNext(); nodes.ne xt()) {
290 var node = nodes.item(); 296 var node = nodes.item();
291 InspectorTest.assertEquals(expectedCanBeQueried[node.name()] , node.canBeQueried(), "canBeQueried of \"" + node.name() + "\""); 297 InspectorTest.assertEquals(expectedCanBeQueried[node.name()] , node.canBeQueried(), "canBeQueried of \"" + node.name() + "\"");
292 } 298 }
293 }, 299 },
294 300
295 function heapSnapshotArraySliceTest()
296 {
297 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress());
298 var root = snapshot.rootNode();
299 var rawEdges = root.rawEdges();
300 InspectorTest.assertEquals(6, rawEdges.length);
301 InspectorTest.assertEquals(6, rawEdges.subarray(0).length);
302 InspectorTest.assertEquals(3, rawEdges.subarray(3).length);
303 InspectorTest.assertEquals(3, rawEdges.subarray(3, 6).length);
304 InspectorTest.assertEquals(3, rawEdges.subarray(0, 3).length);
305 InspectorTest.assertEquals(0, rawEdges.subarray(3, 3).length);
306 },
307
308 function heapSnapshotNodesProviderTest() 301 function heapSnapshotNodesProviderTest()
309 { 302 {
310 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress()); 303 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress());
311 304
312 function nodeFilter(node) 305 function nodeFilter(node)
313 { 306 {
314 return node.type() === "object" && node.name() !== "B" && no de.name() !== "D"; 307 return node.type() === "object" && node.name() !== "B" && no de.name() !== "D";
315 } 308 }
316 309
317 var allNodeIndexes = []; 310 var allNodeIndexes = [];
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 </script> 398 </script>
406 </head> 399 </head>
407 400
408 <body onload="runTest()"> 401 <body onload="runTest()">
409 <p> 402 <p>
410 This test checks HeapSnapshots module. 403 This test checks HeapSnapshots module.
411 </p> 404 </p>
412 405
413 </body> 406 </body>
414 </html> 407 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/profiler/heap-snapshot-expected.txt » ('j') | Source/devtools/front_end/HeapSnapshot.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698