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 | |
134 | |
nhiroki
2016/08/18 00:05:43
blank line
jkarlin
2016/08/18 14:08:23
Done.
| |
84 prepopulated_cache_test(simple_entries, function(cache, entries) { | 135 prepopulated_cache_test(simple_entries, function(cache, entries) { |
85 return cache.matchAll(entries.cat.request.url + '#mouse') | 136 return cache.matchAll(entries.cat.request.url + '#mouse') |
86 .then(function(result) { | 137 .then(function(result) { |
87 assert_response_array_equivalent( | 138 assert_response_array_equivalent( |
88 result, | 139 result, |
89 [ | 140 [ |
90 entries.cat.response, | 141 entries.cat.response, |
91 ], | 142 ], |
92 'Cache.matchAll should ignore URL fragment.'); | 143 'Cache.matchAll should ignore URL fragment.'); |
93 }); | 144 }); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 return cache.matchAll('http://example.com/c', | 223 return cache.matchAll('http://example.com/c', |
173 {ignoreVary: true}) | 224 {ignoreVary: true}) |
174 .then(function(result) { | 225 .then(function(result) { |
175 assert_response_array_equivalent( | 226 assert_response_array_equivalent( |
176 result, | 227 result, |
177 [ | 228 [ |
178 entries.vary_cookie_is_cookie.response, | 229 entries.vary_cookie_is_cookie.response, |
179 entries.vary_cookie_is_good.response, | 230 entries.vary_cookie_is_good.response, |
180 entries.vary_cookie_absent.response | 231 entries.vary_cookie_absent.response |
181 ], | 232 ], |
182 'Cache.matchAll should honor "ignoreVary" parameter.'); | 233 'Cache.matchAll should support multiple vary request/response ' + |
234 'pairs.'); | |
183 }); | 235 }); |
184 }, 'Cache.matchAll with "ignoreVary" parameter'); | 236 }, 'Cache.matchAll with multiple vary pairs'); |
185 | 237 |
186 done(); | 238 done(); |
OLD | NEW |