| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <body> | 3 <body> |
| 4 <input type="file" name="file" id="file" onchange="onInputFileChange(testFileInf
oList)" multiple> | 4 <input type="file" name="file" id="file" onchange="onInputFileListChanged()" mul
tiple> |
| 5 <pre id='console'></pre> | 5 <pre id='console'></pre> |
| 6 | 6 |
| 7 <script src="../resources/setup-for-read-common.js"></script> | 7 <script src="../resources/setup-for-read-common.js"></script> |
| 8 <script> | 8 <script> |
| 9 var testFileInfoList = [ | 9 var testFileInfoList = [ |
| 10 { 'name': 'non-existent', 'path': '../resources/non-existent' }, | 10 { 'name': 'non-existent', 'path': '../resources/non-existent' }, |
| 11 { 'name': 'empty-file', 'path': '../resources/empty-file' }, | 11 { 'name': 'empty-file', 'path': '../resources/empty-file' }, |
| 12 { 'name': 'UTF8-file', 'path': '../resources/UTF8.txt' }, | 12 { 'name': 'UTF8-file', 'path': '../resources/UTF8.txt' }, |
| 13 { 'name': 'UTF16BE-BOM-file', 'path': '../resources/UTF16BE-BOM.txt' }, | 13 { 'name': 'UTF16BE-BOM-file', 'path': '../resources/UTF16BE-BOM.txt' }, |
| 14 { 'name': 'UTF16LE-BOM-file', 'path': '../resources/UTF16LE-BOM.txt' }, | 14 { 'name': 'UTF16LE-BOM-file', 'path': '../resources/UTF16LE-BOM.txt' }, |
| 15 { 'name': 'UTF8-BOM-file', 'path': '../resources/UTF8-BOM.txt' }, | 15 { 'name': 'UTF8-BOM-file', 'path': '../resources/UTF8-BOM.txt' }, |
| 16 { 'name': 'UTF16BE-file', 'path': '../resources/UTF16BE.txt' }, | 16 { 'name': 'UTF16BE-file', 'path': '../resources/UTF16BE.txt' }, |
| 17 { 'name': 'binary-file', 'path': '../resources/binary-file' }, | 17 { 'name': 'binary-file', 'path': '../resources/binary-file' }, |
| 18 ]; | 18 ]; |
| 19 | 19 |
| 20 function onInputFileListChanged() |
| 21 { |
| 22 var files = document.getElementById("file").files; |
| 23 var namesOnly = testFileInfoList.map(function(fileSpec) { return fileSpec['n
ame']; }); |
| 24 // Send both the FileList and the File names along. Worker will construct |
| 25 // a name => File mapping of the cloned result. |
| 26 startTest([files, namesOnly]); |
| 27 } |
| 28 |
| 20 function startTest(testFiles) | 29 function startTest(testFiles) |
| 21 { | 30 { |
| 22 startWorker(testFiles, "resources/worker-read-file-async.js"); | 31 startWorker(testFiles, "resources/worker-read-file-async.js"); |
| 23 } | 32 } |
| 24 | 33 |
| 25 if (window.eventSender) { | 34 if (window.eventSender) { |
| 26 testRunner.dumpAsText(); | 35 testRunner.dumpAsText(); |
| 27 testRunner.waitUntilDone(); | 36 testRunner.waitUntilDone(); |
| 28 window.onload = function() { runTests(testFileInfoList); } | 37 window.onload = function() { runTests(testFileInfoList); } |
| 29 } | 38 } |
| 30 </script> | 39 </script> |
| 31 </body> | 40 </body> |
| 32 </html> | 41 </html> |
| OLD | NEW |