| 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 2d7a9f52cbe51534aa0c1ffc6ca005de7db5c21e..fc4901ad831a1b0bd2c44a4d50a6d739d97232a8 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
|
| @@ -17,8 +17,7 @@
|
|
|
| function test()
|
| {
|
| - var viewportHeight = 200;
|
| - InspectorTest.fixConsoleViewportDimensions(600, viewportHeight);
|
| + InspectorTest.fixConsoleViewportDimensions(600, 200);
|
| var consoleView = WebInspector.ConsoleView.instance();
|
| var viewport = consoleView._viewport;
|
| const minimumViewportMessagesCount = 10;
|
| @@ -46,7 +45,9 @@
|
| function testScrollViewportToBottom(next)
|
| {
|
| consoleView._immediatelyScrollToBottom();
|
| - dumpAndContinue(next);
|
| + viewport.refresh();
|
| + InspectorTest.addResult("Last visible message: " + viewport.lastVisibleIndex());
|
| + next();
|
| },
|
|
|
| function testConsoleSticksToBottom(next)
|
| @@ -55,113 +56,26 @@
|
|
|
| function onMessagesDumped()
|
| {
|
| - dumpAndContinue(next);
|
| - }
|
| - },
|
| -
|
| - function testSmoothScrollDoesNotStickToBottom(next)
|
| - {
|
| - InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_updateViewportStickinessForTest", onUpdateTimeout);
|
| - sendPageUp();
|
| -
|
| - function onUpdateTimeout()
|
| - {
|
| - dumpAndContinue(next);
|
| - }
|
| - },
|
| -
|
| - function testEscShouldNotJumpToBottom(next)
|
| - {
|
| - var keyEvent = InspectorTest.createKeyEvent("Escape");
|
| - viewport._contentElement.dispatchEvent(keyEvent);
|
| - dumpAndContinue(next);
|
| - },
|
| -
|
| - function testTypingShouldJumpToBottom(next)
|
| - {
|
| - var keyEvent = InspectorTest.createKeyEvent("a");
|
| - viewport._contentElement.dispatchEvent(keyEvent);
|
| - consoleView._prompt._proxyElement.dispatchEvent(new Event('input'));
|
| -
|
| - dumpAndContinue(next);
|
| - },
|
| -
|
| - function testViewportMutationsShouldPreserveStickToBottom(next)
|
| - {
|
| - viewport._contentElement.children[1].innerText = "More than 2 lines: foo\n\nbar";
|
| - dumpAndContinue(onMessagesDumped);
|
| -
|
| - function onMessagesDumped()
|
| - {
|
| - viewport.setStickToBottom(false);
|
| - viewport._contentElement.children[1].innerText = "More than 3 lines: foo\n\n\nbar";
|
| - dumpAndContinue(next);
|
| - }
|
| - },
|
| -
|
| - function testMuteUpdatesWhileScrolling(next)
|
| - {
|
| - consoleView._updateStickToBottomOnMouseDown();
|
| - viewport.element.scrollTop -= 10;
|
| -
|
| - InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_scheduleViewportRefreshForTest", onMessageAdded);
|
| - InspectorTest.evaluateInConsole("1 + 1");
|
| -
|
| - /**
|
| - * @param {boolean} muted
|
| - */
|
| - function onMessageAdded(muted)
|
| - {
|
| - InspectorTest.addResult("New messages were muted: " + muted);
|
| - InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_scheduleViewportRefreshForTest", onMouseUpScheduledRefresh);
|
| - InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_updateViewportStickinessForTest", onUpdateStickiness);
|
| - consoleView._updateStickToBottomOnMouseUp();
|
| - }
|
| -
|
| - /**
|
| - * @param {boolean} muted
|
| - */
|
| - function onMouseUpScheduledRefresh(muted)
|
| - {
|
| - InspectorTest.addResult("Refresh was scheduled after dirty state");
|
| - }
|
| -
|
| - function onUpdateStickiness()
|
| - {
|
| + viewport.invalidate();
|
| + // Force refresh which has been scheduled via invalidate() method.
|
| + viewport.refresh();
|
| + InspectorTest.addResult("Last visible message: " + viewport.lastVisibleIndex());
|
| next();
|
| }
|
| },
|
|
|
| - function testShouldNotJumpToBottomWhenPromptFillsEntireViewport(next)
|
| + function testManualScrollDoesNotStickToBottom(next)
|
| {
|
| - var text = "Foo";
|
| - for (var i = 0; i < viewportHeight; i++)
|
| - text += "\n";
|
| - consoleView._promptElement.textContent = text;
|
| - WebInspector.ConsoleView.clearConsole();
|
| - viewport.element.scrollTop -= 10;
|
| -
|
| - var keyEvent = InspectorTest.createKeyEvent("a");
|
| - viewport._contentElement.dispatchEvent(keyEvent);
|
| - consoleView._prompt._proxyElement.dispatchEvent(new Event('input'));
|
| -
|
| - dumpAndContinue(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 sendPageUp()
|
| - {
|
| - var keyEvent = InspectorTest.createKeyEvent("PageUp");
|
| - consoleView._prompt._proxyElement.dispatchEvent(keyEvent);
|
| - viewport.element.scrollTop -= 10;
|
| - }
|
| -
|
| - function dumpAndContinue(callback)
|
| - {
|
| - viewport.refresh();
|
| - InspectorTest.addResult("Is at bottom: " + viewport.element.isScrolledToBottom() + ", should stick: " + viewport.stickToBottom());
|
| - callback();
|
| - }
|
|
|
| function logMessagesToConsole(count, callback)
|
| {
|
|
|