| <html> |
| <head> |
| <script src="../../http/tests/inspector/inspector-test.js"></script> |
| <script src="heap-snapshot-test.js"></script> |
| <script> |
| |
| function test() |
| { |
| var instanceCount = 25; |
| function createHeapSnapshot() |
| { |
| return InspectorTest.createHeapSnapshot(instanceCount); |
| } |
| |
| InspectorTest.runHeapSnapshotTestSuite([ |
| function testSorting(next) |
| { |
| InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1); |
| |
| function step1() |
| { |
| InspectorTest.switchToView("Containment", step2); |
| } |
| |
| var gcRoots; |
| var columns; |
| var currentColumn; |
| var currentColumnOrder; |
| |
| function step2() |
| { |
| InspectorTest.findAndExpandGCRoots(step3); |
| } |
| |
| function step3(gcRootsRow) |
| { |
| gcRoots = gcRootsRow; |
| columns = InspectorTest.viewColumns(); |
| currentColumn = 0; |
| currentColumnOrder = false; |
| setTimeout(step4, 0); |
| } |
| |
| function step4() |
| { |
| if (currentColumn >= columns.length) { |
| setTimeout(next, 0); |
| return; |
| } |
| |
| InspectorTest.clickColumn(columns[currentColumn], step5); |
| } |
| |
| function step5(newColumnState) |
| { |
| columns[currentColumn] = newColumnState; |
| var contents = InspectorTest.columnContents(columns[currentColumn], gcRoots); |
| InspectorTest.assertEquals(true, !!contents.length, "column contents"); |
| var sortTypes = { object: "name", shallowSize: "size", retainedSize: "size" }; |
| InspectorTest.assertEquals(true, !!sortTypes[columns[currentColumn].identifier], "sort by identifier"); |
| InspectorTest.checkArrayIsSorted(contents, sortTypes[columns[currentColumn].identifier], columns[currentColumn].sort); |
| |
| if (!currentColumnOrder) |
| currentColumnOrder = true; |
| else { |
| currentColumnOrder = false; |
| ++currentColumn; |
| } |
| setTimeout(step4, 0); |
| } |
| } |
| ]); |
| } |
| |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p> |
| Tests sorting in Containment view of detailed heap snapshots. |
| </p> |
| </body> |
| </html> |