Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <head> | |
|
Julien - ping for review
2013/09/06 00:40:02
Where is Da Doctype:
<DOCTYPE html>
| |
| 2 <style type="text/css"> | |
|
Julien - ping for review
2013/09/06 00:40:02
No need for the type attribute.
| |
| 3 .overflow-hidden { | |
| 4 width: 100px; | |
| 5 height: 100px; | |
| 6 background: #000; | |
| 7 overflow: hidden; | |
| 8 } | |
| 9 input { | |
| 10 font-size: 10px; | |
| 11 height: 20px; | |
| 12 } | |
| 13 button { | |
| 14 position: relative; | |
| 15 left: 100px; | |
| 16 top: 100px; | |
| 17 } | |
| 18 </style> | |
| 19 <script> | |
| 20 function runTest() { | |
| 21 if (!window.testRunner) | |
| 22 return; | |
| 23 if (!window.eventSender) | |
| 24 return; | |
| 25 | |
| 26 testRunner.dumpAsText(); | |
| 27 testRunner.waitUntilDone(); | |
| 28 setTimeout(startTest, 0); | |
|
Julien - ping for review
2013/09/06 00:40:02
This setTimeout is very likely unneeded.
| |
| 29 } | |
| 30 | |
| 31 function startTest() | |
| 32 { | |
| 33 var input = document.getElementById("input"); | |
| 34 var x = input.offsetLeft + input.offsetWidth / 2; | |
| 35 var y = input.offsetTop + input.offsetHeight / 2; | |
| 36 | |
| 37 eventSender.dragMode = false; | |
| 38 eventSender.mouseMoveTo(x, y); | |
| 39 eventSender.mouseDown(); | |
| 40 | |
| 41 // We do the dragging/selection in two steps here, because if we move | |
| 42 // the mouse beyond the input boundary right way, it won't start the autoscr oll | |
| 43 // timer. See early return in AutoscrollController::startAutoscrollForSelect ion | |
| 44 // after calling RenderBox::findAutoscrollable. | |
| 45 eventSender.mouseMoveTo(x + 48, y); | |
| 46 eventSender.mouseMoveTo(x + 55, y); | |
| 47 setTimeout(finishTest, 100); | |
| 48 } | |
| 49 | |
| 50 function finishTest() | |
| 51 { | |
| 52 eventSender.mouseUp(); | |
| 53 var div = document.getElementById("div"); | |
| 54 if (div.scrollTop == 0 && div.scrollLeft == 0) | |
| 55 document.getElementById("result").innerText = "Test succeeded!"; | |
| 56 else | |
| 57 document.getElementById("result").innerText = "Test failed!"; | |
| 58 | |
| 59 testRunner.notifyDone(); | |
| 60 } | |
| 61 | |
| 62 </script> | |
| 63 | |
| 64 <body onload="runTest()"> | |
| 65 </head> | |
| 66 <div id="div" class="overflow-hidden"> | |
| 67 <input id="input" type="text" value="any text here!"/> | |
| 68 <button/> | |
| 69 </div> | |
|
Julien - ping for review
2013/09/06 00:40:02
Let's add a description about what we are testing.
| |
| 70 <p id="result">If the test has completed this sentence should be replaced by a s uccess message.</p> | |
| 71 </body> | |
| OLD | NEW |