summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/file/get-file-upload.html
blob: 31e716e7df5ebc113b9f69a7b624ed151048a92e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html>
<body>
<form method="GET" action="get-file-upload.html" enctype="application/x-www-form-urlencoded">
  <input type="file" name="file" id="file">
  <input type="file" name="nofile">
  <input type="hidden" name="submitted" value="true">
</form>
<pre id='console'></pre>

<script>
function log(message)
{
    document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
}

function startOrVerify()
{
    var query = window.location.search;
    if (query.indexOf('submitted=true') != -1) {
        // Verify the result
        if (query.indexOf('file=get-file-upload.html&') == -1)
            log('FAIL: No file=get-file-upload.html; ' + query);
        else if (query.indexOf('nofile=&') == -1)
            log('FAIL: No nofile=; ' + query);
        else
            log('PASS: ' + query);
        testRunner.notifyDone();
    } else {
        // Start the test
        eventSender.beginDragWithFiles(['get-file-upload.html']);
        eventSender.mouseMoveTo(10, 10);
        eventSender.mouseUp();
        document.forms[0].submit();
    }
}

if (window.eventSender) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
    window.onload = startOrVerify;
}
</script>
</body>
</html>