| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 function heapSnapshotNodesProviderTest() | 315 function heapSnapshotNodesProviderTest() |
| 316 { | 316 { |
| 317 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre
ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress()); | 317 var snapshot = new WebInspector.JSHeapSnapshot(InspectorTest.cre
ateHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress()); |
| 318 | 318 |
| 319 function nodeFilter(node) | 319 function nodeFilter(node) |
| 320 { | 320 { |
| 321 return node.type() === "object" && node.name() !== "B" && no
de.name() !== "D"; | 321 return node.type() === "object" && node.name() !== "B" && no
de.name() !== "D"; |
| 322 } | 322 } |
| 323 | 323 |
| 324 var allNodeIndexes = []; | 324 var allNodeIndexes = []; |
| 325 for (var i = 0; i < snapshot._nodes.length; i += snapshot._nodeF
ieldCount) | 325 for (var i = 0; i < snapshot.nodes.length; i += snapshot._nodeFi
eldCount) |
| 326 allNodeIndexes.push(i); | 326 allNodeIndexes.push(i); |
| 327 var provider = new WebInspector.HeapSnapshotNodesProvider(snapsh
ot, nodeFilter, allNodeIndexes); | 327 var provider = new WebInspector.HeapSnapshotNodesProvider(snapsh
ot, nodeFilter, allNodeIndexes); |
| 328 // Sort by names in reverse order. | 328 // Sort by names in reverse order. |
| 329 provider.sortAndRewind({fieldName1: "name", ascending1: false, f
ieldName2: "id", ascending2: false}); | 329 provider.sortAndRewind({fieldName1: "name", ascending1: false, f
ieldName2: "id", ascending2: false}); |
| 330 var range = provider.serializeItemsRange(0, 3); | 330 var range = provider.serializeItemsRange(0, 3); |
| 331 InspectorTest.assertEquals(3, range.totalLength, "Node range tot
al length"); | 331 InspectorTest.assertEquals(3, range.totalLength, "Node range tot
al length"); |
| 332 InspectorTest.assertEquals(0, range.startPosition, "Node range s
tart position"); | 332 InspectorTest.assertEquals(0, range.startPosition, "Node range s
tart position"); |
| 333 InspectorTest.assertEquals(3, range.endPosition, "Node range end
position"); | 333 InspectorTest.assertEquals(3, range.endPosition, "Node range end
position"); |
| 334 var names = range.items.map(function(item) | 334 var names = range.items.map(function(item) |
| 335 { | 335 { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 364 { | 364 { |
| 365 var source = InspectorTest.createHeapSnapshotMockRaw(); | 365 var source = InspectorTest.createHeapSnapshotMockRaw(); |
| 366 var sourceStringified = JSON.stringify(source); | 366 var sourceStringified = JSON.stringify(source); |
| 367 var partSize = sourceStringified.length >> 3; | 367 var partSize = sourceStringified.length >> 3; |
| 368 | 368 |
| 369 var loader = new WebInspector.HeapSnapshotLoader(); | 369 var loader = new WebInspector.HeapSnapshotLoader(); |
| 370 for (var i = 0, l = sourceStringified.length; i < l; i += partSi
ze) | 370 for (var i = 0, l = sourceStringified.length; i < l; i += partSi
ze) |
| 371 loader.write(sourceStringified.slice(i, i + partSize)); | 371 loader.write(sourceStringified.slice(i, i + partSize)); |
| 372 loader.close(); | 372 loader.close(); |
| 373 var result = loader.buildSnapshot(false); | 373 var result = loader.buildSnapshot(false); |
| 374 result._nodes = new Uint32Array(result._nodes); | 374 result.nodes = new Uint32Array(result.nodes); |
| 375 result._containmentEdges = new Uint32Array(result._containmentEd
ges); | 375 result.containmentEdges = new Uint32Array(result.containmentEdge
s); |
| 376 function assertSnapshotEquals(reference, actual) | 376 function assertSnapshotEquals(reference, actual) |
| 377 { | 377 { |
| 378 InspectorTest.assertEquals(JSON.stringify(reference), JSON.s
tringify(actual)); | 378 InspectorTest.assertEquals(JSON.stringify(reference), JSON.s
tringify(actual)); |
| 379 } | 379 } |
| 380 assertSnapshotEquals(new WebInspector.JSHeapSnapshot(InspectorTe
st.createHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress(), false), re
sult); | 380 assertSnapshotEquals(new WebInspector.JSHeapSnapshot(InspectorTe
st.createHeapSnapshotMock(), new WebInspector.HeapSnapshotProgress(), false), re
sult); |
| 381 }, | 381 }, |
| 382 ]; | 382 ]; |
| 383 | 383 |
| 384 var result = []; | 384 var result = []; |
| 385 for (var i = 0; i < testSuite.length; i++) { | 385 for (var i = 0; i < testSuite.length; i++) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 412 </script> | 412 </script> |
| 413 </head> | 413 </head> |
| 414 | 414 |
| 415 <body onload="runTest()"> | 415 <body onload="runTest()"> |
| 416 <p> | 416 <p> |
| 417 This test checks HeapSnapshots module. | 417 This test checks HeapSnapshots module. |
| 418 </p> | 418 </p> |
| 419 | 419 |
| 420 </body> | 420 </body> |
| 421 </html> | 421 </html> |
| OLD | NEW |