| OLD | NEW |
| 1 if (self.importScripts) { | 1 if (self.importScripts) { |
| 2 importScripts('/resources/testharness.js'); | 2 importScripts('/resources/testharness.js'); |
| 3 importScripts('../resources/test-helpers.js'); | 3 importScripts('../resources/test-helpers.js'); |
| 4 } | 4 } |
| 5 | 5 |
| 6 prepopulated_cache_test(simple_entries, function(cache, entries) { | 6 prepopulated_cache_test(simple_entries, function(cache, entries) { |
| 7 return cache.matchAll('not-present-in-the-cache') | 7 return cache.matchAll('not-present-in-the-cache') |
| 8 .then(function(result) { | 8 .then(function(result) { |
| 9 assert_response_array_equivalent( | 9 assert_response_array_equivalent( |
| 10 result, [], | 10 result, [], |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 [ | 74 [ |
| 75 entries.a.response, | 75 entries.a.response, |
| 76 entries.a_with_query.response | 76 entries.a_with_query.response |
| 77 ], | 77 ], |
| 78 'Cache.matchAll with ignoreSearch should ignore the ' + | 78 'Cache.matchAll with ignoreSearch should ignore the ' + |
| 79 'search parameters of request.'); | 79 'search parameters of request.'); |
| 80 }); | 80 }); |
| 81 }, | 81 }, |
| 82 'Cache.matchAll with ignoreSearch option (request with search parameters)'); | 82 'Cache.matchAll with ignoreSearch option (request with search parameters)'); |
| 83 | 83 |
| 84 cache_test(function(cache) { |
| 85 var request = new Request('http://example.com/'); |
| 86 var head_request = new Request('http://example.com/', {method: 'HEAD'}); |
| 87 var response = new Response('foo'); |
| 88 return cache.put(request.clone(), response.clone()) |
| 89 .then(function() { |
| 90 return cache.matchAll(head_request.clone()); |
| 91 }) |
| 92 .then(function(result) { |
| 93 assert_response_array_equals( |
| 94 result, [], |
| 95 'Cache.matchAll should resolve with empty array for a ' + |
| 96 'mismatched method.'); |
| 97 return cache.matchAll(head_request.clone(), |
| 98 {ignoreMethod: true}); |
| 99 }) |
| 100 .then(function(result) { |
| 101 assert_response_array_equals( |
| 102 result, [response], |
| 103 'Cache.matchAll with ignoreMethod should ignore the ' + |
| 104 'method of request.'); |
| 105 }); |
| 106 }, 'Cache.matchAll supports ignoreMethod'); |
| 107 |
| 108 cache_test(function(cache) { |
| 109 var vary_request = new Request('http://example.com/c', |
| 110 {headers: {'Cookies': 'is-for-cookie'}}); |
| 111 var vary_response = new Response('', {headers: {'Vary': 'Cookies'}}); |
| 112 var mismatched_vary_request = new Request('http://example.com/c'); |
| 113 |
| 114 return cache.put(vary_request.clone(), vary_response.clone()) |
| 115 .then(function() { |
| 116 return cache.matchAll(mismatched_vary_request.clone()); |
| 117 }) |
| 118 .then(function(result) { |
| 119 assert_response_array_equals( |
| 120 result, [], |
| 121 'Cache.matchAll should resolve as undefined with a ' + |
| 122 'mismatched vary.'); |
| 123 return cache.matchAll(mismatched_vary_request.clone(), |
| 124 {ignoreVary: true}); |
| 125 }) |
| 126 .then(function(result) { |
| 127 assert_response_array_equals( |
| 128 result, [vary_response], |
| 129 'Cache.matchAll with ignoreVary should ignore the ' + |
| 130 'vary of request.'); |
| 131 }); |
| 132 }, 'Cache.matchAll supports ignoreVary'); |
| 133 |
| 84 prepopulated_cache_test(simple_entries, function(cache, entries) { | 134 prepopulated_cache_test(simple_entries, function(cache, entries) { |
| 85 return cache.matchAll(entries.cat.request.url + '#mouse') | 135 return cache.matchAll(entries.cat.request.url + '#mouse') |
| 86 .then(function(result) { | 136 .then(function(result) { |
| 87 assert_response_array_equivalent( | 137 assert_response_array_equivalent( |
| 88 result, | 138 result, |
| 89 [ | 139 [ |
| 90 entries.cat.response, | 140 entries.cat.response, |
| 91 ], | 141 ], |
| 92 'Cache.matchAll should ignore URL fragment.'); | 142 'Cache.matchAll should ignore URL fragment.'); |
| 93 }); | 143 }); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 return cache.matchAll('http://example.com/c', | 222 return cache.matchAll('http://example.com/c', |
| 173 {ignoreVary: true}) | 223 {ignoreVary: true}) |
| 174 .then(function(result) { | 224 .then(function(result) { |
| 175 assert_response_array_equivalent( | 225 assert_response_array_equivalent( |
| 176 result, | 226 result, |
| 177 [ | 227 [ |
| 178 entries.vary_cookie_is_cookie.response, | 228 entries.vary_cookie_is_cookie.response, |
| 179 entries.vary_cookie_is_good.response, | 229 entries.vary_cookie_is_good.response, |
| 180 entries.vary_cookie_absent.response | 230 entries.vary_cookie_absent.response |
| 181 ], | 231 ], |
| 182 'Cache.matchAll should honor "ignoreVary" parameter.'); | 232 'Cache.matchAll should support multiple vary request/response ' + |
| 233 'pairs.'); |
| 183 }); | 234 }); |
| 184 }, 'Cache.matchAll with "ignoreVary" parameter'); | 235 }, 'Cache.matchAll with multiple vary pairs'); |
| 185 | 236 |
| 186 done(); | 237 done(); |
| OLD | NEW |