| OLD | NEW |
| 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 Loading... |
| 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(); |
| OLD | NEW |