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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 var extent = consoleView.itemElement(messagesCount - 1).element(); | 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 }, |
| 186 |
| 187 function testSelectWithNonTextNodeContainer(next) |
| 188 { |
| 189 viewport.forceScrollItemToBeFirst(0); |
| 190 |
| 191 var nonTextNodeBase = consoleView.itemElement(1).element(); |
| 192 var nonTextNodeExtent = consoleView.itemElement(2).element(); |
| 193 var textNodeBase = consoleView.itemElement(1).element().traverseNext
TextNode(); |
| 194 var textNodeExtent = consoleView.itemElement(2).element().traverseNe
xtTextNode(); |
| 195 |
| 196 window.getSelection().setBaseAndExtent(nonTextNodeBase, 0, nonTextNo
deExtent, 0); |
| 197 InspectorTest.addResult("Selected text: " + viewport._selectedText()
); |
| 198 |
| 199 window.getSelection().setBaseAndExtent(textNodeBase, 0, nonTextNodeE
xtent, 0); |
| 200 InspectorTest.addResult("Selected text: " + viewport._selectedText()
); |
| 201 |
| 202 window.getSelection().setBaseAndExtent(nonTextNodeBase, 0, textNodeE
xtent, 0); |
| 203 InspectorTest.addResult("Selected text: " + viewport._selectedText()
); |
| 204 |
| 205 next(); |
185 } | 206 } |
186 ]; | 207 ]; |
187 | 208 |
188 var awaitingMessagesCount = messagesCount; | 209 var awaitingMessagesCount = messagesCount; |
189 function messageAdded() | 210 function messageAdded() |
190 { | 211 { |
191 if (!--awaitingMessagesCount) | 212 if (!--awaitingMessagesCount) |
192 InspectorTest.runTestSuite(testSuite); | 213 InspectorTest.runTestSuite(testSuite); |
193 } | 214 } |
194 | 215 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 292 } |
272 } | 293 } |
273 </script> | 294 </script> |
274 </head> | 295 </head> |
275 <body onload="runTest()"> | 296 <body onload="runTest()"> |
276 <p> | 297 <p> |
277 Tests that console viewport handles selection properly. | 298 Tests that console viewport handles selection properly. |
278 </p> | 299 </p> |
279 </body> | 300 </body> |
280 </html> | 301 </html> |
OLD | NEW |