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

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

Issue 1418813004: [Fetch API] Reflect spec changes of bodyUsed property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 1 month 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/request.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js
index f8dd8e83067e2f04fb1cbbd42cf0b6f078f5f308..9d410ddc88ce3e827a6c33142ce52a6175501ad5 100644
--- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js
+++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js
@@ -322,10 +322,9 @@ test(function() {
assert_false(req.bodyUsed,
'Request should not be flagged as used if it has not been ' +
'consumed.');
- // See https://crbug.com/501195.
var req2 = new Request(req);
- assert_true(req.bodyUsed,
- 'Request should be flagged as used if it does not have' +
+ assert_false(req.bodyUsed,
+ 'Request should not be flagged as used if it does not have' +
tyoshino (SeeGerritForStatus) 2015/11/18 09:55:36 indent
yhirano 2015/11/19 08:41:29 Done.
'body.');
assert_false(req2.bodyUsed,
'Request should not be flagged as used if it has not been ' +
@@ -475,6 +474,8 @@ promise_test(function() {
body: new Blob(['Test Blob'], {type: 'test/type'})
});
var req2 = req.clone();
+ assert_false(req.bodyUsed);
+ assert_false(req2.bodyUsed);
// Change headers and of original request.
req.headers.set('Content-Language', 'en');
assert_equals(req2.headers.get('Content-Language'), 'ja',
@@ -486,13 +487,6 @@ promise_test(function() {
return req2.text();
}).then(function(text) {
assert_equals(text, 'Test Blob', 'Cloned request body should match.');
- return Promise.all([req.text(), req2.text()]);
- }).then(function(texts) {
- assert_equals(texts[0], '', 'The body is consumed.');
- assert_equals(texts[1], '', 'The body is consumed.');
- return req.clone().text();
- }).then(function(text) {
- assert_equals(text, '', 'The body was consumed before cloned.');
});
}, 'Test clone behavior with loading content from Request.');
@@ -649,9 +643,6 @@ promise_test(function(t) {
.then(function(blob) {
assert_equals(blob.type, 'text/plain');
assert_equals(req.headers.get('Content-Type'), 'text/plain');
- return new Request(req).blob();
- }).then(function(blob) {
- assert_equals(blob.type, 'text/plain');
});
}, 'MIME type for Blob with non-empty type');
@@ -719,17 +710,4 @@ promise_test(function(t) {
});
}, 'Extract a MIME type (1)');
-promise_test(function(t) {
- var req = new Request('http://localhost/', {method: 'POST', body: 'hello'});
- return req.text().then(function(text) {
- assert_equals(text, 'hello');
- var req2 = new Request(req);
- assert_true(req.bodyUsed);
- assert_false(req2.bodyUsed);
- return req2.text();
- }).then(function(text) {
- assert_equals(text, '');
- });
- }, 'Consume and pass');
-
done();

Powered by Google App Engine
This is Rietveld 408576698