| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 var node = builder.rootNode; | 157 var node = builder.rootNode; |
| 158 | 158 |
| 159 var iterations = 6; | 159 var iterations = 6; |
| 160 var nodeSize = 1000 * 1000 * 1000; | 160 var nodeSize = 1000 * 1000 * 1000; |
| 161 for (var i = 0; i < 6; i++) { | 161 for (var i = 0; i < 6; i++) { |
| 162 var newNode = new InspectorTest.HeapNode("Node" + i, nodeSiz
e); | 162 var newNode = new InspectorTest.HeapNode("Node" + i, nodeSiz
e); |
| 163 node.linkNode(newNode, InspectorTest.HeapEdge.Type.element); | 163 node.linkNode(newNode, InspectorTest.HeapEdge.Type.element); |
| 164 node = newNode; | 164 node = newNode; |
| 165 } | 165 } |
| 166 | 166 |
| 167 var snapshot = new WebInspector.JSHeapSnapshot(builder.generateS
napshot(), new WebInspector.HeapSnapshotProgress()); | 167 var snapshot = builder.createJSHeapSnapshot(); |
| 168 InspectorTest.assertEquals( | 168 InspectorTest.assertEquals( |
| 169 iterations * nodeSize, snapshot.rootNode().retainedSize(), | 169 iterations * nodeSize, snapshot.rootNode().retainedSize(), |
| 170 "Ensure that root node retained size supports values exceedi
ng 2^32 bytes."); | 170 "Ensure that root node retained size supports values exceedi
ng 2^32 bytes."); |
| 171 }, | 171 }, |
| 172 | 172 |
| 173 function heapSnapshotDominatedNodesTest() | 173 function heapSnapshotDominatedNodesTest() |
| 174 { | 174 { |
| 175 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre
ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress()); | 175 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre
ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress()); |
| 176 | 176 |
| 177 var expectedDominatedNodes = [21, 14, 7, 28, 35]; | 177 var expectedDominatedNodes = [21, 14, 7, 28, 35]; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 198 var windowNode = new InspectorTest.HeapNode("Window"); | 198 var windowNode = new InspectorTest.HeapNode("Window"); |
| 199 rootNode.linkNode(windowNode, InspectorTest.HeapEdge.Type.shortc
ut); | 199 rootNode.linkNode(windowNode, InspectorTest.HeapEdge.Type.shortc
ut); |
| 200 | 200 |
| 201 var pageOwnedNode = new InspectorTest.HeapNode("PageOwnedNode"); | 201 var pageOwnedNode = new InspectorTest.HeapNode("PageOwnedNode"); |
| 202 windowNode.linkNode(pageOwnedNode, InspectorTest.HeapEdge.Type.e
lement); | 202 windowNode.linkNode(pageOwnedNode, InspectorTest.HeapEdge.Type.e
lement); |
| 203 debuggerNode.linkNode(pageOwnedNode, InspectorTest.HeapEdge.Type
.property, "debugger2pageOwnedNode"); | 203 debuggerNode.linkNode(pageOwnedNode, InspectorTest.HeapEdge.Type
.property, "debugger2pageOwnedNode"); |
| 204 | 204 |
| 205 var debuggerOwnedNode = new InspectorTest.HeapNode("debuggerOwne
dNode"); | 205 var debuggerOwnedNode = new InspectorTest.HeapNode("debuggerOwne
dNode"); |
| 206 debuggerNode.linkNode(debuggerOwnedNode, InspectorTest.HeapEdge.
Type.element); | 206 debuggerNode.linkNode(debuggerOwnedNode, InspectorTest.HeapEdge.
Type.element); |
| 207 | 207 |
| 208 var snapshot = new WebInspector.JSHeapSnapshot(builder.generateS
napshot(), new WebInspector.HeapSnapshotProgress()); | 208 var snapshot = builder.createJSHeapSnapshot(); |
| 209 snapshot._flags = new Array(snapshot.nodeCount); | 209 snapshot._flags = new Array(snapshot.nodeCount); |
| 210 for (var i = 0; i < snapshot.nodeCount; ++i) | 210 for (var i = 0; i < snapshot.nodeCount; ++i) |
| 211 snapshot._flags[i] = 0; | 211 snapshot._flags[i] = 0; |
| 212 snapshot._markPageOwnedNodes(); | 212 snapshot._markPageOwnedNodes(); |
| 213 | 213 |
| 214 var expectedFlags = [0, 0, 4, 4, 0]; | 214 var expectedFlags = [0, 0, 4, 4, 0]; |
| 215 InspectorTest.assertEquals( | 215 InspectorTest.assertEquals( |
| 216 JSON.stringify(expectedFlags), | 216 JSON.stringify(expectedFlags), |
| 217 JSON.stringify(snapshot._flags), | 217 JSON.stringify(snapshot._flags), |
| 218 "We are expecting that only window(third element) and PageOw
nedNode(forth element) have flag === 4."); | 218 "We are expecting that only window(third element) and PageOw
nedNode(forth element) have flag === 4."); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 InspectorTest.assertEquals(expectedCanBeQueried[node.name()]
, node.canBeQueried(), "canBeQueried of \"" + node.name() + "\""); | 292 InspectorTest.assertEquals(expectedCanBeQueried[node.name()]
, node.canBeQueried(), "canBeQueried of \"" + node.name() + "\""); |
| 293 } | 293 } |
| 294 }, | 294 }, |
| 295 | 295 |
| 296 function heapSnapshotArraySliceTest() | 296 function heapSnapshotArraySliceTest() |
| 297 { | 297 { |
| 298 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre
ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress()); | 298 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre
ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress()); |
| 299 var root = snapshot.rootNode(); | 299 var root = snapshot.rootNode(); |
| 300 var rawEdges = root.rawEdges(); | 300 var rawEdges = root.rawEdges(); |
| 301 InspectorTest.assertEquals(6, rawEdges.length); | 301 InspectorTest.assertEquals(6, rawEdges.length); |
| 302 InspectorTest.assertEquals(6, rawEdges.slice(0).length); | 302 InspectorTest.assertEquals(6, rawEdges.subarray(0).length); |
| 303 InspectorTest.assertEquals(3, rawEdges.slice(3).length); | 303 InspectorTest.assertEquals(3, rawEdges.subarray(3).length); |
| 304 InspectorTest.assertEquals(3, rawEdges.slice(3, 6).length); | 304 InspectorTest.assertEquals(3, rawEdges.subarray(3, 6).length); |
| 305 InspectorTest.assertEquals(3, rawEdges.slice(0, 3).length); | 305 InspectorTest.assertEquals(3, rawEdges.subarray(0, 3).length); |
| 306 InspectorTest.assertEquals(0, rawEdges.slice(3, 3).length); | 306 InspectorTest.assertEquals(0, rawEdges.subarray(3, 3).length); |
| 307 }, | 307 }, |
| 308 | 308 |
| 309 function heapSnapshotNodesProviderTest() | 309 function heapSnapshotNodesProviderTest() |
| 310 { | 310 { |
| 311 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre
ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress()); | 311 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre
ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress()); |
| 312 | 312 |
| 313 function nodeFilter(node) | 313 function nodeFilter(node) |
| 314 { | 314 { |
| 315 return node.type() === "object" && node.name() !== "B" && no
de.name() !== "D"; | 315 return node.type() === "object" && node.name() !== "B" && no
de.name() !== "D"; |
| 316 } | 316 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 </script> | 397 </script> |
| 398 </head> | 398 </head> |
| 399 | 399 |
| 400 <body onload="runTest()"> | 400 <body onload="runTest()"> |
| 401 <p> | 401 <p> |
| 402 This test checks HeapSnapshots module. | 402 This test checks HeapSnapshots module. |
| 403 </p> | 403 </p> |
| 404 | 404 |
| 405 </body> | 405 </body> |
| 406 </html> | 406 </html> |
| OLD | NEW |