Commit 2e6a737d authored by Benjamin C. Wiley Sittler's avatar Benjamin C. Wiley Sittler Committed by Commit Bot

WPT: Add form-based file upload coverage

Tests multipart form POSTs with file inputs where the selected "file"
was constructed using the `File` constructor and added to a
`DataTransferItemList` (this avoids the user gesture requirement which
otherwise would consign this to manual testing.) For the non-ASCII
filenames with non-UTF-8 accept-charsets this also verifies fallback
encoding/replacement of unrepresentable characters using numeric
character references. https://github.com/whatwg/html/issues/2861

Coverage for fallback encoding is still tentative because filename
fallback encoding is not yet standardized.
https://github.com/whatwg/html/issues/3223

Bug: 661819
Change-Id: Ic646f76b0c8a0792d1214a7848d2238bcc3a76e7
Reviewed-on: https://chromium-review.googlesource.com/811625Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Reviewed-by: default avatarJoshua Bell <jsbell@chromium.org>
Commit-Queue: Benjamin Wiley Sittler <bsittler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522197}
parent 0786d3ba
<!DOCTYPE html>
<meta charset="utf-8">
<title>Upload files in ISO-2022-JP form</title>
<title>Upload files in ISO-2022-JP form (tentative)</title>
<!--
NOTE: This test is tentative because encoding for filename
characters unrepresentable in the form charset is not yet
standardized.
-->
<link rel="help"
href="https://github.com/whatwg/html/issues/3223">
<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="resources/send-file-form-helper.js"></script>
<script src="../support/send-file-form-helper.js"></script>
<script>
'use strict';
......
......@@ -3,11 +3,15 @@
<title>Upload files in UTF-8 form</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="resources/send-file-form-helper.js"></script>
<script src="../support/send-file-form-helper.js"></script>
<script>
'use strict';
......
<!DOCTYPE html>
<meta charset="utf-8">
<title>Upload files in Windows-1252 form</title>
<title>Upload files in Windows-1252 form (tentative)</title>
<!--
NOTE: This test is tentative because encoding for filename
characters unrepresentable in the form charset is not yet
standardized.
-->
<link rel="help"
href="https://github.com/whatwg/html/issues/3223">
<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="resources/send-file-form-helper.js"></script>
<script src="../support/send-file-form-helper.js"></script>
<script>
'use strict';
......
<!DOCTYPE html>
<meta charset="utf-8">
<title>Upload files in x-user-defined form</title>
<title>Upload files in x-user-defined form (tentative)</title>
<!--
NOTE: This test is tentative because encoding for filename
characters unrepresentable in the form charset is not yet
standardized.
-->
<link rel="help"
href="https://github.com/whatwg/html/issues/3223">
<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="resources/send-file-form-helper.js"></script>
<script src="../support/send-file-form-helper.js"></script>
<script>
'use strict';
......
......@@ -3,11 +3,15 @@
<title>Upload ASCII-named file in UTF-8 form</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="resources/send-file-form-helper.js"></script>
<script src="../support/send-file-form-helper.js"></script>
<script>
'use strict';
......
......@@ -97,7 +97,7 @@ const kTestFallbackXUserDefined =
// numeric character reference replacement for filenames, field names,
// and field values.
//
// Uses /xmlhttprequest/resources/post-echo.cgi to echo the upload
// Uses /fetch/api/resources/echo-content.py to echo the upload
// POST with UTF-8 byte interpretation, leading to the "UTF-8 goggles"
// behavior documented below for expectedEncodedBaseName when non-
// UTF-8-compatible byte sequences appear in the formEncoding-encoded
......@@ -140,7 +140,7 @@ const formPostFileUploadTest = ({
const form = Object.assign(document.createElement('form'), {
acceptCharset: formEncoding,
action: '/xmlhttprequest/resources/post-echo.cgi',
action: '/fetch/api/resources/echo-content.py',
method: 'POST',
enctype: 'multipart/form-data',
target: formTargetFrame.name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment