| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <body> | 3 <body> |
| 4 <div>This tests that a drop handler's default action must be prevented in order
to stop navigation. | 4 <div>This tests that a drop handler's default action must be prevented in order
to stop navigation. |
| 5 Otherwise, if event.preventDefault() is not called, navigation should occur. To
test manually, | 5 Otherwise, if event.preventDefault() is not called, navigation should occur. To
test manually, |
| 6 simply drag and drop another link or HTML file on this page. If navigation occur
s, then the test | 6 simply drag and drop another link or HTML file on this page. If navigation occur
s, then the test |
| 7 passed.</div> | 7 passed.</div> |
| 8 <script> | 8 <script> |
| 9 function log(text) | 9 function log(text) |
| 10 { | 10 { |
| 11 document.body.appendChild(document.createElement('br')); | 11 document.body.appendChild(document.createElement('br')); |
| 12 document.body.appendChild(document.createElement('div').appendChild(document
.createTextNode(text))); | 12 document.body.appendChild(document.createElement('div').appendChild(document
.createTextNode(text))); |
| 13 } | 13 } |
| 14 window.addEventListener('beforeunload', function () | 14 window.addEventListener('beforeunload', function (e) |
| 15 { | 15 { |
| 16 log('PASS'); | 16 log('PASS'); |
| 17 testRunner.notifyDone(); | 17 testRunner.notifyDone(); |
| 18 e.preventDefault(); |
| 18 }); | 19 }); |
| 19 document.body.addEventListener('dragenter', function (event) | 20 document.body.addEventListener('dragenter', function (event) |
| 20 { | 21 { |
| 21 event.preventDefault(); | 22 event.preventDefault(); |
| 22 }); | 23 }); |
| 23 document.body.addEventListener('dragover', function (event) | 24 document.body.addEventListener('dragover', function (event) |
| 24 { | 25 { |
| 25 event.preventDefault(); | 26 event.preventDefault(); |
| 26 }); | 27 }); |
| 27 document.body.addEventListener('drop', function (event) | 28 document.body.addEventListener('drop', function (event) |
| 28 { | 29 { |
| 29 log('Not preventing default event on drop.'); | 30 log('Not preventing default event on drop.'); |
| 30 }); | 31 }); |
| 31 (function () | 32 (function () |
| 32 { | 33 { |
| 33 if (!window.testRunner) | 34 if (!window.testRunner) |
| 34 return; | 35 return; |
| 35 testRunner.dumpAsText(); | 36 testRunner.dumpAsText(); |
| 36 testRunner.waitUntilDone(); | 37 testRunner.waitUntilDone(); |
| 37 log('Starting test'); | 38 log('Starting test'); |
| 38 eventSender.beginDragWithFiles(['DRTFakeFile']); | 39 eventSender.beginDragWithFiles(['DRTFakeFile']); |
| 39 eventSender.mouseMoveTo(document.body.offsetLeft + 10, document.body.offsetT
op + 10); | 40 eventSender.mouseMoveTo(document.body.offsetLeft + 10, document.body.offsetT
op + 10); |
| 40 eventSender.mouseUp(); | 41 eventSender.mouseUp(); |
| 41 window.setTimeout(function () | 42 window.setTimeout(function () |
| 42 { | 43 { |
| 43 // Deadman's switch so we don't need to wait for the test to timeout to
fail. | 44 // Deadman's switch so we don't need to wait for the test to timeout to
fail. |
| 44 log('FAIL'); | |
| 45 testRunner.notifyDone(); | 45 testRunner.notifyDone(); |
| 46 }, 0); | 46 }, 0); |
| 47 })(); | 47 })(); |
| 48 </script> | 48 </script> |
| 49 </body> | 49 </body> |
| 50 </html> | 50 </html> |
| OLD | NEW |