Commit 25c17aa9 authored by mnaganov@chromium.org's avatar mnaganov@chromium.org
Browse files

2011-04-08 Mikhail Naganov <mnaganov@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: [Chromium] Add more tests for detailed heap snapshots UI.
        https://bugs.webkit.org/show_bug.cgi?id=58010
        https://bugs.webkit.org/show_bug.cgi?id=58011

        Added tests for "Containment" view. Minor refactorings, bugs fixed.
        Split one large tests into smaller ones to avoid timing out in debug mode.

        Tests: inspector/profiler/detailed-heapshots-containment-expansion-preserved-when-sorting.html
               inspector/profiler/detailed-heapshots-containment-show-all.html
               inspector/profiler/detailed-heapshots-containment-show-next.html
               inspector/profiler/detailed-heapshots-containment-sorting.html
               inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting.html
               inspector/profiler/detailed-heapshots-summary-show-all.html
               inspector/profiler/detailed-heapshots-summary-show-next.html
               inspector/profiler/detailed-heapshots-summary-sorting.html

        * inspector/front-end/DetailedHeapshotGridNodes.js:
        (WebInspector.HeapSnapshotGridNode):
        (WebInspector.HeapSnapshotGridNode.prototype.populateChildren):
        (WebInspector.HeapSnapshotGridNode.prototype.sort.doSort):
        (WebInspector.HeapSnapshotGridNode.prototype.sort):
        (WebInspector.HeapSnapshotGenericObjectNode):
        (WebInspector.HeapSnapshotObjectNode):
        (WebInspector.HeapSnapshotInstanceNode):
        (WebInspector.HeapSnapshotConstructorNode):
        (WebInspector.HeapSnapshotDiffNode):
        (WebInspector.HeapSnapshotDominatorObjectNode):
        * inspector/front-end/DetailedHeapshotView.js:
        (WebInspector.HeapSnapshotContainmentDataGrid):
        (WebInspector.HeapSnapshotDominatorsDataGrid):

2011-04-08  Mikhail Naganov  <mnaganov@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: [Chromium] Add more tests for detailed heap snapshots UI.
        https://bugs.webkit.org/show_bug.cgi?id=58010
        https://bugs.webkit.org/show_bug.cgi?id=58011

        Added tests for "Containment" view. Minor refactorings, bugs fixed.
        Split one large tests into smaller ones to avoid timing out in debug mode.

        * inspector/profiler/detailed-heapshots-containment-expansion-preserved-when-sorting-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-containment-expansion-preserved-when-sorting.html: Added.
        * inspector/profiler/detailed-heapshots-containment-show-all-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-containment-show-all.html: Added.
        * inspector/profiler/detailed-heapshots-containment-show-next-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-containment-show-next.html: Added.
        * inspector/profiler/detailed-heapshots-containment-sorting-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-containment-sorting.html: Added.
        * inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting.html: Added.
        * inspector/profiler/detailed-heapshots-summary-expected.txt: Removed.
        * inspector/profiler/detailed-heapshots-summary-show-all-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-summary-show-all.html: Added.
        * inspector/profiler/detailed-heapshots-summary-show-next-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-summary-show-next.html: Added.
        * inspector/profiler/detailed-heapshots-summary-sorting-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-summary-sorting.html: Added.
        * inspector/profiler/detailed-heapshots-summary.html: Removed.
        * inspector/profiler/detailed-heapshots-test.js:
        (initialize_DetailedHeapshotTest.InspectorTest.startProfilerTest.detailedHeapProfilesEnabled):
        (initialize_DetailedHeapshotTest.InspectorTest.startProfilerTest):
        (initialize_DetailedHeapshotTest.):
        (initialize_DetailedHeapshotTest):
        * platform/chromium/inspector/profiler/detailed-heapshots-containment-expansion-preserved-when-sorting-expected.txt: Copied from LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-summary-expected.txt.
        * platform/chromium/inspector/profiler/detailed-heapshots-containment-show-all-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-containment-show-next-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-containment-sorting-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting-expected.txt: Renamed from LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-summary-expected.txt.
        * platform/chromium/inspector/profiler/detailed-heapshots-summary-show-all-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-summary-show-next-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-summary-sorting-expected.txt: Added.
        * platform/chromium/test_expectations.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@83286 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9fdebe06
