3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="heap-snapshot-test.js"></script>
9 WebInspector.showPanel("profiles");
11 var instanceCount = 50;
12 function createHeapSnapshot()
14 return InspectorTest.createHeapSnapshot(instanceCount);
17 InspectorTest.runHeapSnapshotTestSuite([
18 function testShowAll(next)
20 InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
24 InspectorTest.switchToView("Summary", step2);
29 var row = InspectorTest.findRow("object", "A");
30 InspectorTest.assertEquals(true, !!row, "\"A\" row");
31 InspectorTest.expandRow(row, step3);
34 function checkShowMoreButton(showMoreButton, expectedStartPosition, expectedEndPosition)
36 InspectorTest.assertEquals(true , showMoreButton instanceof WebInspector.ShowMoreDataGridNode, "Show more button node not found");
37 InspectorTest.assertEquals(expectedStartPosition , showMoreButton._startPosition, "Incorrect start position");
38 InspectorTest.assertEquals(expectedEndPosition , showMoreButton._endPosition, "Incorrect end position");
43 // _positionRanges: [0, 10)
44 var count = row.data["count"];
45 InspectorTest.assertEquals(instanceCount.toString(), count);
47 var defaultChunkSize = row._dataGrid.defaultPopulateCount();
48 InspectorTest.assertEquals(10, defaultChunkSize);
51 var showMoreButton = row.children[defaultChunkSize];
52 checkShowMoreButton(showMoreButton, defaultChunkSize, instanceCount);
54 row._populateChildren(30, 40, step4.bind(this, row));
59 // _positionRanges: [0, 10) [30, 40)
60 checkShowMoreButton(row.children[10], 10, 30);
61 checkShowMoreButton(row.children[(10 - 0) + 1 + (40 - 30)], 40, instanceCount);
63 row._populateChildren(20, 25, step5.bind(this, row));
68 // _positionRanges: [0, 10) [20, 25) [30, 40)
69 checkShowMoreButton(row.children[10], 10, 20);
70 checkShowMoreButton(row.children[(10 - 0) + 1 + (25 - 20)], 25, 30);
71 checkShowMoreButton(row.children[(10 - 0) + 1 + (25 - 20) + 1 + (40 - 30)], 40, instanceCount);
73 row._populateChildren(28, 35, step6.bind(this, row));
78 // _positionRanges: [0, 10) [20, 25) [28, 40)
79 checkShowMoreButton(row.children[10], 10, 20);
80 checkShowMoreButton(row.children[(10 - 0) + 1 + (25 - 20)], 25, 28);
81 checkShowMoreButton(row.children[(10 - 0) + 1 + (25 - 20) + 1 + (40 - 28)], 40, instanceCount);
83 row._populateChildren(18, 26, step7.bind(this, row));
88 // _positionRanges: [0, 10) [18, 26) [28, 40)
89 checkShowMoreButton(row.children[10], 10, 18);
90 checkShowMoreButton(row.children[(10 - 0) + 1 + (26 - 18)], 26, 28);
91 checkShowMoreButton(row.children[(10 - 0) + 1 + (26 - 18) + 1 + (40 - 28)], 40, instanceCount);
93 row._populateChildren(15, 45, step8.bind(this, row));
98 // _positionRanges: [0, 10) [15, 45)
99 checkShowMoreButton(row.children[10], 10, 15);
100 checkShowMoreButton(row.children[(10 - 0) + 1 + (45 - 15)], 45, instanceCount);
102 row._populateChildren(10, 15, step9.bind(this, row));
107 // _positionRanges: [0, 45)
108 checkShowMoreButton(row.children[45], 45, instanceCount);
117 <body onload="runTest()">
119 Tests showing several node ranges in the Summary view of detailed heap snapshot.