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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-put.js

Issue 1418813004: [Fetch API] Reflect spec changes of bodyUsed property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 if (self.importScripts) { 1 if (self.importScripts) {
2 importScripts('/resources/testharness.js'); 2 importScripts('/resources/testharness.js');
3 importScripts('/resources/testharness-helpers.js'); 3 importScripts('/resources/testharness-helpers.js');
4 importScripts('../resources/test-helpers.js'); 4 importScripts('../resources/test-helpers.js');
5 } 5 }
6 6
7 var test_url = 'https://example.com/foo'; 7 var test_url = 'https://example.com/foo';
8 var test_body = 'Hello world!'; 8 var test_body = 'Hello world!';
9 9
10 cache_test(function(cache) { 10 cache_test(function(cache) {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 new TypeError(), 276 new TypeError(),
277 'Cache.put should throw a TypeError for a POST request.'); 277 'Cache.put should throw a TypeError for a POST request.');
278 }, 'Cache.put with a POST request'); 278 }, 'Cache.put with a POST request');
279 279
280 cache_test(function(cache) { 280 cache_test(function(cache) {
281 var response = new Response(test_body); 281 var response = new Response(test_body);
282 assert_false(response.bodyUsed, 282 assert_false(response.bodyUsed,
283 '[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' + 283 '[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' +
284 'Response.bodyUsed should be initially false.'); 284 'Response.bodyUsed should be initially false.');
285 return response.text().then(function() { 285 return response.text().then(function() {
286 assert_false( 286 assert_true(
287 response.bodyUsed, 287 response.bodyUsed,
288 '[https://fetch.spec.whatwg.org/#concept-body-consume-body] ' + 288 '[https://fetch.spec.whatwg.org/#concept-body-consume-body] ' +
289 'The text() method should not set "body passed" flag.'); 289 'The text() method should make the body disturbed.');
290 return cache.put(new Request(test_url), response); 290 var request = new Request(test_url);
291 return cache.put(request, response).then(() => {
292 assert_unreached('cache.put should be rejected');
293 }, () => {});
291 }); 294 });
292 }, 'Cache.put with a used response body'); 295 }, 'Cache.put with a used response body');
293 296
294 cache_test(function(cache) { 297 cache_test(function(cache) {
295 var response = new Response(test_body); 298 var response = new Response(test_body);
296 return cache.put(new Request(test_url), response) 299 return cache.put(new Request(test_url), response)
297 .then(function() { 300 .then(function() {
298 return response.body.getReader().closed; 301 assert_throws(new TypeError(), () => response.body.getReader());
299 }); 302 });
300 }, 'getReader() after Cache.put'); 303 }, 'getReader() after Cache.put');
301 304
302 done(); 305 done();
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/body-mixin.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698