| 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 var instanceCount = 25; | 9 var instanceCount = 25; |
| 10 function createHeapSnapshot() | 10 function createHeapSnapshot() |
| 11 { | 11 { |
| 12 return InspectorTest.createHeapSnapshot(instanceCount); | 12 return InspectorTest.createHeapSnapshot(instanceCount); |
| 13 } | 13 } |
| 14 | 14 |
| 15 InspectorTest.runHeapSnapshotTestSuite([ | 15 InspectorTest.runHeapSnapshotTestSuite([ |
| 16 function testRetainersView(next) | 16 function testRetainersView(next) |
| 17 { | 17 { |
| 18 InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1); | 18 InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1); |
| 19 | 19 |
| 20 function step1() | 20 function step1() |
| 21 { | 21 { |
| 22 InspectorTest.switchToView("Summary", step2); | 22 InspectorTest.switchToView("Summary", step2); |
| 23 } | 23 } |
| 24 | 24 |
| 25 function step2() | 25 function step2() |
| 26 { | 26 { |
| 27 var row = InspectorTest.findRow("object", "A"); | 27 var row = InspectorTest.findRow("A"); |
| 28 InspectorTest.assertEquals(true, !!row, "\"A\" row"); | 28 InspectorTest.assertEquals(true, !!row, "\"A\" row"); |
| 29 InspectorTest.expandRow(row, step3); | 29 InspectorTest.expandRow(row, step3); |
| 30 } | 30 } |
| 31 | 31 |
| 32 function step3(row) | 32 function step3(row) |
| 33 { | 33 { |
| 34 var count = row.data["count"]; | 34 var count = row.data["count"]; |
| 35 InspectorTest.assertEquals(instanceCount.toString(), count); | 35 InspectorTest.assertEquals(instanceCount.toString(), count); |
| 36 InspectorTest.clickRowAndGetRetainers(row.children[0], step4); | 36 InspectorTest.clickRowAndGetRetainers(row.children[0], step4); |
| 37 } | 37 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1); | 83 InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1); |
| 84 | 84 |
| 85 function step1() | 85 function step1() |
| 86 { | 86 { |
| 87 InspectorTest.switchToView("Summary", step2); | 87 InspectorTest.switchToView("Summary", step2); |
| 88 } | 88 } |
| 89 | 89 |
| 90 function step2() | 90 function step2() |
| 91 { | 91 { |
| 92 var row = InspectorTest.findRow("object", "L3"); | 92 var row = InspectorTest.findRow("L3"); |
| 93 InspectorTest.assertEquals(true, !!row, "\"L3\" row"); | 93 InspectorTest.assertEquals(true, !!row, "\"L3\" row"); |
| 94 InspectorTest.expandRow(row, step3); | 94 InspectorTest.expandRow(row, step3); |
| 95 } | 95 } |
| 96 | 96 |
| 97 function step3(row) | 97 function step3(row) |
| 98 { | 98 { |
| 99 var count = row.data["count"]; | 99 var count = row.data["count"]; |
| 100 InspectorTest.assertEquals("1", count); | 100 InspectorTest.assertEquals("1", count); |
| 101 InspectorTest.clickRowAndGetRetainers(row.children[0], step4); | 101 InspectorTest.clickRowAndGetRetainers(row.children[0], step4); |
| 102 } | 102 } |
| 103 | 103 |
| 104 function step4(retainersRoot) | 104 function step4(retainersRoot) |
| 105 { | 105 { |
| 106 retainersRoot.dataGrid.addEventListener( | 106 retainersRoot.dataGrid.addEventListener( |
| 107 WebInspector.HeapSnapshotRetainmentDataGrid.Events.ExpandRet
ainersComplete, | 107 WebInspector.HeapSnapshotRetainmentDataGrid.Events.ExpandRet
ainersComplete, |
| 108 step5.bind(this, retainersRoot)); | 108 step5.bind(this, retainersRoot)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 function step5(retainersRoot) | 111 function step5(retainersRoot) |
| 112 { | 112 { |
| 113 var l3 = retainersRoot; | 113 var l3 = retainersRoot; |
| 114 InspectorTest.assertEquals(1, l3.children.length, "One retainer
of L3"); | 114 InspectorTest.assertEquals(1, l3.children.length, "One retainer
of L3"); |
| 115 var l2 = l3.children[0]; | 115 var l2 = l3.children[0]; |
| 116 InspectorTest.assertEquals("y", l2.data.object.name); | 116 InspectorTest.assertEquals("y", l2._referenceName); |
| 117 InspectorTest.assertEquals(1, l2.children.length, "One retainer
of L2"); | 117 InspectorTest.assertEquals(1, l2.children.length, "One retainer
of L2"); |
| 118 var l1 = l2.children[0]; | 118 var l1 = l2.children[0]; |
| 119 InspectorTest.assertEquals("x", l1.data.object.name); | 119 InspectorTest.assertEquals("x", l1._referenceName); |
| 120 InspectorTest.assertEquals(2, l1.children.length, "Two retainers
of L1"); | 120 InspectorTest.assertEquals(2, l1.children.length, "Two retainers
of L1"); |
| 121 var l1retainers = [l1.children[0].data.object.name, l1.children[
1].data.object.name]; | 121 var l1retainers = [l1.children[0]._referenceName, l1.children[1]
._referenceName]; |
| 122 l1retainers.sort(); | 122 l1retainers.sort(); |
| 123 InspectorTest.assertEquals("l1a", l1retainers[0]); | 123 InspectorTest.assertEquals("l1a", l1retainers[0]); |
| 124 InspectorTest.assertEquals("l1b", l1retainers[1]); | 124 InspectorTest.assertEquals("l1b", l1retainers[1]); |
| 125 setTimeout(next, 0); | 125 setTimeout(next, 0); |
| 126 } | 126 } |
| 127 }, | 127 }, |
| 128 | 128 |
| 129 function testRetainersAutoExpandSingleRetainerLimit(next) | 129 function testRetainersAutoExpandSingleRetainerLimit(next) |
| 130 { | 130 { |
| 131 function createHeapSnapshot() | 131 function createHeapSnapshot() |
| (...skipping 29 matching lines...) Expand all Loading... |
| 161 | 161 |
| 162 InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1); | 162 InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1); |
| 163 | 163 |
| 164 function step1() | 164 function step1() |
| 165 { | 165 { |
| 166 InspectorTest.switchToView("Summary", step2); | 166 InspectorTest.switchToView("Summary", step2); |
| 167 } | 167 } |
| 168 | 168 |
| 169 function step2() | 169 function step2() |
| 170 { | 170 { |
| 171 var row = InspectorTest.findRow("object", "Tail"); | 171 var row = InspectorTest.findRow("Tail"); |
| 172 InspectorTest.assertEquals(true, !!row, "\"Tail\" row"); | 172 InspectorTest.assertEquals(true, !!row, "\"Tail\" row"); |
| 173 InspectorTest.expandRow(row, step3); | 173 InspectorTest.expandRow(row, step3); |
| 174 } | 174 } |
| 175 | 175 |
| 176 function step3(row) | 176 function step3(row) |
| 177 { | 177 { |
| 178 var count = row.data["count"]; | 178 var count = row.data["count"]; |
| 179 InspectorTest.assertEquals("1", count); | 179 InspectorTest.assertEquals("1", count); |
| 180 InspectorTest.clickRowAndGetRetainers(row.children[0], step4); | 180 InspectorTest.clickRowAndGetRetainers(row.children[0], step4); |
| 181 } | 181 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 202 <body onload="runTest()"> | 202 <body onload="runTest()"> |
| 203 <pre> | 203 <pre> |
| 204 Tests retainers view. | 204 Tests retainers view. |
| 205 - Number of retainers of an A object must be 2 (A itself and B).</ul> | 205 - Number of retainers of an A object must be 2 (A itself and B).</ul> |
| 206 - When an object has just one retainer it must be expanded automatically until | 206 - When an object has just one retainer it must be expanded automatically until |
| 207 there's an object having two or more retainers. | 207 there's an object having two or more retainers. |
| 208 - Test the expansion of a long retainment chain is limited by a certain level. | 208 - Test the expansion of a long retainment chain is limited by a certain level. |
| 209 </pre> | 209 </pre> |
| 210 </body> | 210 </body> |
| 211 </html> | 211 </html> |
| OLD | NEW |