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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js

Issue 2292763002: [Fetch API] Implement Request.formData and Response.formData. (Closed)
Patch Set: More global-interface-listing*-expected.txt, urlencoded-parser-expected.txt Created 3 years, 7 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
Index: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js
index 078afab5c8ad91752021a0c62b62a9a71192dfd3..852c726bc42c971777988138aa1358dbb1ac7161 100644
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js
@@ -103,6 +103,25 @@ promise_test(function(test) {
.then(function(res) {
response = res;
assert_false(response.bodyUsed);
+ var p = response.formData();
+ assert_true(response.bodyUsed);
+ assert_true(isLocked(response.body));
+ return p;
+ })
+ .then(
+ unreached_fulfillment(test),
+ function(e) {
+ assert_true(isLocked(response.body));
+ assert_equals(e.name, 'TypeError', 'expected MIME type error');
+ })
+ }, 'FormDataFailedTest');
+
+promise_test(function(test) {
+ var response;
+ return fetch('/fetch/resources/doctype.html')
+ .then(function(res) {
+ response = res;
+ assert_false(response.bodyUsed);
var p = response.json();
assert_true(response.bodyUsed);
assert_true(isLocked(response.body));
@@ -245,6 +264,14 @@ promise_test(t => {
promise_test(t => {
var res = new Response('');
res.body.cancel();
+ return res.formData().then(unreached_fulfillment(t), e => {
+ assert_equals(e.name, 'TypeError');
+ });
+ }, 'Used => formData');
+
+promise_test(t => {
+ var res = new Response('');
+ res.body.cancel();
return res.json().then(unreached_fulfillment(t), e => {
assert_equals(e.name, 'TypeError');
});
@@ -280,6 +307,15 @@ promise_test(t => {
promise_test(t => {
var res = new Response('');
const reader = res.body.getReader();
+ return res.formData().then(unreached_fulfillment(t), e => {
+ reader.releaseLock();
+ assert_equals(e.name, 'TypeError');
+ });
+ }, 'Locked => formData');
+
+promise_test(t => {
+ var res = new Response('');
+ const reader = res.body.getReader();
return res.json().then(unreached_fulfillment(t), e => {
reader.releaseLock();
assert_equals(e.name, 'TypeError');

Powered by Google App Engine
This is Rietveld 408576698