summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/FileAPI/file/send-file-form-controls.html
blob: 6347065bcae14b6e927a6918bfae61d58cb2b98e (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Upload files named using controls</title>
<link
  rel="help"
  href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data"
/>
<link
  rel="help"
  href="https://html.spec.whatwg.org/multipage/dnd.html#datatransferitemlist"
/>
<link rel="help" href="https://w3c.github.io/FileAPI/#file-constructor" />
<link
  rel="author"
  title="Benjamin C. Wiley Sittler"
  href="mailto:bsittler@chromium.org"
/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../support/send-file-form-helper.js"></script>
<script>
  "use strict";

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-NUL-[\0].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-NUL-[\0].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-BS-[\b].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-BS-[\b].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-VT-[\v].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-VT-[\v].txt",
  });

  // These have characters that undergo processing in name=,
  // filename=, and/or value; formPostFileUploadTest postprocesses
  // expectedEncodedBaseName for these internally.

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-LF-[\n].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-LF-[\n].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-LF-CR-[\n\r].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-LF-CR-[\n\r].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-CR-[\r].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-CR-[\r].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-CR-LF-[\r\n].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-CR-LF-[\r\n].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-HT-[\t].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-HT-[\t].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-FF-[\f].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-FF-[\f].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-DEL-[\x7F].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-DEL-[\x7F].txt",
  });

  // The rest should be passed through unmodified:

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-ESC-[\x1B].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-ESC-[\x1B].txt",
  });

  formPostFileUploadTest({
    fileNameSource: "ASCII",
    fileBaseName: "file-for-upload-in-form-SPACE-[ ].txt",
    formEncoding: "UTF-8",
    expectedEncodedBaseName: "file-for-upload-in-form-SPACE-[ ].txt",
  });
</script>