<!DOCTYPE html>
<html>
<body>
<input type="file" name="file" id="file" onchange="onInputFileListChanged()" multiple>
<pre id='console'></pre>
<script src="../resources/setup-for-read-common.js"></script>
<script>
var testFileInfoList = [
{ 'name': 'non-existent', 'path': '../resources/non-existent' },
{ 'name': 'empty-file', 'path': '../resources/empty-file' },
{ 'name': 'UTF8-file', 'path': '../resources/UTF8.txt' },
{ 'name': 'UTF16BE-BOM-file', 'path': '../resources/UTF16BE-BOM.txt' },
{ 'name': 'UTF16LE-BOM-file', 'path': '../resources/UTF16LE-BOM.txt' },
{ 'name': 'UTF8-BOM-file', 'path': '../resources/UTF8-BOM.txt' },
{ 'name': 'UTF16BE-file', 'path': '../resources/UTF16BE.txt' },
{ 'name': 'binary-file', 'path': '../resources/binary-file' },
];
function onInputFileListChanged()
{
var files = document.getElementById("file").files;
var namesOnly = testFileInfoList.map(function(fileSpec) { return fileSpec['name']; });
// Send both the FileList and the File names along. Worker will construct
// a name => File mapping of the cloned result.
startTest([files, namesOnly]);
}
function startTest(testFiles)
{
startWorker(testFiles, "resources/worker-read-file-async.js");
}
if (window.eventSender) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
window.onload = function() { runTests(testFileInfoList); }
}
</script>
</body>
</html>