blob: 80c29bf7f366cc6afc679e0bec2ce8b6e9601705 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="heap-snapshot-test.js"></script>
<script>
function test()
{
var instanceCount = 24;
function createHeapSnapshotA()
{
return InspectorTest.createHeapSnapshot(instanceCount, 5);
}
function createHeapSnapshotB()
{
return InspectorTest.createHeapSnapshot(instanceCount + 1, 5 + instanceCount);
}
InspectorTest.runHeapSnapshotTestSuite([
function testExpansionPreservedWhenSorting(next)
{
InspectorTest.takeAndOpenSnapshot(createHeapSnapshotA, createSnapshotB);
function createSnapshotB() {
InspectorTest.takeAndOpenSnapshot(createHeapSnapshotB, step1);
}
function step1()
{
InspectorTest.switchToView("Comparison", step2);
}
var columns;
function step2()
{
columns = InspectorTest.viewColumns();
InspectorTest.clickColumn(columns[0], step3);
}
function step3()
{
var row = InspectorTest.findRow("object", "B");
InspectorTest.assertEquals(true, !!row, "\"B\" row");
InspectorTest.expandRow(row, showNext);
function showNext(row)
{
var buttonsNode = InspectorTest.findButtonsNode(row);
InspectorTest.assertEquals(true, !!buttonsNode, "no buttons node found!");
InspectorTest.clickShowMoreButton("showAll", buttonsNode, step4);
}
}
function step4()
{
var row = InspectorTest.findRow("object", "B");
InspectorTest.assertEquals(true, !!row, "\"B\" row");
function deletedNodeMatcher(data)
{
return data.removedCount && data.object.value.charAt(0) === "B";
}
var bInstanceRow = InspectorTest.findRow2(deletedNodeMatcher, row);
InspectorTest.assertEquals(true, !!bInstanceRow, "\"B\" instance row");
var buttonsNode = InspectorTest.findButtonsNode(row, bInstanceRow);
InspectorTest.assertEquals(false, !!buttonsNode, "buttons node found!");
step5();
}
var nodeCount;
function step5()
{
nodeCount = InspectorTest.columnContents(columns[0]).length;
InspectorTest.assertEquals(true, nodeCount > 0, "nodeCount > 0");
InspectorTest.clickColumn(columns[0], clickTwice);
function clickTwice()
{
InspectorTest.clickColumn(columns[0], step6);
}
}
function step6()
{
var newNodeCount = InspectorTest.columnContents(columns[0]).length;
InspectorTest.assertEquals(nodeCount, newNodeCount);
setTimeout(next, 0);
}
}
]);
}
</script>
</head>
<body onload="runTest()">
<p>
Tests Comparison view of detailed heap snapshots.
Shown node count must be preserved after sorting.
</p>
</body>
</html>