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..cb2bac086fb2a4feed3bd450363f19f3de3b9f11 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(); |
| + refreshLogAndContinue(next); |
| }, |
| function testConsoleSticksToBottom(next) |
| @@ -56,27 +54,58 @@ 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(); |
| + refreshLogAndContinue(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, "_updateViewportFromTimeoutForTest", onUpdateTimeout); |
| + sendPageUp(); |
| + |
| + function onUpdateTimeout() { |
| + refreshLogAndContinue(next); |
| + } |
| + }, |
| + |
| + function testEscShouldNotJumpToBottom(next) |
| + { |
| + eventSender.keyDown('Escape'); |
| + refreshLogAndContinue(next); |
| + }, |
| + |
| + function testTypingShouldJumpToBottom(next) |
| + { |
| + eventSender.keyDown('a'); |
| + refreshLogAndContinue(next); |
| }, |
| + |
|
lushnikov
2016/08/02 00:10:48
stray line
luoe
2016/08/02 19:17:15
Done.
|
| + |
| + function testViewportMuationsShouldPreserveStickToBottom(next) |
|
lushnikov
2016/08/02 00:10:47
Muations -> Mutations
luoe
2016/08/02 19:17:15
Done.
|
| + { |
| + viewport._contentElement.children[1].innerText = "More than 2 lines: foo\n\n\n\nbar"; |
| + refreshLogAndContinue(next); |
| + } |
| ]; |
| + function sendPageUp() |
| + { |
| + // To ensure that PageUp scrolls up the viewport, check that the |
| + // autocomplete suggest box (which may have a scrollbar) is not visible |
| + // and clear the prompt text so that PageUp does not just move the |
| + // cursor. |
| + eventSender.keyDown('Tab'); |
|
lushnikov
2016/08/02 00:10:47
let's not use eventSender if possible
luoe
2016/08/02 19:17:15
Done.
|
| + consoleView._promptElement.textContent = ""; |
| + eventSender.keyDown('PageUp'); |
| + } |
| + |
| + function refreshLogAndContinue(callback) |
|
lushnikov
2016/08/02 00:10:47
in multiple tests across inspctor, we call such me
luoe
2016/08/02 19:17:15
Done.
|
| + { |
| + viewport.refresh(); |
| + InspectorTest.addResult("Is at bottom: " + viewport.element.isScrolledToBottom() + ", should stick: " + viewport.stickToBottom()); |
| + callback(); |
| + } |
| + |
| function logMessagesToConsole(count, callback) |
| { |
| var awaitingMessagesCount = count; |