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; | |
13 eventSender.beginDragWithFiles(['resources/file-for-drop-with-file-paths.htm
l']); | 11 eventSender.beginDragWithFiles(['resources/file-for-drop-with-file-paths.htm
l']); |
14 eventSender.mouseMoveTo(10, 10); | 12 eventSender.mouseMoveTo(10, 10); |
15 eventSender.mouseUp(); | 13 eventSender.mouseUp(); |
16 } | 14 } |
17 | 15 |
18 document.body.addEventListener('dragenter', | 16 document.body.addEventListener('dragenter', |
19 function (e) { | 17 function (e) { |
20 e.preventDefault(); | 18 e.preventDefault(); |
21 }); | 19 }); |
22 document.body.addEventListener('dragover', | 20 document.body.addEventListener('dragover', |
23 function (e) { | 21 function (e) { |
24 e.preventDefault(); | 22 e.preventDefault(); |
25 }); | 23 }); |
26 document.body.addEventListener('drop', | 24 document.body.addEventListener('drop', |
27 function (e) { | 25 function (e) { |
28 data = e.dataTransfer.getData('text/uri-list'); | 26 data = e.dataTransfer.getData('text/uri-list'); |
29 if (data) { | 27 if (data) { |
30 document.body.innerHTML += '<p>Dropped file: ' + data + '</p>'; | 28 document.body.innerHTML += '<p>Dropped file: ' + data + '</p>'; |
31 document.body.innerHTML += 'Dropped types: ' + e.dataTransfer.types; | 29 document.body.innerHTML += 'Dropped types: ' + e.dataTransfer.types; |
32 } else | 30 } else |
33 document.body.innerHTML = 'PASS'; | 31 document.body.innerHTML = 'PASS'; |
34 e.preventDefault(); | 32 e.preventDefault(); |
35 }); | 33 }); |
36 | 34 |
37 window.onload = runTest; | 35 window.onload = runTest; |
38 </script> | 36 </script> |
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> | 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> |
40 </body> | 38 </body> |
41 </html> | 39 </html> |
OLD | NEW |