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

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

Issue 2256873002: Revert of DevTools: fix stick to bottom in console viewport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
{
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/console/console-viewport-stick-to-bottom-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698