blob: 0256e595abe4cd8052404b6fff0c7d3671861938 [file] [log] [blame]
<!DOCTYPE html>
<html>
<script src="../../resources/ui-helper.js"></script>
<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()
{
testRunner.setOpenPanelFiles(['resources/UTF8.txt']);
var inputElement = document.getElementById("file");
var centerX = inputElement.offsetLeft + inputElement.offsetWidth / 2;
var centerY = inputElement.offsetTop + inputElement.offsetHeight / 2;
UIHelper.activateAt(centerX, centerY);
}
if (window.eventSender) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
window.onload = runTests;
}
</script>
</body>
</html>