2011-04-12 Mikhail Naganov <mnaganov@chromium.org>
authormnaganov@chromium.org <mnaganov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Apr 2011 12:28:11 +0000 (12:28 +0000)
committermnaganov@chromium.org <mnaganov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Apr 2011 12:28:11 +0000 (12:28 +0000)
        Reviewed by Pavel Feldman.

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

        Tests: inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting.html
               inspector/profiler/detailed-heapshots-comparison-show-all.html
               inspector/profiler/detailed-heapshots-comparison-show-next.html
               inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting.html
               inspector/profiler/detailed-heapshots-comparison-sorting.html
               inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting.html
               inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting.html
               inspector/profiler/detailed-heapshots-dominators-show-all.html
               inspector/profiler/detailed-heapshots-dominators-show-next.html
               inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting.html
               inspector/profiler/detailed-heapshots-dominators-sorting.html
               inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting.html

        * inspector/front-end/DetailedHeapshotView.js:
        (WebInspector.HeapSnapshotDiffDataGrid):

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

        Reviewed by Pavel Feldman.

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

        * inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting.html: Added.
        * inspector/profiler/detailed-heapshots-comparison-show-all-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-comparison-show-all.html: Added.
        * inspector/profiler/detailed-heapshots-comparison-show-next-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-comparison-show-next.html: Added.
        * inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting.html: Copied from LayoutTests/inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting.html.
        * inspector/profiler/detailed-heapshots-comparison-sorting-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-comparison-sorting.html: Added.
        * inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting.html: Added.
        * inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting.html: Added.
        * inspector/profiler/detailed-heapshots-dominators-show-all-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-dominators-show-all.html: Added.
        * inspector/profiler/detailed-heapshots-dominators-show-next-actual.txt: Added.
        * inspector/profiler/detailed-heapshots-dominators-show-next-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-dominators-show-next.html: Added.
        * inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting.html: Added.
        * inspector/profiler/detailed-heapshots-dominators-sorting-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-dominators-sorting.html: Added.
        * inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting.html:
        * inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting-expected.txt: Added.
        * inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting.html: Copied from LayoutTests/inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting.html.
        * inspector/profiler/detailed-heapshots-test.js:
        (initialize_DetailedHeapshotTest.):
        (initialize_DetailedHeapshotTest):
        * platform/chromium/inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-comparison-show-all-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-comparison-show-next-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-comparison-sorting-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-dominators-show-all-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-dominators-show-next-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-dominators-sorting-expected.txt: Added.
        * platform/chromium/inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83581 268f45cc-cd09-0410-ab3c-d52691b4dbfc

