4 <script src=
"../../../resources/js-test.js"></script>
6 window
.jsTestIsAsync
= true;
8 setTimeout(runTest
, 0);
12 if (!window
.internals
) {
13 testFailed('This test requires window.internals.');
17 var onChangeFired
= 0;
18 var input1
= document
.getElementById('fileinput1');
19 input1
.onchange = function() {
22 var input2
= document
.getElementById('fileinput2');
23 input2
.onchange = function() {
27 eventSender
.beginDragWithFiles(['testpath1/testfile1.txt']);
28 var centerX
= input1
.offsetLeft
+ input1
.offsetWidth
/ 2;
29 var centerY
= input1
.offsetTop
+ input1
.offsetHeight
/ 2;
30 eventSender
.mouseMoveTo(centerX
, centerY
);
31 eventSender
.mouseUp();
33 eventSender
.beginDragWithFiles(['testpath2/testfile2.txt']);
34 centerX
= input2
.offsetLeft
+ input2
.offsetWidth
/ 2;
35 centerY
= input2
.offsetTop
+ input2
.offsetHeight
/ 2;
36 eventSender
.mouseMoveTo(centerX
, centerY
);
37 eventSender
.mouseUp();
39 if (onChangeFired
!= 2) {
40 testFailed('onchange fired unexpected times: ' + onChangeFired
);
43 var files
= internals
.getReferencedFilePaths();
45 if (files
.length
== 2 &&
46 files
[0].indexOf('testfile1.txt') != -1 &&
47 files
[0].indexOf('testpath1') != -1 &&
48 files
[1].indexOf('testfile2.txt') != -1 &&
49 files
[1].indexOf('testpath2') != -1) {
52 testFailed('Unexpected files: ' + files
);
58 <body onload=
"onLoad();">
59 <p id=
"description">Tests that selected files in file input elements are correctly retrieved by FormController::getReferencedFilePaths.
</p>
62 <input id=
"fileinput1" type=
"file" />
65 <input id=
"fileinput2" type=
"file" />
68 <div id=
"console"></div>