| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/console-test.js"></script> | 4 <script src="../../http/tests/inspector/console-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 function populateConsoleWithMessages(count) | 6 function populateConsoleWithMessages(count) |
| 7 { | 7 { |
| 8 for (var i = 0; i < count - 1; ++i) | 8 for (var i = 0; i < count - 1; ++i) |
| 9 console.log("Multiline\nMessage #" + i); | 9 console.log("Multiline\nMessage #" + i); |
| 10 console.log("hello %cworld", "color: blue"); | 10 console.log("hello %cworld", "color: blue"); |
| 11 } | 11 } |
| 12 | 12 |
| 13 //# sourceURL=console-viewport-selection.html | 13 //# sourceURL=console-viewport-selection.html |
| 14 </script> | 14 </script> |
| 15 | 15 |
| 16 <script> | 16 <script> |
| 17 | 17 |
| 18 function test() | 18 function test() |
| 19 { | 19 { |
| 20 var viewportHeight = 200; | 20 var viewportHeight = 200; |
| 21 InspectorTest.fixConsoleViewportDimensions(600, viewportHeight); | 21 InspectorTest.fixConsoleViewportDimensions(600, viewportHeight); |
| 22 var consoleView = WebInspector.ConsoleView.instance(); | 22 var consoleView = Console.ConsoleView.instance(); |
| 23 var viewport = consoleView._viewport; | 23 var viewport = consoleView._viewport; |
| 24 const minimumViewportMessagesCount = 10; | 24 const minimumViewportMessagesCount = 10; |
| 25 const messagesCount = 150; | 25 const messagesCount = 150; |
| 26 const middleMessage = messagesCount / 2; | 26 const middleMessage = messagesCount / 2; |
| 27 var viewportMessagesCount; | 27 var viewportMessagesCount; |
| 28 | 28 |
| 29 logMessagesToConsole(messagesCount, () => InspectorTest.runTestSuite(testSui
te)); | 29 logMessagesToConsole(messagesCount, () => InspectorTest.runTestSuite(testSui
te)); |
| 30 | 30 |
| 31 var testSuite = [ | 31 var testSuite = [ |
| 32 function verifyViewportIsTallEnough(next) | 32 function verifyViewportIsTallEnough(next) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 54 logMessagesToConsole(messagesCount, onMessagesDumped); | 54 logMessagesToConsole(messagesCount, onMessagesDumped); |
| 55 | 55 |
| 56 function onMessagesDumped() | 56 function onMessagesDumped() |
| 57 { | 57 { |
| 58 dumpAndContinue(next); | 58 dumpAndContinue(next); |
| 59 } | 59 } |
| 60 }, | 60 }, |
| 61 | 61 |
| 62 function testSmoothScrollDoesNotStickToBottom(next) | 62 function testSmoothScrollDoesNotStickToBottom(next) |
| 63 { | 63 { |
| 64 InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_updat
eViewportStickinessForTest", onUpdateTimeout); | 64 InspectorTest.addSniffer(Console.ConsoleView.prototype, "_updateView
portStickinessForTest", onUpdateTimeout); |
| 65 sendPageUp(); | 65 sendPageUp(); |
| 66 | 66 |
| 67 function onUpdateTimeout() | 67 function onUpdateTimeout() |
| 68 { | 68 { |
| 69 dumpAndContinue(next); | 69 dumpAndContinue(next); |
| 70 } | 70 } |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 function testEscShouldNotJumpToBottom(next) | 73 function testEscShouldNotJumpToBottom(next) |
| 74 { | 74 { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 97 viewport._contentElement.lastChild.innerText = "More than 3 line
s: foo\n\n\nbar"; | 97 viewport._contentElement.lastChild.innerText = "More than 3 line
s: foo\n\n\nbar"; |
| 98 dumpAndContinue(next); | 98 dumpAndContinue(next); |
| 99 } | 99 } |
| 100 }, | 100 }, |
| 101 | 101 |
| 102 function testMuteUpdatesWhileScrolling(next) | 102 function testMuteUpdatesWhileScrolling(next) |
| 103 { | 103 { |
| 104 consoleView._updateStickToBottomOnMouseDown(); | 104 consoleView._updateStickToBottomOnMouseDown(); |
| 105 viewport.element.scrollTop -= 10; | 105 viewport.element.scrollTop -= 10; |
| 106 | 106 |
| 107 InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_sched
uleViewportRefreshForTest", onMessageAdded); | 107 InspectorTest.addSniffer(Console.ConsoleView.prototype, "_scheduleVi
ewportRefreshForTest", onMessageAdded); |
| 108 InspectorTest.evaluateInConsole("1 + 1"); | 108 InspectorTest.evaluateInConsole("1 + 1"); |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * @param {boolean} muted | 111 * @param {boolean} muted |
| 112 */ | 112 */ |
| 113 function onMessageAdded(muted) | 113 function onMessageAdded(muted) |
| 114 { | 114 { |
| 115 InspectorTest.addResult("New messages were muted: " + muted); | 115 InspectorTest.addResult("New messages were muted: " + muted); |
| 116 InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_s
cheduleViewportRefreshForTest", onMouseUpScheduledRefresh); | 116 InspectorTest.addSniffer(Console.ConsoleView.prototype, "_schedu
leViewportRefreshForTest", onMouseUpScheduledRefresh); |
| 117 InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_u
pdateViewportStickinessForTest", onUpdateStickiness); | 117 InspectorTest.addSniffer(Console.ConsoleView.prototype, "_update
ViewportStickinessForTest", onUpdateStickiness); |
| 118 consoleView._updateStickToBottomOnMouseUp(); | 118 consoleView._updateStickToBottomOnMouseUp(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 /** | 121 /** |
| 122 * @param {boolean} muted | 122 * @param {boolean} muted |
| 123 */ | 123 */ |
| 124 function onMouseUpScheduledRefresh(muted) | 124 function onMouseUpScheduledRefresh(muted) |
| 125 { | 125 { |
| 126 InspectorTest.addResult("Refresh was scheduled after dirty state
"); | 126 InspectorTest.addResult("Refresh was scheduled after dirty state
"); |
| 127 } | 127 } |
| 128 | 128 |
| 129 function onUpdateStickiness() | 129 function onUpdateStickiness() |
| 130 { | 130 { |
| 131 next(); | 131 next(); |
| 132 } | 132 } |
| 133 }, | 133 }, |
| 134 | 134 |
| 135 function testShouldNotJumpToBottomWhenPromptFillsEntireViewport(next) | 135 function testShouldNotJumpToBottomWhenPromptFillsEntireViewport(next) |
| 136 { | 136 { |
| 137 var text = "Foo"; | 137 var text = "Foo"; |
| 138 for (var i = 0; i < viewportHeight; i++) | 138 for (var i = 0; i < viewportHeight; i++) |
| 139 text += "\n"; | 139 text += "\n"; |
| 140 WebInspector.ConsoleView.clearConsole(); | 140 Console.ConsoleView.clearConsole(); |
| 141 consoleView._prompt.setText(text); | 141 consoleView._prompt.setText(text); |
| 142 viewport.element.scrollTop -= 10; | 142 viewport.element.scrollTop -= 10; |
| 143 | 143 |
| 144 var keyEvent = InspectorTest.createKeyEvent("a"); | 144 var keyEvent = InspectorTest.createKeyEvent("a"); |
| 145 viewport._contentElement.dispatchEvent(keyEvent); | 145 viewport._contentElement.dispatchEvent(keyEvent); |
| 146 consoleView._promptElement.dispatchEvent(new Event('input')); | 146 consoleView._promptElement.dispatchEvent(new Event('input')); |
| 147 | 147 |
| 148 dumpAndContinue(next); | 148 dumpAndContinue(next); |
| 149 } | 149 } |
| 150 ]; | 150 ]; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 </script> | 181 </script> |
| 182 </head> | 182 </head> |
| 183 <body onload="runTest()"> | 183 <body onload="runTest()"> |
| 184 <p> | 184 <p> |
| 185 Verifies viewport stick-to-bottom behavior. | 185 Verifies viewport stick-to-bottom behavior. |
| 186 </p> | 186 </p> |
| 187 </body> | 187 </body> |
| 188 </html> | 188 </html> |
| OLD | NEW |