Chromium Code Reviews| 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..e94d6d15c508711c1a6037777d0a0e7e737d111b 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 |
| @@ -45,9 +45,7 @@ function test() |
| function testScrollViewportToBottom(next) |
| { |
| consoleView._immediatelyScrollToBottom(); |
| - viewport.refresh(); |
| - InspectorTest.addResult("Last visible message: " + viewport.lastVisibleIndex()); |
| - next(); |
| + dumpAndContinue(next); |
| }, |
| function testConsoleSticksToBottom(next) |
| @@ -56,27 +54,55 @@ function test() |
| function onMessagesDumped() |
| { |
| - viewport.invalidate(); |
| - // Force refresh which has been scheduled via invalidate() method. |
| - viewport.refresh(); |
| - InspectorTest.addResult("Last visible message: " + viewport.lastVisibleIndex()); |
| - next(); |
| + dumpAndContinue(next); |
| } |
| }, |
| - function testManualScrollDoesNotStickToBottom(next) |
| + function testSmoothScrollDoesNotStickToBottom(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(); |
| + InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_updateViewportStickinessForTest", onUpdateTimeout); |
| + sendPageUp(); |
| + |
| + function onUpdateTimeout() { |
|
dgozman
2016/08/03 21:19:00
style: { on next line
luoe
2016/08/04 23:13:01
Done.
|
| + 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); |
| + dumpAndContinue(next); |
| }, |
| + |
| + function testViewportMutationsShouldPreserveStickToBottom(next) |
| + { |
| + viewport._contentElement.children[1].innerText = "More than 2 lines: foo\n\n\n\nbar"; |
|
dgozman
2016/08/03 21:19:00
Does this really make it multiline? Maybe use br i
luoe
2016/08/04 23:13:01
Yes, it does make it multiline, the '\n' is auto-r
|
| + dumpAndContinue(next); |
| + } |
| ]; |
| + function sendPageUp() |
| + { |
| + var keyEvent = InspectorTest.createKeyEvent("PageUp"); |
| + viewport._contentElement.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) |
| { |
| var awaitingMessagesCount = count; |