Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom.html

Issue 2179123004: DevTools: fix stick to bottom in console viewport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Best attempt at tests Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom.html
diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom.html b/third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom.html
index fc4901ad831a1b0bd2c44a4d50a6d739d97232a8..a06228eebe40b045814310547c87e249f01b9143 100644
--- a/third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom.html
+++ b/third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom.html
@@ -14,6 +14,7 @@ function populateConsoleWithMessages(count)
</script>
<script>
+// window.debugTest = true
function test()
{
@@ -56,27 +57,65 @@ function test()
function onMessagesDumped()
{
+ // Force a second call to refresh() after a first call within
+ // invalidate() triggers a scroll to bottom event.
viewport.invalidate();
- // Force refresh which has been scheduled via invalidate() method.
viewport.refresh();
- InspectorTest.addResult("Last visible message: " + viewport.lastVisibleIndex());
+
+ logIsAtBottom();
next();
}
},
- function testManualScrollDoesNotStickToBottom(next)
- {
- const manualScrollValue = 3;
- var initialScrollTop = viewport.element.scrollTop;
- viewport.element.scrollTop = initialScrollTop - manualScrollValue;
- viewport.refresh();
- var newScrollTop = viewport.element.scrollTop;
- var isScrollPreserved = initialScrollTop - newScrollTop === manualScrollValue;
- InspectorTest.addResult("Scroll preserved: " + isScrollPreserved);
- next();
- },
+ // function testEscShouldNotJumpToBottom(next)
+ // {
+ // eventSender.keyDown('Escape');
+ // InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_scrollUpdatedByUserForTest", function () {
+ // logIsAtBottom();
+ // next();
+ // });
+ // },
+
+ // function testTypingShouldJumpToBottom(next)
+ // {
+ // eventSender.keyDown('a');
+ // InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_scrollUpdatedByUserForTest", function () {
+ // logIsAtBottom();
+ // next();
+ // });
+ // },
+
+ // function testSmoothScrollDoesNotStickToBottom(next)
+ // {
+ // eventSender.keyDown('PageUp');
+ // InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_scrollUpdatedByUserForTest", function () {
+ // logIsAtBottom();
+ // next();
+ // });
+ // },
+
+ function testViewportMuationsShouldPreserveStickToBottom(next) {
+ InspectorTest.addSniffer(WebInspector.ViewportControl.prototype, "refresh", onRefresh);
+ viewport._contentElement.children[1].innerText = "foo\n\n\n\nbar";
+
+ function onRefresh()
+ {
+ logIsAtBottom();
+ next();
+ }
+ }
];
+ function logIsAtBottom(distance)
+ {
+ var dist = viewport.element.scrollHeight - (viewport.element.scrollTop + viewport.element.clientHeight);
+ if (distance)
+ InspectorTest.addResult("Distance from bottom: " + dist);
+ else
+ InspectorTest.addResult("Is at bottom: " + viewport.element.isScrolledToBottom() + ", should stick: " + viewport.stickToBottom());
+ }
+
+
function logMessagesToConsole(count, callback)
{
var awaitingMessagesCount = count;

Powered by Google App Engine
This is Rietveld 408576698