OLD | NEW |
1 <html> | 1 <html> |
2 <body> | 2 <body> |
3 <script> | 3 <script> |
4 | 4 |
5 function runTest() { | 5 function runTest() { |
6 if (!window.testRunner) | 6 if (!window.testRunner) |
7 return; | 7 return; |
8 | 8 |
9 window.testRunner.dumpAsText(); | 9 window.testRunner.dumpAsText(); |
10 | 10 |
| 11 // Mouse events only work after an initial layout |
| 12 document.body.offsetLeft; |
11 eventSender.beginDragWithFiles(['resources/file-for-drop-with-file-paths.htm
l']); | 13 eventSender.beginDragWithFiles(['resources/file-for-drop-with-file-paths.htm
l']); |
12 eventSender.mouseMoveTo(10, 10); | 14 eventSender.mouseMoveTo(10, 10); |
13 eventSender.mouseUp(); | 15 eventSender.mouseUp(); |
14 } | 16 } |
15 | 17 |
16 document.body.addEventListener('dragenter', | 18 document.body.addEventListener('dragenter', |
17 function (e) { | 19 function (e) { |
18 e.preventDefault(); | 20 e.preventDefault(); |
19 }); | 21 }); |
20 document.body.addEventListener('dragover', | 22 document.body.addEventListener('dragover', |
21 function (e) { | 23 function (e) { |
22 e.preventDefault(); | 24 e.preventDefault(); |
23 }); | 25 }); |
24 document.body.addEventListener('drop', | 26 document.body.addEventListener('drop', |
25 function (e) { | 27 function (e) { |
26 data = e.dataTransfer.getData('text/uri-list'); | 28 data = e.dataTransfer.getData('text/uri-list'); |
27 if (data) { | 29 if (data) { |
28 document.body.innerHTML += '<p>Dropped file: ' + data + '</p>'; | 30 document.body.innerHTML += '<p>Dropped file: ' + data + '</p>'; |
29 document.body.innerHTML += 'Dropped types: ' + e.dataTransfer.types; | 31 document.body.innerHTML += 'Dropped types: ' + e.dataTransfer.types; |
30 } else | 32 } else |
31 document.body.innerHTML = 'PASS'; | 33 document.body.innerHTML = 'PASS'; |
32 e.preventDefault(); | 34 e.preventDefault(); |
33 }); | 35 }); |
34 | 36 |
35 window.onload = runTest; | 37 window.onload = runTest; |
36 </script> | 38 </script> |
37 <p>Drop files anywhere on this page. The page will try to intercept the drop--it
should succeed but not be able to use dataTransfer.getData</p> | 39 <p>Drop files anywhere on this page. The page will try to intercept the drop--it
should succeed but not be able to use dataTransfer.getData</p> |
38 </body> | 40 </body> |
39 </html> | 41 </html> |
OLD | NEW |