Chromium Code Reviews| 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 9cd67290e28792a24144c8bca5219acfa0316bcd..b27223b2bc97f7cc697bb50ff5452aa86fa549a1 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 |
| @@ -335,11 +335,10 @@ 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' + |
| - 'body.'); |
| + assert_false(req.bodyUsed, |
| + 'Request should not be flagged as used if it does not have' + |
|
hiroshige
2015/11/19 12:50:36
nit: ' ' at end of the string (current: 'does not
yhirano
2015/11/19 13:19:03
Done.
|
| + 'body.'); |
| assert_false(req2.bodyUsed, |
| 'Request should not be flagged as used if it has not been ' + |
| 'consumed.'); |
| @@ -479,6 +478,13 @@ promise_test(function() { |
| }); |
| }, 'Request of GET/HEAD method cannot have RequestInit body.'); |
| +test(() => { |
| + var req = new Request(URL, {method: 'POST', body: 'hello'}); |
| + req.text(); |
| + assert_true(req.bodyUsed); |
| + assert_throws({name: 'TypeError'}, () => { req.clone(); }); |
| + }, 'Used => clone'); |
| + |
| promise_test(function() { |
| var headers = new Headers; |
| headers.set('Content-Language', 'ja'); |
| @@ -488,6 +494,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', |
| @@ -499,13 +507,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.'); |
| @@ -662,9 +663,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'); |
| @@ -732,17 +730,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(); |