2011-04-08 Mikhail Naganov <mnaganov@chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: [Chromium] Add more tests for detailed heap snapshots UI.
https://bugs.webkit.org/show_bug.cgi?id=58010
https://bugs.webkit.org/show_bug.cgi?id=58011
Added tests for "Containment" view. Minor refactorings, bugs fixed.
Split one large tests into smaller ones to avoid timing out in debug mode.
* inspector/profiler/detailed-heapshots-containment-expansion-preserved-when-sorting-expected.txt: Added.
* inspector/profiler/detailed-heapshots-containment-expansion-preserved-when-sorting.html: Added.
* inspector/profiler/detailed-heapshots-containment-show-all-expected.txt: Added.
* inspector/profiler/detailed-heapshots-containment-show-all.html: Added.
* inspector/profiler/detailed-heapshots-containment-show-next-expected.txt: Added.
* inspector/profiler/detailed-heapshots-containment-show-next.html: Added.
* inspector/profiler/detailed-heapshots-containment-sorting-expected.txt: Added.
* inspector/profiler/detailed-heapshots-containment-sorting.html: Added.
* inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting-expected.txt: Added.
* inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting.html: Added.
* inspector/profiler/detailed-heapshots-summary-expected.txt: Removed.
* inspector/profiler/detailed-heapshots-summary-show-all-expected.txt: Added.
* inspector/profiler/detailed-heapshots-summary-show-all.html: Added.
* inspector/profiler/detailed-heapshots-summary-show-next-expected.txt: Added.
* inspector/profiler/detailed-heapshots-summary-show-next.html: Added.
* inspector/profiler/detailed-heapshots-summary-sorting-expected.txt: Added.
* inspector/profiler/detailed-heapshots-summary-sorting.html: Added.
* inspector/profiler/detailed-heapshots-summary.html: Removed.
* inspector/profiler/detailed-heapshots-test.js:
(initialize_DetailedHeapshotTest.InspectorTest.startProfilerTest.detailedHeapProfilesEnabled):
(initialize_DetailedHeapshotTest.InspectorTest.startProfilerTest):
(initialize_DetailedHeapshotTest.):
(initialize_DetailedHeapshotTest):
* platform/chromium/inspector/profiler/detailed-heapshots-containment-expansion-preserved-when-sorting-expected.txt: Copied from LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-summary-expected.txt.
* platform/chromium/inspector/profiler/detailed-heapshots-containment-show-all-expected.txt: Added.
* platform/chromium/inspector/profiler/detailed-heapshots-containment-show-next-expected.txt: Added.
* platform/chromium/inspector/profiler/detailed-heapshots-containment-sorting-expected.txt: Added.
* platform/chromium/inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting-expected.txt: Renamed from LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-summary-expected.txt.
* platform/chromium/inspector/profiler/detailed-heapshots-summary-show-all-expected.txt: Added.
* platform/chromium/inspector/profiler/detailed-heapshots-summary-show-next-expected.txt: Added.
* platform/chromium/inspector/profiler/detailed-heapshots-summary-sorting-expected.txt: Added.
2011-04-07 Pavel Podivilov <podivilov@chromium.org>
 
