Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="heap-snapshot-test.js"></script> | |
| 5 <script> | |
| 6 | |
| 7 function test() | |
| 8 { | |
| 9 InspectorTest.runHeapSnapshotTestSuite([ | |
| 10 function testRetainersAutoExpandSingleRetainer(next) | |
|
loislo
2014/10/22 09:45:56
wrong method name
yurys
2014/10/22 09:48:37
Done.
| |
| 11 { | |
| 12 function createHeapSnapshot() | |
| 13 { | |
| 14 // Mocking results of running the following code: | |
| 15 // root = [new Uint8Array(1000), new Uint8Array(1000), new Uint8 Array(1000)] | |
| 16 var builder = new InspectorTest.HeapSnapshotBuilder(); | |
| 17 var rootNode = builder.rootNode; | |
| 18 | |
| 19 var gcRootsNode = new InspectorTest.HeapNode("(GC roots)"); | |
| 20 rootNode.linkNode(gcRootsNode, InspectorTest.HeapEdge.Type.eleme nt); | |
| 21 | |
| 22 var windowNode = new InspectorTest.HeapNode("Window", 20); | |
| 23 rootNode.linkNode(windowNode, InspectorTest.HeapEdge.Type.shortc ut); | |
| 24 gcRootsNode.linkNode(windowNode, InspectorTest.HeapEdge.Type.ele ment); | |
| 25 | |
| 26 var arrayNode = new InspectorTest.HeapNode("Array", 10); | |
| 27 windowNode.linkNode(arrayNode, InspectorTest.HeapEdge.Type.prope rty, "root"); | |
| 28 var prevBufferNode = null; | |
| 29 for (var i = 0; i < 3; i++) { | |
| 30 var typedArrayNode = new InspectorTest.HeapNode("Uint8Array" , 100); | |
| 31 arrayNode.linkNode(typedArrayNode, InspectorTest.HeapEdge.Ty pe.element); | |
| 32 | |
| 33 var bufferNode = new InspectorTest.HeapNode("ArrayBuffer", 1 000); | |
| 34 typedArrayNode.linkNode(bufferNode, InspectorTest.HeapEdge.T ype.internal); | |
| 35 if (prevBufferNode) | |
| 36 prevBufferNode.linkNode(bufferNode, InspectorTest.HeapEd ge.Type.weak, "weak_next"); | |
| 37 prevBufferNode = bufferNode; | |
| 38 } | |
| 39 | |
| 40 return builder.generateSnapshot(); | |
| 41 } | |
| 42 | |
| 43 InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1); | |
| 44 | |
| 45 function step1() | |
| 46 { | |
| 47 InspectorTest.switchToView("Summary", step2); | |
| 48 } | |
| 49 | |
| 50 function step2() | |
| 51 { | |
| 52 var row = InspectorTest.findRow("Array"); | |
| 53 InspectorTest.assertEquals(true, !!row, "\"Array\" row"); | |
| 54 InspectorTest.expandRow(row, step3); | |
| 55 } | |
| 56 | |
| 57 function step3(row) | |
| 58 { | |
| 59 InspectorTest.assertEquals(1, row._count); | |
| 60 InspectorTest.assertEquals(3310, row._retainedSize); | |
| 61 InspectorTest.assertEquals(10, row._shallowSize); | |
| 62 InspectorTest.expandRow(row.children[0], step4); | |
| 63 } | |
| 64 | |
| 65 function step4(arrayInstanceRow) | |
| 66 { | |
| 67 InspectorTest.assertEquals(2, arrayInstanceRow._distance); | |
| 68 InspectorTest.assertEquals(3310, arrayInstanceRow._retainedSize) ; | |
| 69 InspectorTest.assertEquals(10, arrayInstanceRow._shallowSize); | |
| 70 | |
| 71 var children = arrayInstanceRow.children; | |
| 72 InspectorTest.assertEquals(3, children.length); | |
| 73 | |
| 74 for (var i = 0; i < children.length; i++) { | |
| 75 InspectorTest.assertEquals("Uint8Array", children[i]._name); | |
| 76 InspectorTest.assertEquals(100, children[i]._shallowSize); | |
| 77 InspectorTest.assertEquals(1100, children[i]._retainedSize); | |
| 78 } | |
| 79 setTimeout(next, 0); | |
| 80 } | |
| 81 } | |
| 82 ]); | |
| 83 } | |
| 84 | |
| 85 </script> | |
| 86 </head> | |
| 87 <body onload="runTest()"> | |
| 88 <pre> | |
| 89 Tests that weak references are ignored when dominators are calculated and that w eak references won't affect object's retained size. | |
| 90 </pre> | |
| 91 </body> | |
| 92 </html> | |
| OLD | NEW |