42 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting.html [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-comparison-show-all-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-comparison-show-all.html [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-comparison-show-next-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-comparison-show-next.html [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting.html [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-comparison-sorting-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-comparison-sorting.html [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting.html [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting.html [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-all-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-all.html [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-next-actual.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-next-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-next.html [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting.html [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-dominators-sorting-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-dominators-sorting.html [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting.html
LayoutTests/inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting-expected.txt [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting.html [new file with mode: 0644]
LayoutTests/inspector/profiler/detailed-heapshots-test.js
LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-show-all-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-show-next-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-sorting-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-show-all-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-show-next-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-sorting-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/DetailedHeapshotView.js

index a9368a3..99ecfa6 100644 (file)
@@ -1,3 +1,52 @@
+2011-04-12  Mikhail Naganov  <mnaganov@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: [Chromium] Add some more tests for detailed heap snapshots UI.
+        https://bugs.webkit.org/show_bug.cgi?id=58146
+
+        * inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting-expected.txt: Added.
+        * inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting.html: Added.
+        * inspector/profiler/detailed-heapshots-comparison-show-all-expected.txt: Added.
+        * inspector/profiler/detailed-heapshots-comparison-show-all.html: Added.
+        * inspector/profiler/detailed-heapshots-comparison-show-next-expected.txt: Added.
+        * inspector/profiler/detailed-heapshots-comparison-show-next.html: Added.
+        * inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting-expected.txt: Added.
+        * inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting.html: Copied from LayoutTests/inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting.html.
+        * inspector/profiler/detailed-heapshots-comparison-sorting-expected.txt: Added.
+        * inspector/profiler/detailed-heapshots-comparison-sorting.html: Added.
+        * inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting-expected.txt: Added.
+        * inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting.html: Added.
+        * inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting-expected.txt: Added.
+        * inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting.html: Added.
+        * inspector/profiler/detailed-heapshots-dominators-show-all-expected.txt: Added.
+        * inspector/profiler/detailed-heapshots-dominators-show-all.html: Added.
+        * inspector/profiler/detailed-heapshots-dominators-show-next-actual.txt: Added.
+        * inspector/profiler/detailed-heapshots-dominators-show-next-expected.txt: Added.
+        * inspector/profiler/detailed-heapshots-dominators-show-next.html: Added.
+        * inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting-expected.txt: Added.
+        * inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting.html: Added.
+        * inspector/profiler/detailed-heapshots-dominators-sorting-expected.txt: Added.
+        * inspector/profiler/detailed-heapshots-dominators-sorting.html: Added.
+        * inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting.html:
+        * inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting-expected.txt: Added.
+        * inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting.html: Copied from LayoutTests/inspector/profiler/detailed-heapshots-summary-expansion-preserved-when-sorting.html.
+        * inspector/profiler/detailed-heapshots-test.js:
+        (initialize_DetailedHeapshotTest.):
+        (initialize_DetailedHeapshotTest):
+        * platform/chromium/inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting-expected.txt: Added.
+        * platform/chromium/inspector/profiler/detailed-heapshots-comparison-show-all-expected.txt: Added.
+        * platform/chromium/inspector/profiler/detailed-heapshots-comparison-show-next-expected.txt: Added.
+        * platform/chromium/inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting-expected.txt: Added.
+        * platform/chromium/inspector/profiler/detailed-heapshots-comparison-sorting-expected.txt: Added.
+        * platform/chromium/inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting-expected.txt: Added.
+        * platform/chromium/inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting-expected.txt: Added.
+        * platform/chromium/inspector/profiler/detailed-heapshots-dominators-show-all-expected.txt: Added.
+        * platform/chromium/inspector/profiler/detailed-heapshots-dominators-show-next-expected.txt: Added.
+        * platform/chromium/inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting-expected.txt: Added.
+        * platform/chromium/inspector/profiler/detailed-heapshots-dominators-sorting-expected.txt: Added.
+        * platform/chromium/inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting-expected.txt: Added.
+
 2011-04-12  Ilya Tikhonovsky  <loislo@chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting-expected.txt b/LayoutTests/inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting-expected.txt
new file mode 100644 (file)
index 0000000..27e2076
--- /dev/null
@@ -0,0 +1,4 @@
+Tests Comparison view of detailed heap snapshots. Expanded nodes must be preserved after sorting.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting.html b/LayoutTests/inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting.html
new file mode 100644 (file)
index 0000000..fc66daf
--- /dev/null
@@ -0,0 +1,132 @@
+<html>
+<head>
+  <script src="../../http/tests/inspector/inspector-test.js"></script>
+  <script src="detailed-heapshots-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.runDetailedHeapshotTestSuite([
+        function testExpansionPreservedWhenSorting(next)
+        {
+            InspectorTest.takeAndOpenSnapshot(createHeapSnapshotA, createSnapshotB);
+            function createSnapshotB() {
+                InspectorTest.takeAndOpenSnapshot(createHeapSnapshotB, step1);
+            }
+
+            function step1()
+            {
+                InspectorTest.switchToView("Comparison", 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);
+                }
+            }
+
+            function step3()
+            {
+                var row = InspectorTest.findRow("object", "B");
+                InspectorTest.assertEquals(true, !!row, "\"B\" row");
+                var buttonsNode = InspectorTest.findButtonsNode(row);
+                InspectorTest.assertEquals(true, !!buttonsNode, "no buttons node found!");
+                InspectorTest.clickShowMoreButton("showAll", buttonsNode, step4);
+            }
+
+            var columns;
+            function step4()
+            {
+                columns = InspectorTest.viewColumns();
+                InspectorTest.clickColumn(columns[0], step5);
+            }
+
+            function step5()
+            {
+                var row = InspectorTest.findRow("object", "B");
+                InspectorTest.assertEquals(true, !!row, "\"B\" row");
+                var 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, step6);
+                }
+            }
+
+            function step6()
+            {
+                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");
+                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, step7);
+                }
+            }
+
+            var columnContents;
+            function step7()
+            {
+                columnContents = InspectorTest.columnContents(columns[0]);
+                InspectorTest.clickColumn(columns[0], clickTwice);
+                function clickTwice()
+                {
+                    InspectorTest.clickColumn(columns[0], step8);
+                }
+            }
+
+            function step8()
+            {
+                var newColumnContents = InspectorTest.columnContents(columns[0]);
+                InspectorTest.assertColumnContentsEqual(columnContents, newColumnContents);
+                setTimeout(next, 0);
+            }
+        }
+    ]);
+}
+
+</script>
+</head>
+<body onload="runTest()">
+<p>
+Tests Comparison view of detailed heap snapshots.
+Expanded nodes must be preserved after sorting.
+</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-comparison-show-all-expected.txt b/LayoutTests/inspector/profiler/detailed-heapshots-comparison-show-all-expected.txt
new file mode 100644 (file)
index 0000000..daddfc5
--- /dev/null
@@ -0,0 +1,4 @@
+Tests Comparison view of detailed heap snapshots. The "Show All" button must show all nodes.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-comparison-show-all.html b/LayoutTests/inspector/profiler/detailed-heapshots-comparison-show-all.html
new file mode 100644 (file)
index 0000000..d74f12a
--- /dev/null
@@ -0,0 +1,94 @@
+<html>
+<head>
+  <script src="../../http/tests/inspector/inspector-test.js"></script>
+  <script src="detailed-heapshots-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.runDetailedHeapshotTestSuite([
+        function testShowAll(next)
+        {
+            InspectorTest.takeAndOpenSnapshot(createHeapSnapshotA, createSnapshotB);
+            function createSnapshotB() {
+                InspectorTest.takeAndOpenSnapshot(createHeapSnapshotB, step1);
+            }
+
+            function step1()
+            {
+                InspectorTest.switchToView("Comparison", step2);
+            }
+
+            function step2()
+            {
+                var row = InspectorTest.findRow("object", "A");
+                InspectorTest.assertEquals(true, !!row, "\"A\" row");
+                InspectorTest.expandRow(row, step3);
+            }
+
+            var countA;
+            function step3(row)
+            {
+                countA = row.data["addedCount"];
+                InspectorTest.assertEquals(true, countA > 0, "countA > 0");
+                var buttonsNode = InspectorTest.findButtonsNode(row);
+                InspectorTest.assertEquals(true, !!buttonsNode, "buttons node (added)");
+                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(countA, maybeNumber, buttonsNode.showAll.textContent);
+                }
+                InspectorTest.clickShowMoreButton("showAll", buttonsNode, step4);
+            }
+
+            var countB;
+            function step4(row)
+            {
+                var rowsShown = InspectorTest.countDataRows(row, function(node) { return node.data.addedCount; });
+                InspectorTest.assertEquals(countA, rowsShown, "after showAll click 1");
+
+                countB = row.data["removedCount"];
+                InspectorTest.assertEquals(true, countB > 0, "countB > 0");
+                var buttonsNode = InspectorTest.findButtonsNode(row);
+                InspectorTest.assertEquals(true, !!buttonsNode, "buttons node (deleted)");
+                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(countB, maybeNumber, buttonsNode.showAll.textContent);
+                }
+                InspectorTest.clickShowMoreButton("showAll", buttonsNode, step5);
+            }
+
+            function step5(row)
+            {
+                var rowsShown = InspectorTest.countDataRows(row, function(node) { return node.data.removedCount; });
+                InspectorTest.assertEquals(countB, rowsShown, "after showAll click 2");
+                var buttonsNode = InspectorTest.findButtonsNode(row);
+                InspectorTest.assertEquals(false, !!buttonsNode, "buttons node found after all rows shown");
+                setTimeout(next, 0);
+            }
+        }
+    ]);
+}
+
+</script>
+</head>
+<body onload="runTest()">
+<p>
+Tests Comparison view of detailed heap snapshots.
+The &quot;Show All&quot; button must show all nodes.
+</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-comparison-show-next-expected.txt b/LayoutTests/inspector/profiler/detailed-heapshots-comparison-show-next-expected.txt
new file mode 100644 (file)
index 0000000..f57e1ab
--- /dev/null
@@ -0,0 +1,4 @@
+Tests Comparison view of detailed heap snapshots. Repeated clicks on "Show Next" button must show all nodes.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-comparison-show-next.html b/LayoutTests/inspector/profiler/detailed-heapshots-comparison-show-next.html
new file mode 100644 (file)
index 0000000..21a395a
--- /dev/null
@@ -0,0 +1,79 @@
+<html>
+<head>
+  <script src="../../http/tests/inspector/inspector-test.js"></script>
+  <script src="detailed-heapshots-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.runDetailedHeapshotTestSuite([
+        function testShowNext(next)
+        {
+            InspectorTest.takeAndOpenSnapshot(createHeapSnapshotA, createSnapshotB);
+            function createSnapshotB() {
+                InspectorTest.takeAndOpenSnapshot(createHeapSnapshotB, step1);
+            }
+
+            function step1()
+            {
+                InspectorTest.switchToView("Comparison", step2);
+            }
+
+            function step2()
+            {
+                var row = InspectorTest.findRow("object", "A");
+                InspectorTest.assertEquals(true, !!row, "\"A\" row");
+                InspectorTest.expandRow(row, step3);
+            }
+
+            function step3(row)
+            {
+                var expectedRowCountA = row.data["addedCount"];
+                var rowsShown = InspectorTest.countDataRows(row, function(node) { return node.data.addedCount; });
+                InspectorTest.assertEquals(true, rowsShown <= expectedRowCountA, "shown more instances than created: " + rowsShown + " > " + expectedRowCountA);
+                if (rowsShown < expectedRowCountA) {
+                    var buttonsNode = InspectorTest.findButtonsNode(row);
+                    InspectorTest.assertEquals(true, !!buttonsNode, "buttons node");
+                    InspectorTest.clickShowMoreButton("showNext", buttonsNode, step3);
+                } else if (rowsShown === expectedRowCountA)
+                    setTimeout(step4.bind(null, row), 0);
+            }
+
+            function step4(row)
+            {
+                var expectedRowCountB = row.data["removedCount"];
+                var rowsShown = InspectorTest.countDataRows(row, function(node) { return node.data.removedCount; });
+                InspectorTest.assertEquals(true, rowsShown <= expectedRowCountB, "shown more instances than created: " + rowsShown + " > " + expectedRowCountB);
+                if (rowsShown < expectedRowCountB) {
+                    var buttonsNode = InspectorTest.findButtonsNode(row);
+                    InspectorTest.assertEquals(true, !!buttonsNode, "buttons node");
+                    InspectorTest.clickShowMoreButton("showNext", buttonsNode, step4);
+                } else if (rowsShown === expectedRowCountB) {
+                    var buttonsNode = InspectorTest.findButtonsNode(row);
+                    InspectorTest.assertEquals(false, !!buttonsNode, "buttons node found after all rows shown");
+                    setTimeout(next, 0);
+                }
+            }
+        }
+    ]);
+}
+
+</script>
+</head>
+<body onload="runTest()">
+<p>
+Tests Comparison view of detailed heap snapshots.
+Repeated clicks on &quot;Show Next&quot; button must show all nodes.
+</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting-expected.txt b/LayoutTests/inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting-expected.txt
new file mode 100644 (file)
index 0000000..7790976
--- /dev/null
@@ -0,0 +1,4 @@
+Tests Comparison view of detailed heap snapshots. Shown node count must be preserved after sorting.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting.html b/LayoutTests/inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting.html
new file mode 100644 (file)
index 0000000..f7f0727
--- /dev/null
@@ -0,0 +1,98 @@
+<html>
+<head>
+  <script src="../../http/tests/inspector/inspector-test.js"></script>
+  <script src="detailed-heapshots-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.runDetailedHeapshotTestSuite([
+        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("showNext", 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(true, !!buttonsNode, "no buttons node found!");
+                InspectorTest.clickShowMoreButton("showNext", buttonsNode, step5);
+            }
+
+            var nodeCount;
+            function step5(row)
+            {
+                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>
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-comparison-sorting-expected.txt b/LayoutTests/inspector/profiler/detailed-heapshots-comparison-sorting-expected.txt
new file mode 100644 (file)
index 0000000..536d654
--- /dev/null
@@ -0,0 +1,4 @@
+Tests sorting in Comparison view of detailed heap snapshots.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-comparison-sorting.html b/LayoutTests/inspector/profiler/detailed-heapshots-comparison-sorting.html
new file mode 100644 (file)
index 0000000..1fcba74
--- /dev/null
@@ -0,0 +1,84 @@
+<html>
+<head>
+  <script src="../../http/tests/inspector/inspector-test.js"></script>
+  <script src="detailed-heapshots-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.runDetailedHeapshotTestSuite([
+        function testSorting(next)
+        {
+            InspectorTest.takeAndOpenSnapshot(createHeapSnapshotA, createSnapshotB);
+            function createSnapshotB() {
+                InspectorTest.takeAndOpenSnapshot(createHeapSnapshotB, step1);
+            }
+            
+            function step1()
+            {
+                InspectorTest.switchToView("Comparison", next);
+            }
+
+            var columns;
+            var currentColumn;
+            var currentColumnOrder;
+
+            function step2()
+            {
+                columns = InspectorTest.viewColumns();
+                currentColumn = 0;
+                currentColumnOrder = false;
+                setTimeout(step3, 0);
+            }
+
+            function step3()
+            {
+                if (currentColumn >= columns.length) {
+                    setTimeout(next, 0);
+                    return;
+                }
+
+                InspectorTest.clickColumn(columns[currentColumn], step4);
+            }
+
+            function step4(newColumnState)
+            {
+                columns[currentColumn] = newColumnState;
+                var contents = InspectorTest.columnContents(columns[currentColumn]);
+                InspectorTest.assertEquals(true, !!contents.length, "column contents");
+                var sortTypes = { object: "text",
+                                  addedCount: "number", removedCount: "number", countDelta: "number",
+                                  addedSize: "size", removedSize: "size", sizeDelta: "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(step3, 0);
+            }
+        }
+    ]);
+}
+
+</script>
+</head>
+<body onload="runTest()">
+<p>
+Tests sorting in Comparison view of detailed heap snapshots.
+</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting-expected.txt b/LayoutTests/inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting-expected.txt
new file mode 100644 (file)
index 0000000..9280898
--- /dev/null
@@ -0,0 +1,4 @@
+Tests Containment view of detailed heap snapshots. Shown node count must be preserved after sorting.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting.html b/LayoutTests/inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting.html
new file mode 100644 (file)
index 0000000..21e7579
--- /dev/null
@@ -0,0 +1,79 @@
+<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 testShownNodeCountPreservedWhenSorting(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("showNext", buttonsNode, step5);
+            }
+
+            var nodeCount;
+            function step5(row)
+            {
+                // There must be enough nodes to have some unrevealed.
+                var buttonsNode = InspectorTest.findButtonsNode(row);
+                InspectorTest.assertEquals(true, !!buttonsNode, "no buttons node found!");
+
+                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 Containment view of detailed heap snapshots.
+Shown node count must be preserved after sorting.
+</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting-expected.txt b/LayoutTests/inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting-expected.txt
new file mode 100644 (file)
index 0000000..ed434f5
--- /dev/null
@@ -0,0 +1,4 @@
+Tests Dominators view of detailed heap snapshots. Expanded nodes must be preserved after sorting.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting.html b/LayoutTests/inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting.html
new file mode 100644 (file)
index 0000000..3c126c8
--- /dev/null
@@ -0,0 +1,80 @@
+<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("Dominators", 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, 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 Dominators view of detailed heap snapshots.
+Expanded nodes must be preserved after sorting.
+</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-all-expected.txt b/LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-all-expected.txt
new file mode 100644 (file)
index 0000000..966f1bb
--- /dev/null
@@ -0,0 +1,4 @@
+Tests Dominators view of detailed heap snapshots. The "Show All" button must show all nodes.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-all.html b/LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-all.html
new file mode 100644 (file)
index 0000000..00e7137
--- /dev/null
@@ -0,0 +1,63 @@
+<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("Dominators", 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 Dominators view of detailed heap snapshots.
+The &quot;Show All&quot; button must show all nodes.
+</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-next-actual.txt b/LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-next-actual.txt
new file mode 100644 (file)
index 0000000..f57e1ab
--- /dev/null
@@ -0,0 +1,4 @@
+Tests Comparison view of detailed heap snapshots. Repeated clicks on "Show Next" button must show all nodes.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-next-expected.txt b/LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-next-expected.txt
new file mode 100644 (file)
index 0000000..ad021ca
--- /dev/null
@@ -0,0 +1,4 @@
+Tests Dominators view of detailed heap snapshots. Repeated clicks on "Show Next" button must show all nodes.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-next.html b/LayoutTests/inspector/profiler/detailed-heapshots-dominators-show-next.html
new file mode 100644 (file)
index 0000000..25059fb
--- /dev/null
@@ -0,0 +1,56 @@
+<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("Dominators", 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 Dominators view of detailed heap snapshots.
+Repeated clicks on &quot;Show Next&quot; button must show all nodes.
+</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting-expected.txt b/LayoutTests/inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting-expected.txt
new file mode 100644 (file)
index 0000000..e52a356
--- /dev/null
@@ -0,0 +1,4 @@
+Tests Dominators view of detailed heap snapshots. Shown node count must be preserved after sorting.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting.html b/LayoutTests/inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting.html
new file mode 100644 (file)
index 0000000..9d787cc
--- /dev/null
@@ -0,0 +1,79 @@
+<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 testShownNodeCountPreservedWhenSorting(next)
+        {
+            InspectorTest.takeAndOpenSnapshot(createHeapSnapshot, step1);
+
+            function step1()
+            {
+                InspectorTest.switchToView("Dominators", 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("showNext", buttonsNode, step5);
+            }
+
+            var nodeCount;
+            function step5(row)
+            {
+                // There must be enough nodes to have some unrevealed.
+                var buttonsNode = InspectorTest.findButtonsNode(row);
+                InspectorTest.assertEquals(true, !!buttonsNode, "no buttons node found!");
+
+                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 Dominators view of detailed heap snapshots.
+Shown node count must be preserved after sorting.
+</p>
+</body>
+</html>
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-dominators-sorting-expected.txt b/LayoutTests/inspector/profiler/detailed-heapshots-dominators-sorting-expected.txt
new file mode 100644 (file)
index 0000000..3450872
--- /dev/null
@@ -0,0 +1,4 @@
+Tests sorting in Dominators view of detailed heap snapshots.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-dominators-sorting.html b/LayoutTests/inspector/profiler/detailed-heapshots-dominators-sorting.html
new file mode 100644 (file)
index 0000000..5908c79
--- /dev/null
@@ -0,0 +1,82 @@
+<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("Dominators", 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: "id", 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 Dominators view of detailed heap snapshots.
+</p>
+</body>
+</html>
index 43a8f5e..0bc0c3b 100644 (file)
@@ -46,7 +46,7 @@ function test()
             {
                 var row = InspectorTest.findRow("object", "B");
                 InspectorTest.assertEquals(true, !!row, "\"B\" row");
-                bInstanceRow = row.children[0];
+                var bInstanceRow = row.children[0];
                 InspectorTest.assertEquals(true, !!bInstanceRow, "\"B\" instance row");
                 InspectorTest.expandRow(bInstanceRow, expandA);
                 function expandA(row)
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting-expected.txt b/LayoutTests/inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting-expected.txt
new file mode 100644 (file)
index 0000000..62f0a5f
--- /dev/null
@@ -0,0 +1,4 @@
+Tests Summary view of detailed heap snapshots. Shown node count must be preserved after sorting.
+
+Heap profiler is disabled
+
diff --git a/LayoutTests/inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting.html b/LayoutTests/inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting.html
new file mode 100644 (file)
index 0000000..a93505f
--- /dev/null
@@ -0,0 +1,80 @@
+<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);
+            }
+
+            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("showNext", buttonsNode, step4);
+                }
+            }
+
+            var nodeCount;
+            function step4(row)
+            {
+                // There must be enough nodes to have some unrevealed.
+                var buttonsNode = InspectorTest.findButtonsNode(row);
+                InspectorTest.assertEquals(true, !!buttonsNode, "no buttons node found!");
+
+                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 Summary view of detailed heap snapshots.
+Shown node count must be preserved after sorting.
+</p>
+</body>
+</html>
index 35ee0ae..20c459b 100644 (file)
@@ -68,6 +68,7 @@ InspectorTest.runDetailedHeapshotTestSuite = function(testSuite)
         return;
     }
 
+    InspectorTest._nextUid = 1;
     var testSuiteTests = testSuite.slice();
 
     function runner()
@@ -122,11 +123,22 @@ InspectorTest.checkArrayIsSorted = function(contents, sortType, sortOrder)
             InspectorTest.addResult("No name field in " + JSON.stringify(data));
         return parseInt(data.name, 10);
     }
+    function extractId(data)
+    {
+        data = JSON.parse(data);
+        if (!data.value)
+            InspectorTest.addResult("No value field in " + JSON.stringify(data));
+        var indexOfAt = data.value.indexOf("@");
+        if (indexOfAt === -1)
+            InspectorTest.addResult("Can't find @ in " + data.value);
+        return parseInt(data.value.substring(indexOfAt + 1), 10);
+    }
     var comparator = {
         text: simpleComparator,
         number: function (a, b) { return simpleComparator(parseInt(a, 10), parseInt(b, 10)); },
         size: function (a, b) { return simpleComparator(parseSize(a), parseSize(b)); },
-        name: function (a, b) { return simpleComparator(extractName(a), extractName(b)); }
+        name: function (a, b) { return simpleComparator(extractName(a), extractName(b)); },
+        id: function (a, b) { return simpleComparator(extractId(a), extractId(b)); }
     }[sortType];
     var acceptableComparisonResult = {
         ascending: -1,
@@ -202,17 +214,18 @@ InspectorTest.columnContents = function(column, row)
     return result;
 };
 
-InspectorTest.countDataRows = function(row)
+InspectorTest.countDataRows = function(row, filter)
 {
     var result = 0;
+    filter = filter || function(node) { return node.selectable; };
     for (var node = row.children[0]; node; node = node.traverseNextNode(true, row, true)) {
-        if (node.selectable)
+        if (filter(node))
             ++result;
     }
     return result;
 };
 
-InspectorTest.createHeapSnapshot = function(instanceCount)
+InspectorTest.createHeapSnapshot = function(instanceCount, firstId)
 {
     // Mocking results of running the following code:
     // 
@@ -231,7 +244,7 @@ InspectorTest.createHeapSnapshot = function(instanceCount)
         nodes.push(0, 0, 1, 0, (sizeOfA + sizeOfB) * instanceCount, 1, 1, 4, 1, null);
         // Push instances of A and B.
         var indexesOfB = [];
-        var nextId = 5;
+        var nextId = firstId || 5;
         for (var i = 0; i < instanceCount; ++i) {
             var indexOfA = nodes.length;
             nodes.push(3, 1, nextId++, sizeOfA, sizeOfA, null, 1, 2, 3, indexOfA);
@@ -297,10 +310,10 @@ InspectorTest.findAndExpandGCRoots = function(callback)
     InspectorTest.expandRow(gcRoots, callback);
 }
 
-InspectorTest.findButtonsNode = function(row)
+InspectorTest.findButtonsNode = function(row, startNode)
 {
     var result = 0;
-    for (var node = row.children[0]; node; node = node.traverseNextNode(true, row, true)) {
+    for (var node = startNode || row.children[0]; node; node = node.traverseNextNode(true, row, true)) {
         if (!node.selectable && node.showNext)
             return node;
     }
@@ -321,6 +334,16 @@ InspectorTest.findRow = function(columnIdentifier, matcher, parent)
     return null;
 };
 
+InspectorTest.findRow2 = function(matcher, parent)
+{
+    parent = parent || this._currentGrid();
+    for (var node = parent.children[0]; node; node = node.traverseNextNode(true, parent, true)) {
+        if (matcher(node.data))
+            return node;
+    }
+    return null;
+};
+
 InspectorTest.switchToView = function(title, callback)
 {
     callback = InspectorTest.safeWrap(callback);
@@ -348,7 +371,7 @@ InspectorTest.switchToView = function(title, callback)
 InspectorTest.takeAndOpenSnapshot = function(generator, callback)
 {
     callback = InspectorTest.safeWrap(callback);
-    var uid = 1;
+    var uid = InspectorTest._nextUid++;
     var profile = { typeId: WebInspector.HeapSnapshotProfileType.TypeId, uid: uid, title: UserInitiatedProfileName + "." + uid };
     function pushGeneratedSnapshot(typeId, uid)
     {
diff --git a/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting-expected.txt b/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting-expected.txt
new file mode 100644 (file)
index 0000000..520fd50
--- /dev/null
@@ -0,0 +1,9 @@
+Tests Comparison view of detailed heap snapshots. Expanded nodes must be preserved after sorting.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testExpansionPreservedWhenSorting
+
+Profiler was disabled.
+
diff --git a/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-show-all-expected.txt b/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-show-all-expected.txt
new file mode 100644 (file)
index 0000000..1d250ff
--- /dev/null
@@ -0,0 +1,9 @@
+Tests Comparison view of detailed heap snapshots. The "Show All" button must show all nodes.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testShowAll
+
+Profiler was disabled.
+
diff --git a/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-show-next-expected.txt b/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-show-next-expected.txt
new file mode 100644 (file)
index 0000000..f8d1243
--- /dev/null
@@ -0,0 +1,9 @@
+Tests Comparison view of detailed heap snapshots. Repeated clicks on "Show Next" button must show all nodes.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testShowNext
+
+Profiler was disabled.
+
diff --git a/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting-expected.txt b/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting-expected.txt
new file mode 100644 (file)
index 0000000..ee778ff
--- /dev/null
@@ -0,0 +1,9 @@
+Tests Comparison view of detailed heap snapshots. Shown node count must be preserved after sorting.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testExpansionPreservedWhenSorting
+
+Profiler was disabled.
+
diff --git a/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-sorting-expected.txt b/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-comparison-sorting-expected.txt
new file mode 100644 (file)
index 0000000..b1e2be9
--- /dev/null
@@ -0,0 +1,9 @@
+Tests sorting in Comparison view of detailed heap snapshots.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testSorting
+
+Profiler was disabled.
+
diff --git a/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting-expected.txt b/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting-expected.txt
new file mode 100644 (file)
index 0000000..8d187ff
--- /dev/null
@@ -0,0 +1,9 @@
+Tests Containment view of detailed heap snapshots. Shown node count must be preserved after sorting.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testShownNodeCountPreservedWhenSorting
+
+Profiler was disabled.
+
diff --git a/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting-expected.txt b/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting-expected.txt
new file mode 100644 (file)
index 0000000..071d346
--- /dev/null
@@ -0,0 +1,9 @@
+Tests Dominators view of detailed heap snapshots. Expanded nodes must be preserved after sorting.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testExpansionPreservedWhenSorting
+
+Profiler was disabled.
+
diff --git a/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-show-all-expected.txt b/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-show-all-expected.txt
new file mode 100644 (file)
index 0000000..07f8c18
--- /dev/null
@@ -0,0 +1,9 @@
+Tests Dominators view of detailed heap snapshots. The "Show All" button must show all nodes.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testShowAll
+
+Profiler was disabled.
+
diff --git a/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-show-next-expected.txt b/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-show-next-expected.txt
new file mode 100644 (file)
index 0000000..aa556a8
--- /dev/null
@@ -0,0 +1,9 @@
+Tests Dominators view of detailed heap snapshots. Repeated clicks on "Show Next" button must show all nodes.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testShowNext
+
+Profiler was disabled.
+
diff --git a/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting-expected.txt b/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting-expected.txt
new file mode 100644 (file)
index 0000000..48b69d1
--- /dev/null
@@ -0,0 +1,9 @@
+Tests Dominators view of detailed heap snapshots. Shown node count must be preserved after sorting.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testShownNodeCountPreservedWhenSorting
+
+Profiler was disabled.
+
diff --git a/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-sorting-expected.txt b/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-dominators-sorting-expected.txt
new file mode 100644 (file)
index 0000000..c82d624
--- /dev/null
@@ -0,0 +1,9 @@
+Tests sorting in Dominators view of detailed heap snapshots.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testSorting
+
+Profiler was disabled.
+
diff --git a/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting-expected.txt b/LayoutTests/platform/chromium/inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting-expected.txt
new file mode 100644 (file)
index 0000000..2af8c7c
--- /dev/null
@@ -0,0 +1,9 @@
+Tests Summary view of detailed heap snapshots. Shown node count must be preserved after sorting.
+
+Profiler was enabled.
+Detailed heap profiles were enabled.
+
+Running: testExpansionPreservedWhenSorting
+
+Profiler was disabled.
+
index 499df67..99f29f1 100644 (file)
@@ -1,3 +1,26 @@
+2011-04-12  Mikhail Naganov  <mnaganov@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: [Chromium] Add some more tests for detailed heap snapshots UI.
+        https://bugs.webkit.org/show_bug.cgi?id=58146
+
+        Tests: inspector/profiler/detailed-heapshots-comparison-expansion-preserved-when-sorting.html
+               inspector/profiler/detailed-heapshots-comparison-show-all.html
+               inspector/profiler/detailed-heapshots-comparison-show-next.html
+               inspector/profiler/detailed-heapshots-comparison-shown-node-count-preserved-when-sorting.html
+               inspector/profiler/detailed-heapshots-comparison-sorting.html
+               inspector/profiler/detailed-heapshots-containment-shown-node-count-preserved-when-sorting.html
+               inspector/profiler/detailed-heapshots-dominators-expansion-preserved-when-sorting.html
+               inspector/profiler/detailed-heapshots-dominators-show-all.html
+               inspector/profiler/detailed-heapshots-dominators-show-next.html
+               inspector/profiler/detailed-heapshots-dominators-shown-node-count-preserved-when-sorting.html
+               inspector/profiler/detailed-heapshots-dominators-sorting.html
+               inspector/profiler/detailed-heapshots-summary-shown-node-count-preserved-when-sorting.html
+
+        * inspector/front-end/DetailedHeapshotView.js:
+        (WebInspector.HeapSnapshotDiffDataGrid):
+
 2011-04-12  Ilya Tikhonovsky  <loislo@chromium.org>
 
         Reviewed by Yury Semikhatsky.
index a6b1670..a21bf75 100644 (file)
@@ -151,7 +151,6 @@ WebInspector.HeapSnapshotDiffDataGrid = function()
 {
     var columns = {
         object: { title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true },
-        // \xb1 is a "plus-minus" sign.
         addedCount: { title: WebInspector.UIString("# New"), width: "72px", sortable: true, sort: "descending" },
         removedCount: { title: WebInspector.UIString("# Deleted"), width: "72px", sortable: true },
         // \u0394 is a Greek delta letter.