| 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 prepopulated_cache_test(simple_entries, function(cache, entries) { | 7 prepopulated_cache_test(simple_entries, function(cache, entries) { |
| 8 return cache.match('not-present-in-the-cache') | 8 return cache.match('not-present-in-the-cache') |
| 9 .then(function(result) { | 9 .then(function(result) { |
| 10 assert_equals(result, undefined, | 10 assert_equals(result, undefined, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 prepopulated_cache_test(simple_entries, function(cache, entries) { | 23 prepopulated_cache_test(simple_entries, function(cache, entries) { |
| 24 return cache.match(entries.a.request) | 24 return cache.match(entries.a.request) |
| 25 .then(function(result) { | 25 .then(function(result) { |
| 26 assert_response_equals(result, entries.a.response, | 26 assert_response_equals(result, entries.a.response, |
| 27 'Cache.match should match by Request.'); | 27 'Cache.match should match by Request.'); |
| 28 }); | 28 }); |
| 29 }, 'Cache.match with Request'); | 29 }, 'Cache.match with Request'); |
| 30 | 30 |
| 31 prepopulated_cache_test(simple_entries, function(cache, entries) { | 31 prepopulated_cache_test(simple_entries, function(cache, entries) { |
| 32 var alt_response = new Response('', {status: 201}); |
| 33 |
| 34 return self.caches.open('second_matching_cache') |
| 35 .then(function(cache) { |
| 36 return cache.put(entries.a.request, alt_response.clone()); |
| 37 }) |
| 38 .then(function() { |
| 39 return cache.match(entries.a.request) |
| 40 }) |
| 41 .then(function(result) { |
| 42 assert_response_equals( |
| 43 result, entries.a.response, |
| 44 'Cache.match should match the first cache.'); |
| 45 }); |
| 46 }, 'Cache.match with multiple cache hits'); |
| 47 |
| 48 prepopulated_cache_test(simple_entries, function(cache, entries) { |
| 32 return cache.match(new Request(entries.a.request.url)) | 49 return cache.match(new Request(entries.a.request.url)) |
| 33 .then(function(result) { | 50 .then(function(result) { |
| 34 assert_response_equals(result, entries.a.response, | 51 assert_response_equals(result, entries.a.response, |
| 35 'Cache.match should match by Request.'); | 52 'Cache.match should match by Request.'); |
| 36 }); | 53 }); |
| 37 }, 'Cache.match with new Request'); | 54 }, 'Cache.match with new Request'); |
| 38 | 55 |
| 39 prepopulated_cache_test(simple_entries, function(cache, entries) { | 56 prepopulated_cache_test(simple_entries, function(cache, entries) { |
| 40 return cache.match(entries.a.request, | 57 return cache.match(entries.a.request, |
| 41 {ignoreSearch: true}) | 58 {ignoreSearch: true}) |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 return cache.match(entries.error_response.request.url) | 231 return cache.match(entries.error_response.request.url) |
| 215 .then(function(result) { | 232 .then(function(result) { |
| 216 assert_response_equals( | 233 assert_response_equals( |
| 217 result, entries.error_response.response, | 234 result, entries.error_response.response, |
| 218 'Cache.match should return a Response object that has the ' + | 235 'Cache.match should return a Response object that has the ' + |
| 219 'same properties as a stored network error response.'); | 236 'same properties as a stored network error response.'); |
| 220 }); | 237 }); |
| 221 }, 'Cache.match with a network error Response'); | 238 }, 'Cache.match with a network error Response'); |
| 222 | 239 |
| 223 done(); | 240 done(); |
| OLD | NEW |