|
Lines 10-30
a/LayoutTests/fast/files/file-list-test.html_sec1
|
| 10 |
<script> |
10 |
<script> |
| 11 |
description("Test the attribute of FileList."); |
11 |
description("Test the attribute of FileList."); |
| 12 |
|
12 |
|
|
|
13 |
var caseArray = [["resources/UTF8.txt", "resources/UTF8-2.txt"], []]; |
| 14 |
var caseIndex = 0; |
| 15 |
|
| 13 |
function onInputFileChange(files) |
16 |
function onInputFileChange(files) |
| 14 |
{ |
17 |
{ |
|
|
18 |
if (caseArray[caseIndex].length == 0) { |
| 19 |
testFailed("onInputFileChange was called for an empty file list."); |
| 20 |
return; |
| 21 |
} |
| 15 |
window.files = files; |
22 |
window.files = files; |
| 16 |
debug("Start"); |
|
|
| 17 |
shouldBe("files.length", "2"); |
23 |
shouldBe("files.length", "2"); |
| 18 |
shouldBeTrue("files.item(0) instanceof File"); |
24 |
shouldBeTrue("files.item(0) instanceof File"); |
| 19 |
shouldBeEqualToString('files.item(0).name', 'UTF8.txt'); |
25 |
shouldBeEqualToString("files.item(0).name", "UTF8.txt"); |
| 20 |
shouldBeTrue("files.item(1) instanceof File"); |
26 |
shouldBeTrue("files.item(1) instanceof File"); |
| 21 |
shouldBeEqualToString('files.item(1).name', 'UTF8-2.txt'); |
27 |
shouldBeEqualToString("files.item(1).name", "UTF8-2.txt"); |
| 22 |
shouldBeNull("files.item(999)"); |
28 |
shouldBeNull("files.item(2)"); |
|
|
29 |
shouldBeNull("files.item(-1)"); |
| 30 |
shouldBeTrue("files.item(null) instanceof File"); |
| 31 |
shouldBeEqualToString("files.item(null).name", "UTF8.txt"); |
| 32 |
shouldBeTrue("files.item(undefined) instanceof File"); |
| 33 |
shouldBeEqualToString("files.item(undefined).name", "UTF8.txt"); |
| 34 |
doTest(++caseIndex); |
| 35 |
} |
| 36 |
|
| 37 |
function doTest(index) { |
| 38 |
debug("Test " + index); |
| 39 |
eventSender.beginDragWithFiles(caseArray[index]); |
| 40 |
eventSender.mouseMoveTo(10, 10); |
| 41 |
eventSender.mouseUp(); |
| 23 |
} |
42 |
} |
| 24 |
|
43 |
|
| 25 |
eventSender.beginDragWithFiles(['resources/UTF8.txt', 'resources/UTF8-2.txt']); |
44 |
doTest(0); |
| 26 |
eventSender.mouseMoveTo(10, 10); |
|
|
| 27 |
eventSender.mouseUp(); |
| 28 |
|
45 |
|
| 29 |
</script> |
46 |
</script> |
| 30 |
</body> |
47 |
</body> |