| <!DOCTYPE html> |
| <html> |
| <body> |
| <input type="file" name="file" id="file" onchange="onInputFileChange()"> |
| <pre id='console'></pre> |
| |
| <script> |
| function log(message) |
| { |
| document.getElementById('console').appendChild(document.createTextNode(message + "\n")); |
| } |
| |
| function onInputFileChange() |
| { |
| log("Test that FileReader.abort works."); |
| |
| var file = document.getElementById("file").files[0]; |
| var reader = new FileReader(); |
| reader.readAsText(file); |
| reader.onloadstart = function() { |
| log("Received loadstart event"); |
| reader.abort(); |
| }; |
| reader.onload = function() { |
| log("Received load event"); |
| }; |
| reader.onloadend = function() { |
| log("Received loadend event"); |
| log("DONE"); |
| if (testRunner.notifyDone) |
| testRunner.notifyDone(); |
| }; |
| reader.onabort = function() { |
| log("Received abort event"); |
| }; |
| reader.onerror = function(event) { |
| log("Received error event: " + event.target.error.code); |
| }; |
| } |
| |
| function runTests() |
| { |
| eventSender.beginDragWithFiles(['resources/UTF8.txt']); |
| eventSender.mouseMoveTo(10, 10); |
| eventSender.mouseUp(); |
| } |
| |
| if (window.eventSender) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| window.onload = runTests; |
| } |
| </script> |
| </body> |
| </html> |