Reviewed by Pavel Feldman.
Tests Containment view of detailed heap snapshots. Expanded nodes must be preserved after sorting.
Heap profiler is disabled
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="detailed-heapshots-test.js"></script>
<script>
function test()
{
var instanceCount = 25;
function createHeapSnapshot()
{
return InspectorTest.createHeapSnapshot(instanceCount);
}
InspectorTest.runDetailedHeapshotTestSuite([
function testExpansionPreservedWhenSorting(next)
{
InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
function step1()
{
InspectorTest.switchToView("Containment", step2);
}
var columns;
function step2()
{
columns = InspectorTest.viewColumns();
InspectorTest.clickColumn(columns[0], step3);
}
function step3()
{
InspectorTest.findAndExpandGCRoots(step4);
}
function step4(row)
{
var buttonsNode = InspectorTest.findButtonsNode(row);
InspectorTest.assertEquals(true, !!buttonsNode, "no buttons node found!");
InspectorTest.clickShowMoreButton("showAll", buttonsNode, step5);
}
function step5(row)
{
var row = row.children[0];
InspectorTest.assertEquals(true, !!row, "\"B\" instance row");
InspectorTest.expandRow(row, expandA);
function expandA(row)
{
function propertyMatcher(data)
{
return data.name === "a" && data.value.charAt(0) === "A";
}
var aRow = InspectorTest.findRow("object", propertyMatcher, row);
InspectorTest.assertEquals(true, !!aRow, "\"a: A\" row");
InspectorTest.expandRow(aRow, step6);
}
}
var columnContents;
function step6()
{
columnContents = InspectorTest.columnContents(columns[0]);
InspectorTest.clickColumn(columns[0], clickTwice);
function clickTwice()
{
InspectorTest.clickColumn(columns[0], step7);
}
}
function step7()
{
var newColumnContents = InspectorTest.columnContents(columns[0]);
InspectorTest.assertColumnContentsEqual(columnContents, newColumnContents);
setTimeout(next, 0);
}
}
]);
}
</script>
</head>
<body onload="runTest()">
<p>
Tests Containment view of detailed heap snapshots.
Expanded nodes must be preserved after sorting.
</p>
</body>
</html>
Tests Containment view of detailed heap snapshots. The "Show All" button must show all nodes.
Heap profiler is disabled
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="detailed-heapshots-test.js"></script>
<script>
function test()
{
var instanceCount = 25;
function createHeapSnapshot()
{
return InspectorTest.createHeapSnapshot(instanceCount);
}
InspectorTest.runDetailedHeapshotTestSuite([
function testShowAll(next)
{
InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
function step1()
{
InspectorTest.switchToView("Containment", step2);
}
function step2()
{
InspectorTest.findAndExpandGCRoots(step3);
}
function step3(row)
{
var buttonsNode = InspectorTest.findButtonsNode(row);
InspectorTest.assertEquals(true, !!buttonsNode, "buttons node");
var words = buttonsNode.showAll.textContent.split(" ");
for (var i = 0; i < words.length; ++i) {
var maybeNumber = parseInt(words[i], 10);
if (!isNaN(maybeNumber))
InspectorTest.assertEquals(instanceCount, maybeNumber, buttonsNode.showAll.textContent);
}
InspectorTest.clickShowMoreButton("showAll", buttonsNode, step4);
}
function step4(row)
{
var rowsShown = InspectorTest.countDataRows(row);
InspectorTest.assertEquals(instanceCount, rowsShown, "after showAll click");
var buttonsNode = InspectorTest.findButtonsNode(row);
InspectorTest.assertEquals(false, !!buttonsNode, "buttons node found when all instances are shown!");
setTimeout(next, 0);
}
}
]);
}
</script>
</head>
<body onload="runTest()">
<p>
Tests Containment view of detailed heap snapshots.
The &quot;Show All&quot; button must show all nodes.
</p>
</body>
</html>
Tests Containment view of detailed heap snapshots. Repeated clicks on "Show Next" button must show all nodes.
Heap profiler is disabled
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="detailed-heapshots-test.js"></script>
<script>
function test()
{
var instanceCount = 25;
function createHeapSnapshot()
{
return InspectorTest.createHeapSnapshot(instanceCount);
}
InspectorTest.runDetailedHeapshotTestSuite([
function testShowNext(next)
{
InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
function step1()
{
InspectorTest.switchToView("Containment", step2);
}
function step2()
{
InspectorTest.findAndExpandGCRoots(step3);
}
function step3(row)
{
var rowsShown = InspectorTest.countDataRows(row);
InspectorTest.assertEquals(true, rowsShown <= instanceCount, "shown more instances than created: " + rowsShown + " > " + instanceCount);
if (rowsShown < instanceCount) {
var buttonsNode = InspectorTest.findButtonsNode(row);
InspectorTest.assertEquals(true, !!buttonsNode, "buttons node");
InspectorTest.clickShowMoreButton("showNext", buttonsNode, step3);
} else if (rowsShown === instanceCount) {
var buttonsNode = InspectorTest.findButtonsNode(row);
InspectorTest.assertEquals(false, !!buttonsNode, "buttons node found when all instances are shown!");
setTimeout(next, 0);
}
}
}
]);
}
</script>
</head>
<body onload="runTest()">
<p>
Tests Containment view of detailed heap snapshots.
Repeated clicks on &quot;Show Next&quot; button must show all nodes.
</p>
</body>
</html>
Tests sorting in Containment view of detailed heap snapshots.
Heap profiler is disabled
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="detailed-heapshots-test.js"></script>
<script>
function test()
{
var instanceCount = 25;
function createHeapSnapshot()
{
return InspectorTest.createHeapSnapshot(instanceCount);
}
InspectorTest.runDetailedHeapshotTestSuite([
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>
Tests Summary view of detailed heap snapshots. Expanded nodes must be preserved after sorting.
Heap profiler is disabled
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="detailed-heapshots-test.js"></script>
<script>
function test()
{
var instanceCount = 25;
function createHeapSnapshot()
{
return InspectorTest.createHeapSnapshot(instanceCount);
}
InspectorTest.runDetailedHeapshotTestSuite([
function testExpansionPreservedWhenSorting(next)
{
InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
function step1()
{
InspectorTest.switchToView("Summary", step2);
}
function step2()
{
var row = InspectorTest.findRow("object", "B");
InspectorTest.assertEquals(true, !!row, "\"B\" row");
InspectorTest.expandRow(row, expandB);
function expandB()
{
var buttonsNode = InspectorTest.findButtonsNode(row);
InspectorTest.assertEquals(true, !!buttonsNode, "no buttons node found!");
InspectorTest.clickShowMoreButton("showAll", buttonsNode, step3);
}
}
var columns;
function step3()
{
columns = InspectorTest.viewColumns();
InspectorTest.clickColumn(columns[0], step4);
}
function step4()
{
var row = InspectorTest.findRow("object", "B");
InspectorTest.assertEquals(true, !!row, "\"B\" row");
bInstanceRow = row.children[0];
InspectorTest.assertEquals(true, !!bInstanceRow, "\"B\" instance row");
InspectorTest.expandRow(bInstanceRow, expandA);
function expandA(row)
{
function propertyMatcher(data)
{
return data.name === "a" && data.value.charAt(0) === "A";
}
var aRow = InspectorTest.findRow("object", propertyMatcher, row);
InspectorTest.assertEquals(true, !!aRow, "\"a: A\" row");
InspectorTest.expandRow(aRow, step5);
}
}
var columnContents;
function step5()
{
columnContents = InspectorTest.columnContents(columns[0]);
InspectorTest.clickColumn(columns[0], clickTwice);
function clickTwice()
{
InspectorTest.clickColumn(columns[0], step6);
}
}
function step6()
{
var newColumnContents = InspectorTest.columnContents(columns[0]);
InspectorTest.assertColumnContentsEqual(columnContents, newColumnContents);
setTimeout(next, 0);
}
}
]);
}
</script>
</head>
<body onload="runTest()">
<p>
Tests Summary view of detailed heap snapshots.
Expanded nodes must be preserved after sorting.
</p>
</body>
</html>
Tests Summary view of detailed heap snapshots. The "Show All" button must show all nodes.
Heap profiler is disabled
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="detailed-heapshots-test.js"></script>
<script>
function test()
{
var instanceCount = 25;
function createHeapSnapshot()
{
return InspectorTest.createHeapSnapshot(instanceCount);
}
InspectorTest.runDetailedHeapshotTestSuite([
function testShowAll(next)
{
InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
function step1()
{
InspectorTest.switchToView("Summary", step2);
}
function step2()
{
var row = InspectorTest.findRow("object", "A");
InspectorTest.assertEquals(true, !!row, "\"A\" row");
InspectorTest.expandRow(row, step3);
}
function step3(row)
{
var count = row.data["count"];
InspectorTest.assertEquals(instanceCount, count);
var buttonsNode = InspectorTest.findButtonsNode(row);
InspectorTest.assertEquals(true, !!buttonsNode, "buttons node");
var words = buttonsNode.showAll.textContent.split(" ");
for (var i = 0; i < words.length; ++i) {
var maybeNumber = parseInt(words[i], 10);
if (!isNaN(maybeNumber))
InspectorTest.assertEquals(instanceCount, maybeNumber, buttonsNode.showAll.textContent);
}
InspectorTest.clickShowMoreButton("showAll", buttonsNode, step4);
}
function step4(row)
{
var rowsShown = InspectorTest.countDataRows(row);
InspectorTest.assertEquals(instanceCount, rowsShown, "after showAll click");
var buttonsNode = InspectorTest.findButtonsNode(row);
InspectorTest.assertEquals(false, !!buttonsNode, "buttons node found when all instances are shown!");
setTimeout(next, 0);
}
}
]);
}
</script>
</head>
<body onload="runTest()">
<p>
Tests Summary view of detailed heap snapshots.
The &quot;Show All&quot; button must show all nodes.
</p>
</body>
</html>
Tests Summary view of detailed heap snapshots. Repeated clicks on "Show Next" button must show all nodes.
Heap profiler is disabled
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="detailed-heapshots-test.js"></script>
<script>
function test()
{
var instanceCount = 25;
function createHeapSnapshot()
{
return InspectorTest.createHeapSnapshot(instanceCount);
}
InspectorTest.runDetailedHeapshotTestSuite([
function testShowNext(next)
{
InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
function step1()