3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"heap-snapshot-test.js"></script>
9 var instanceCount
= 10;
10 function createHeapSnapshot()
12 return InspectorTest
.createHeapSnapshot(instanceCount
);
15 InspectorTest
.runHeapSnapshotTestSuite([
16 function testSorting(next
)
18 InspectorTest
.takeAndOpenSnapshot(createHeapSnapshot
, step1
);
22 InspectorTest
.switchToView("Summary", step1a
);
27 var currentColumnOrder
;
31 var row
= InspectorTest
.findRow("B");
32 InspectorTest
.assertEquals(true, !!row
, "\"B\" row");
33 InspectorTest
.expandRow(row
, step2
);
38 columns
= InspectorTest
.viewColumns();
40 currentColumnOrder
= false;
46 if (currentColumn
>= columns
.length
) {
51 InspectorTest
.clickColumn(columns
[currentColumn
], step4
);
54 function step4(newColumnState
)
56 columns
[currentColumn
] = newColumnState
;
57 var columnName
= columns
[currentColumn
].identifier
;
58 var row
= InspectorTest
.findRow("B");
59 InspectorTest
.assertEquals(true, !!row
, "\"B\" row");
60 var contents
= row
.children
.map(function(obj
) { return obj
.element().children
[currentColumn
].textContent
; });
61 InspectorTest
.assertEquals(instanceCount
, contents
.length
, "column contents");
62 var sortTypes
= { object
: "text", distance
: "number", count
: "number", shallowSize
: "size", retainedSize
: "size" };
63 InspectorTest
.assertEquals(true, !!sortTypes
[columns
[currentColumn
].identifier
], "sort by identifier");
64 InspectorTest
.checkArrayIsSorted(contents
, sortTypes
[columns
[currentColumn
].identifier
], columns
[currentColumn
].sort
);
66 if (!currentColumnOrder
)
67 currentColumnOrder
= true;
69 currentColumnOrder
= false;
80 <body onload=
"runTest()">
82 Tests sorting in Summary view of detailed heap snapshots.