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"); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 { | 74 { |
75 var keyEvent = InspectorTest.createKeyEvent("Escape"); | 75 var keyEvent = InspectorTest.createKeyEvent("Escape"); |
76 viewport._contentElement.dispatchEvent(keyEvent); | 76 viewport._contentElement.dispatchEvent(keyEvent); |
77 dumpAndContinue(next); | 77 dumpAndContinue(next); |
78 }, | 78 }, |
79 | 79 |
80 function testTypingShouldJumpToBottom(next) | 80 function testTypingShouldJumpToBottom(next) |
81 { | 81 { |
82 var keyEvent = InspectorTest.createKeyEvent("a"); | 82 var keyEvent = InspectorTest.createKeyEvent("a"); |
83 viewport._contentElement.dispatchEvent(keyEvent); | 83 viewport._contentElement.dispatchEvent(keyEvent); |
84 consoleView._prompt._proxyElement.dispatchEvent(new Event('input')); | 84 consoleView._promptElement.dispatchEvent(new Event('input')); |
85 | 85 |
86 dumpAndContinue(next); | 86 dumpAndContinue(next); |
87 }, | 87 }, |
88 | 88 |
89 function testViewportMutationsShouldPreserveStickToBottom(next) | 89 function testViewportMutationsShouldPreserveStickToBottom(next) |
90 { | 90 { |
91 viewport._contentElement.children[1].innerText = "More than 2 lines:
foo\n\nbar"; | 91 viewport._contentElement.children[1].innerText = "More than 2 lines:
foo\n\nbar"; |
92 dumpAndContinue(onMessagesDumped); | 92 dumpAndContinue(onMessagesDumped); |
93 | 93 |
94 function onMessagesDumped() | 94 function onMessagesDumped() |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 consoleView._promptElement.textContent = text; | |
141 WebInspector.ConsoleView.clearConsole(); | 140 WebInspector.ConsoleView.clearConsole(); |
| 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._prompt._proxyElement.dispatchEvent(new Event('input')); | 146 consoleView._promptElement.dispatchEvent(new Event('input')); |
147 | 147 |
148 dumpAndContinue(next); | 148 dumpAndContinue(next); |
149 } | 149 } |
150 ]; | 150 ]; |
151 | 151 |
152 function sendPageUp() | 152 function sendPageUp() |
153 { | 153 { |
154 var keyEvent = InspectorTest.createKeyEvent("PageUp"); | 154 var keyEvent = InspectorTest.createKeyEvent("PageUp"); |
155 consoleView._prompt._proxyElement.dispatchEvent(keyEvent); | 155 consoleView._prompt.element.dispatchEvent(keyEvent); |
156 viewport.element.scrollTop -= 10; | 156 viewport.element.scrollTop -= 10; |
157 } | 157 } |
158 | 158 |
159 function dumpAndContinue(callback) | 159 function dumpAndContinue(callback) |
160 { | 160 { |
161 viewport.refresh(); | 161 viewport.refresh(); |
162 InspectorTest.addResult("Is at bottom: " + viewport.element.isScrolledTo
Bottom() + ", should stick: " + viewport.stickToBottom()); | 162 InspectorTest.addResult("Is at bottom: " + viewport.element.isScrolledTo
Bottom() + ", should stick: " + viewport.stickToBottom()); |
163 callback(); | 163 callback(); |
164 } | 164 } |
165 | 165 |
(...skipping 13 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 |