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("Message #" + i); | 9 console.log("Message #" + i); |
10 console.log("hello %cworld", "color: blue"); | 10 console.log("hello %cworld", "color: blue"); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 window.getSelection().setBaseAndExtent(blueSpan, 0, blueSpan, blueSp
an.textContent.length); | 164 window.getSelection().setBaseAndExtent(blueSpan, 0, blueSpan, blueSp
an.textContent.length); |
165 InspectorTest.addResult("Selected text: " + viewport._selectedText()
); | 165 InspectorTest.addResult("Selected text: " + viewport._selectedText()
); |
166 next(); | 166 next(); |
167 }, | 167 }, |
168 | 168 |
169 function testSelectAll(next) | 169 function testSelectAll(next) |
170 { | 170 { |
171 viewport.forceScrollItemToBeFirst(0); | 171 viewport.forceScrollItemToBeFirst(0); |
172 | 172 |
173 // Set some initial selection in console. | 173 // Set some initial selection in console. |
174 var base = consoleView.itemElement(messagesCount - 2); | 174 var base = consoleView.itemElement(messagesCount - 2).element(); |
175 var extent = consoleView.itemElement(messagesCount - 1); | 175 var extent = consoleView.itemElement(messagesCount - 1).element(); |
176 window.getSelection().setBaseAndExtent(base, 0, extent, 0); | 176 window.getSelection().setBaseAndExtent(base, 0, extent, 0); |
177 | 177 |
178 // Try to select all messages. | 178 // Try to select all messages. |
179 document.execCommand("selectAll"); | 179 document.execCommand("selectAll"); |
180 | 180 |
181 var text = viewport._selectedText(); | 181 var text = viewport._selectedText(); |
182 var count = text ? text.split("\n").length : 0; | 182 var count = text ? text.split("\n").length : 0; |
183 InspectorTest.addResult(count === messagesCount ? "Selected all " +
count + " messages." : "Selected " + count + " messages instead of " + messagesC
ount); | 183 InspectorTest.addResult(count === messagesCount ? "Selected all " +
count + " messages." : "Selected " + count + " messages instead of " + messagesC
ount); |
184 next(); | 184 next(); |
185 } | 185 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 271 } |
272 } | 272 } |
273 </script> | 273 </script> |
274 </head> | 274 </head> |
275 <body onload="runTest()"> | 275 <body onload="runTest()"> |
276 <p> | 276 <p> |
277 Tests that console viewport handles selection properly. | 277 Tests that console viewport handles selection properly. |
278 </p> | 278 </p> |
279 </body> | 279 </body> |
280 </html> | 280 </html> |
OLD | NEW |