| OLD | NEW |
| 1 importScripts('worker-testharness.js'); | 1 importScripts('worker-testharness.js'); |
| 2 importScripts('/resources/testharness-helpers.js'); | 2 importScripts('/resources/testharness-helpers.js'); |
| 3 | 3 |
| 4 var test_url = 'https://example.com/foo'; | 4 var test_url = 'https://example.com/foo'; |
| 5 | 5 |
| 6 // Construct a generic Request object. The URL is |test_url|. All other fields | 6 // Construct a generic Request object. The URL is |test_url|. All other fields |
| 7 // are defaults. | 7 // are defaults. |
| 8 function new_test_request() { | 8 function new_test_request() { |
| 9 return new Request(test_url); | 9 return new Request(test_url); |
| 10 } | 10 } |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 return cache.match(new URL('relative-url', location.href).href); | 185 return cache.match(new URL('relative-url', location.href).href); |
| 186 }) | 186 }) |
| 187 .then(function(result) { | 187 .then(function(result) { |
| 188 assert_object_equals(result, response, | 188 assert_object_equals(result, response, |
| 189 'Cache.put should accept a relative URL ' + | 189 'Cache.put should accept a relative URL ' + |
| 190 'as the request.'); | 190 'as the request.'); |
| 191 }); | 191 }); |
| 192 }, 'Cache.put with a relative URL'); | 192 }, 'Cache.put with a relative URL'); |
| 193 | 193 |
| 194 cache_test(function(cache) { | 194 cache_test(function(cache) { |
| 195 var request = new Request('http://example.com/foo', {method: 'get'}); | |
| 196 return assert_promise_rejects( | |
| 197 cache.put(request, new_test_response()), | |
| 198 new TypeError(), | |
| 199 'Cache.put should throw a TypeError for non-GET requests.'); | |
| 200 }, 'Cache.put with a non-GET request'); | |
| 201 | |
| 202 cache_test(function(cache) { | |
| 203 var request = new Request('http://example.com/foo', {method: 'HEAD'}); | 195 var request = new Request('http://example.com/foo', {method: 'HEAD'}); |
| 204 return assert_promise_rejects( | 196 return assert_promise_rejects( |
| 205 cache.put(request, new_test_response()), | 197 cache.put(request, new_test_response()), |
| 206 new TypeError(), | 198 new TypeError(), |
| 207 'Cache.put should throw a TypeError for non-GET requests.'); | 199 'Cache.put should throw a TypeError for non-GET requests.'); |
| 208 }, 'Cache.put with a non-GET request'); | 200 }, 'Cache.put with a non-GET request'); |
| 209 | 201 |
| 210 cache_test(function(cache) { | 202 cache_test(function(cache) { |
| 211 return assert_promise_rejects( | 203 return assert_promise_rejects( |
| 212 cache.put(new_test_request(), null), | 204 cache.put(new_test_request(), null), |
| 213 new TypeError(), | 205 new TypeError(), |
| 214 'Cache.put should throw a TypeError for an empty response.'); | 206 'Cache.put should throw a TypeError for an empty response.'); |
| 215 }, 'Cache.put with an empty response'); | 207 }, 'Cache.put with an empty response'); |
| OLD | NEW |