| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <body> | |
| 4 <input type="file" name="files" id="files" webkitdirectory> | |
| 5 <pre id='output'></pre> | |
| 6 | |
| 7 <script> | |
| 8 var testFileList1 = [ | |
| 9 {'path': 'resources/dirupload/path1/file1', 'expect-relpat
h': 'dirupload/path1/file1'}, | |
| 10 {'path': 'resources/dirupload/path1/file2', 'expect-relpat
h': 'dirupload/path1/file2' }, | |
| 11 {'path': 'resources/dirupload/path1/subpath1/file1', 'expect-relpat
h': 'dirupload/path1/subpath1/file1'}, | |
| 12 {'path': 'resources/dirupload/path2/file1', 'expect-relpat
h': 'dirupload/path2/file1'}, | |
| 13 {'path': 'resources/dirupload/path2/subpath1/subpath2/file1', 'expect-relpat
h': 'dirupload/path2/subpath1/subpath2/file1'}, | |
| 14 {'path': 'resources/dirupload/path2/file2', 'expect-relpat
h': 'dirupload/path2/file2'}, | |
| 15 {'path': 'resources/dirupload/path3/file1', 'expect-relpat
h': 'dirupload/path3/file1'}, | |
| 16 {'path': 'resources/dirupload/file1', 'expect-relpat
h': 'dirupload/file1'}, | |
| 17 ]; | |
| 18 | |
| 19 var testFileList2 = [ | |
| 20 {'path': 'resources/dirupload/path1/file1', 'expect-relpat
h': 'path1/file1'}, | |
| 21 {'path': 'resources/dirupload/path1/file2', 'expect-relpat
h': 'path1/file2' }, | |
| 22 ]; | |
| 23 | |
| 24 var testFileList3 = [ | |
| 25 {'path': 'resources/dirupload/path1/file1', 'expect-relpat
h': 'dirupload/path1/file1'}, | |
| 26 {'path': 'resources/dirupload/path2/file1', 'expect-relpat
h': 'dirupload/path2/file1' }, | |
| 27 ]; | |
| 28 | |
| 29 var testFileList4 = [ | |
| 30 {'path': 'resources/dirupload/path1/file1', 'expect-relpat
h': 'path1/file1'}, | |
| 31 {'path': 'resources/dirupload/path1/subpath1/file1', 'expect-relpat
h': 'path1/subpath1/file1' }, | |
| 32 ]; | |
| 33 | |
| 34 var testFileList5 = [ | |
| 35 {'path': '/foo/baz', 'expect-relpat
h': 'foo/baz'}, | |
| 36 {'path': '/foo/bar/baz', 'expect-relpat
h': 'foo/bar/baz'}, | |
| 37 {'path': '/foo2/baz', 'expect-relpat
h': 'foo2/baz'}, | |
| 38 ]; | |
| 39 | |
| 40 function log(message) | |
| 41 { | |
| 42 document.getElementById('output').appendChild(document.createTextNode(messag
e + "\n")); | |
| 43 } | |
| 44 | |
| 45 function onInputFileChange(currentFileList, lastTest) | |
| 46 { | |
| 47 var files = document.getElementById("files").files; | |
| 48 for (var i = 0; i < files.length; i++) { | |
| 49 if (files[i].webkitRelativePath != currentFileList[i]['expect-relpath']) | |
| 50 log("FAIL: name is " + files[i].name + "; path is " + files[i].webki
tRelativePath + " but should be " + currentFileList[i]['expect-relpath']); | |
| 51 else | |
| 52 log("PASS: name is " + files[i].name + "; path is " + files[i].webki
tRelativePath); | |
| 53 } | |
| 54 | |
| 55 if (lastTest && testRunner) | |
| 56 testRunner.notifyDone(); | |
| 57 else | |
| 58 log(""); | |
| 59 } | |
| 60 | |
| 61 function doTest(fileList, last) | |
| 62 { | |
| 63 var pathsOnly = fileList.map(function(item) { return item['path'];}); | |
| 64 var f = function() { onInputFileChange(fileList, last); }; | |
| 65 document.getElementById("files").onchange = f; | |
| 66 eventSender.beginDragWithFiles(pathsOnly); | |
| 67 eventSender.mouseMoveTo(10, 10); | |
| 68 eventSender.mouseUp(); | |
| 69 } | |
| 70 | |
| 71 if (testRunner) { | |
| 72 testRunner.dumpAsText(); | |
| 73 testRunner.waitUntilDone(); | |
| 74 } | |
| 75 | |
| 76 if (window.eventSender) { | |
| 77 doTest(testFileList1); | |
| 78 doTest(testFileList2); | |
| 79 doTest(testFileList3); | |
| 80 doTest(testFileList4); | |
| 81 doTest(testFileList5, true); | |
| 82 } | |
| 83 </script> | |
| 84 </body> | |
| 85 </html> | |
| OLD | NEW |