OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <input type="file" name="file" id="file" onchange="onInputFileChange()"> | 4 <input type="file" name="file" id="file" onchange="onInputFileChange()"> |
5 <img id='imgToReplace' src=''> | 5 <img id='imgToReplace' src=''> |
6 <pre id='console'></pre> | 6 <pre id='console'></pre> |
7 | 7 |
8 <script> | 8 <script> |
9 function log(message) | 9 function log(message) |
10 { | 10 { |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 function onImgLoad() | 23 function onImgLoad() |
24 { | 24 { |
25 var img = document.getElementById('imgToReplace'); | 25 var img = document.getElementById('imgToReplace'); |
26 log("New image: " + img.width + " x " + img.height); | 26 log("New image: " + img.width + " x " + img.height); |
27 log("DONE"); | 27 log("DONE"); |
28 if (layoutTestController.notifyDone) | 28 if (layoutTestController.notifyDone) |
29 layoutTestController.notifyDone(); | 29 layoutTestController.notifyDone(); |
30 } | 30 } |
31 | 31 |
| 32 function moveMouseToCenterOfElement(element) |
| 33 { |
| 34 var centerX = element.offsetLeft + element.offsetWidth / 2; |
| 35 var centerY = element.offsetTop + element.offsetHeight / 2; |
| 36 eventSender.mouseMoveTo(centerX, centerY); |
| 37 } |
| 38 |
32 function runTests() | 39 function runTests() |
33 { | 40 { |
34 eventSender.beginDragWithFiles(['resources/abe.png']); | 41 eventSender.beginDragWithFiles(['resources/abe.png']); |
35 eventSender.mouseMoveTo(10, 10); | 42 moveMouseToCenterOfElement(document.getElementById('file')); |
36 eventSender.mouseUp(); | 43 eventSender.mouseUp(); |
37 } | 44 } |
38 | 45 |
39 if (window.eventSender) { | 46 if (window.eventSender) { |
40 layoutTestController.dumpAsText(); | 47 layoutTestController.dumpAsText(); |
41 layoutTestController.waitUntilDone(); | 48 layoutTestController.waitUntilDone(); |
42 window.onload = runTests; | 49 window.onload = runTests; |
43 } | 50 } |
44 </script> | 51 </script> |
45 </body> | 52 </body> |
46 </html> | 53 </html> |
OLD | NEW |