Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: third_party/WebKit/LayoutTests/fast/files/blob-reading-from-form-file.html

Issue 2710033003: Add unknown file size handling in ComplexFormDataBytesConsumer (Closed)
Patch Set: fix Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/filesystem/form-reading-from-file.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/files/blob-reading-from-form-file.html
diff --git a/third_party/WebKit/LayoutTests/fast/files/blob-reading-from-form-file.html b/third_party/WebKit/LayoutTests/fast/files/blob-reading-from-form-file.html
new file mode 100644
index 0000000000000000000000000000000000000000..ae4f61c6e3258a096634c2d727730d204bccb126
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/files/blob-reading-from-form-file.html
@@ -0,0 +1,52 @@
+<form id="form">
+ <input id="file" multiple type="file" name="file">
+</form>
+
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script type="text/javascript">
+
+promise_test((t) => {
+ eventSender.beginDragWithFiles(
+ ['resources/UTF8.txt', 'resources/UTF8-2.txt']);
+ eventSender.mouseMoveTo(10, 10);
+ eventSender.mouseUp();
+
+ var form = document.getElementById('form');
+ var formData = new FormData(form);
+ var request = new Request('/', {
+ method: 'POST',
+ body: formData
+ });
+ return request.text().then(text => {
+ assert_true(text.search('WebKitFormBoundary') > 0,
+ 'the boundary is contained');
+ assert_true(text.search('Hello') > 0, 'UTF8.txt is contained');
+ assert_true(text.search('Wonderful') > 0, 'UTF8-2.txt is contained');
+ });
+}, "Reading a text from form files.");
+
+
+promise_test((t) => {
+ eventSender.beginDragWithFiles(['resources/UTF8.txt']);
+ eventSender.mouseMoveTo(10, 10);
+ eventSender.mouseUp();
+
+ var file = document.getElementById('file');
+ var formData = new FormData();
+ formData.append('file', file.files[0]);
+ assert_equals(file.files[0].size, 5, 'file size');
+ var request = new Request('/', {
+ method: 'POST',
+ body: formData
+ });
+ return request.text().then(text => {
+ assert_true(text.search('WebKitFormBoundary') > 0,
+ 'the boundary is contained');
+ assert_true(text.search('Hello') > 0, 'UTF8.txt is contained');
+ assert_true(text.search('Wonderful') < 0, 'UTF8-2.txt is not contained');
+ });
+}, "Reading a text from a generated form data.");
+
+</script>
+
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/filesystem/form-reading-from-file.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698