| OLD | NEW |
| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 InspectorTest.assertEquals("object", nodeE.type(), "E type"); | 42 InspectorTest.assertEquals("object", nodeE.type(), "E type"); |
| 43 InspectorTest.assertEquals(0, nodeE.edgesCount(), "E edges"); | 43 InspectorTest.assertEquals(0, nodeE.edgesCount(), "E edges"); |
| 44 }, | 44 }, |
| 45 | 45 |
| 46 function heapSnapshotNodeIteratorTest() | 46 function heapSnapshotNodeIteratorTest() |
| 47 { | 47 { |
| 48 var snapshot = InspectorTest.createJSHeapSnapshotMockObject(); | 48 var snapshot = InspectorTest.createJSHeapSnapshotMockObject(); |
| 49 var nodeRoot = snapshot.createNode(snapshot._rootNodeIndex); | 49 var nodeRoot = snapshot.createNode(snapshot._rootNodeIndex); |
| 50 var iterator = new WebInspector.HeapSnapshotNodeIterator(nodeRoo
t); | 50 var iterator = new WebInspector.HeapSnapshotNodeIterator(nodeRoo
t); |
| 51 var names = []; | 51 var names = []; |
| 52 for (iterator.rewind(); 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 edgesRoot = nodeRoot.rawEdges(); |
| 62 InspectorTest.assertEquals(nodeRoot.edgesCount() * snapshot._edg
eFieldsCount, edgesRoot.length, "rawEdges length"); | 62 InspectorTest.assertEquals(nodeRoot.edgesCount() * snapshot._edg
eFieldsCount, edgesRoot.length, "rawEdges length"); |
| 63 var edge = snapshot.createEdge(edgesRoot); | 63 var edge = snapshot.createEdge(edgesRoot); |
| 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 }, | 67 }, |
| 68 | 68 |
| 69 function heapSnapshotEdgeIteratorTest() | 69 function heapSnapshotEdgeIteratorTest() |
| 70 { | 70 { |
| 71 var snapshot = InspectorTest.createJSHeapSnapshotMockObject(); | 71 var snapshot = InspectorTest.createJSHeapSnapshotMockObject(); |
| 72 var nodeRoot = snapshot.createNode(snapshot._rootNodeIndex); | 72 var nodeRoot = snapshot.createNode(snapshot._rootNodeIndex); |
| 73 var names = []; | 73 var names = []; |
| 74 var iterator = nodeRoot.edges(); | 74 for (var iterator = nodeRoot.edges(); iterator.hasNext(); iterat
or.next()) |
| 75 for (iterator.rewind(); iterator.hasNext(); iterator.next()) | |
| 76 names.push(iterator.item().name()); | 75 names.push(iterator.item().name()); |
| 77 InspectorTest.assertEquals("a,b", names.join(","), "edge iterato
r"); | 76 InspectorTest.assertEquals("a,b", names.join(","), "edge iterato
r"); |
| 78 var nodeE = snapshot.createNode(15); | 77 var nodeE = snapshot.createNode(15); |
| 79 InspectorTest.assertEquals(false, nodeE.edges().hasNext(), "empt
y edge iterator"); | 78 InspectorTest.assertEquals(false, nodeE.edges().hasNext(), "empt
y edge iterator"); |
| 80 }, | 79 }, |
| 81 | 80 |
| 82 function heapSnapshotNodeAndEdgeTest() | 81 function heapSnapshotNodeAndEdgeTest() |
| 83 { | 82 { |
| 84 var snapshotMock = InspectorTest.createJSHeapSnapshotMockObject(
); | 83 var snapshotMock = InspectorTest.createJSHeapSnapshotMockObject(
); |
| 85 var nodeRoot = snapshotMock.createNode(snapshotMock._rootNodeInd
ex); | 84 var nodeRoot = snapshotMock.createNode(snapshotMock._rootNodeInd
ex); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 </script> | 405 </script> |
| 407 </head> | 406 </head> |
| 408 | 407 |
| 409 <body onload="runTest()"> | 408 <body onload="runTest()"> |
| 410 <p> | 409 <p> |
| 411 This test checks HeapSnapshots module. | 410 This test checks HeapSnapshots module. |
| 412 </p> | 411 </p> |
| 413 | 412 |
| 414 </body> | 413 </body> |
| 415 </html> | 414 </html> |
| OLD | NEW |