| 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; ++i) | 8 for (var i = 0; i < count; ++i) |
| 9 console.log("Message #" + i); | 9 console.log("Message #" + i); |
| 10 } | 10 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 return null; | 219 return null; |
| 220 } | 220 } |
| 221 | 221 |
| 222 function selectMessages(fromMessage, fromTextOffset, toMessage, toTextOffset
) | 222 function selectMessages(fromMessage, fromTextOffset, toMessage, toTextOffset
) |
| 223 { | 223 { |
| 224 if (Math.abs(toMessage - fromMessage) > minimumViewportMessagesCount) { | 224 if (Math.abs(toMessage - fromMessage) > minimumViewportMessagesCount) { |
| 225 InspectorTest.addResult(String.sprintf("FAILURE: Cannot select more
then %d messages (requested to select from %d to %d", minimumViewportMessagesCou
nt, fromMessage, toMessage)); | 225 InspectorTest.addResult(String.sprintf("FAILURE: Cannot select more
then %d messages (requested to select from %d to %d", minimumViewportMessagesCou
nt, fromMessage, toMessage)); |
| 226 InspectorTest.completeTest(); | 226 InspectorTest.completeTest(); |
| 227 return; | 227 return; |
| 228 } | 228 } |
| 229 viewport.forceScrollItemToBeLast(Math.max(fromMessage, toMessage)); | 229 viewport.forceScrollItemToBeFirst(Math.min(fromMessage, toMessage)); |
| 230 | 230 |
| 231 var from = selectionContainerAndOffset(consoleView.itemElement(fromMessa
ge).element(), fromTextOffset); | 231 var from = selectionContainerAndOffset(consoleView.itemElement(fromMessa
ge).element(), fromTextOffset); |
| 232 var to = selectionContainerAndOffset(consoleView.itemElement(toMessage).
element(), toTextOffset); | 232 var to = selectionContainerAndOffset(consoleView.itemElement(toMessage).
element(), toTextOffset); |
| 233 window.getSelection().setBaseAndExtent(from.container, from.offset, to.c
ontainer, to.offset); | 233 window.getSelection().setBaseAndExtent(from.container, from.offset, to.c
ontainer, to.offset); |
| 234 viewport.refresh(); | 234 viewport.refresh(); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 </script> | 237 </script> |
| 238 </head> | 238 </head> |
| 239 <body onload="runTest()"> | 239 <body onload="runTest()"> |
| 240 <p> | 240 <p> |
| 241 Tests that console viewport handles selection properly. | 241 Tests that console viewport handles selection properly. |
| 242 </p> | 242 </p> |
| 243 </body> | 243 </body> |
| 244 </html> | 244 </html> |
| OLD | NEW |