Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / profiler / heap-snapshot-summary-show-ranges.html
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     WebInspector.showPanel("profiles");
10
11     var instanceCount = 50;
12     function createHeapSnapshot()
13     {
14         return InspectorTest.createHeapSnapshot(instanceCount);
15     }
16
17     InspectorTest.runHeapSnapshotTestSuite([
18         function testShowAll(next)
19         {
20             InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
21
22             function step1()
23             {
24                 InspectorTest.switchToView("Summary", step2);
25             }
26
27             function step2()
28             {
29                 var row = InspectorTest.findRow("object", "A");
30                 InspectorTest.assertEquals(true, !!row, "\"A\" row");
31                 InspectorTest.expandRow(row, step3);
32             }
33
34             function checkShowMoreButton(showMoreButton, expectedStartPosition, expectedEndPosition)
35             {
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");
39             }
40
41             function step3(row)
42             {
43                 // _positionRanges: [0, 10)
44                 var count = row.data["count"];
45                 InspectorTest.assertEquals(instanceCount.toString(), count);
46
47                 var defaultChunkSize = row._dataGrid.defaultPopulateCount();
48                 InspectorTest.assertEquals(10, defaultChunkSize);
49
50
51                 var showMoreButton = row.children[defaultChunkSize];
52                 checkShowMoreButton(showMoreButton, defaultChunkSize, instanceCount);
53
54                 row._populateChildren(30, 40, step4.bind(this, row));
55             }
56
57             function step4(row)
58             {
59                 // _positionRanges: [0, 10) [30, 40)
60                 checkShowMoreButton(row.children[10], 10, 30);
61                 checkShowMoreButton(row.children[(10 - 0) + 1 + (40 - 30)], 40, instanceCount);
62
63                 row._populateChildren(20, 25, step5.bind(this, row));
64             }
65
66             function step5(row)
67             {
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);
72
73                 row._populateChildren(28, 35, step6.bind(this, row));
74             }
75
76             function step6(row)
77             {
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);
82
83                 row._populateChildren(18, 26, step7.bind(this, row));
84             }
85
86             function step7(row)
87             {
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);
92
93                 row._populateChildren(15, 45, step8.bind(this, row));
94             }
95
96             function step8(row)
97             {
98                 // _positionRanges: [0, 10) [15, 45)
99                 checkShowMoreButton(row.children[10], 10, 15);
100                 checkShowMoreButton(row.children[(10 - 0) + 1 + (45 - 15)], 45, instanceCount);
101
102                 row._populateChildren(10, 15, step9.bind(this, row));
103             }
104
105             function step9(row)
106             {
107                 // _positionRanges: [0, 45)
108                 checkShowMoreButton(row.children[45], 45, instanceCount);
109                 setTimeout(next, 0);
110             }
111         }
112     ]);
113 }
114
115 </script>
116 </head>
117 <body onload="runTest()">
118 <p>
119 Tests showing several node ranges in the Summary view of detailed heap snapshot.
120 </p>
121 </body>
122 </html>