| 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 cache.put(request, new Response(test_body)), | 305 cache.put(request, new Response(test_body)), |
| 306 new TypeError(), | 306 new TypeError(), |
| 307 'Cache.put should throw a TypeError for a request with used body.'); | 307 'Cache.put should throw a TypeError for a request with used body.'); |
| 308 }, 'Cache.put with a used request body'); | 308 }, 'Cache.put with a used request body'); |
| 309 | 309 |
| 310 cache_test(function(cache) { | 310 cache_test(function(cache) { |
| 311 var response = new Response(test_body); | 311 var response = new Response(test_body); |
| 312 assert_false(response.bodyUsed, | 312 assert_false(response.bodyUsed, |
| 313 '[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' + | 313 '[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' + |
| 314 'Response.bodyUsed should be initially false.'); | 314 'Response.bodyUsed should be initially false.'); |
| 315 response.text().then(function() { | 315 return response.text().then(function() { |
| 316 assert_true( | 316 assert_false( |
| 317 response.bodyUsed, | 317 response.bodyUsed, |
| 318 '[https://fetch.spec.whatwg.org/#concept-body-consume-body] ' + | 318 '[https://fetch.spec.whatwg.org/#concept-body-consume-body] ' + |
| 319 'The text() method should consume the body of the response.'); | 319 'The text() method should not set "body passed" flag.'); |
| 320 return assert_promise_rejects( | 320 return cache.put(new Request(test_url), response); |
| 321 cache.put(new Request(test_url), response), | |
| 322 new TypeError(), | |
| 323 'Cache.put should throw a TypeError for a response with used body.'); | |
| 324 }); | 321 }); |
| 325 }, 'Cache.put with a used response body'); | 322 }, 'Cache.put with a used response body'); |
| 326 | 323 |
| 327 done(); | 324 done(); |
| OLD | NEW |