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 // A set of Request/Response pairs to be used with prepopulated_cache_test(). | 7 // A set of Request/Response pairs to be used with prepopulated_cache_test(). |
8 var simple_entries = [ | 8 var simple_entries = [ |
9 { | 9 { |
10 name: 'a', | 10 name: 'a', |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 request: new Request('http://example.com/c', | 121 request: new Request('http://example.com/c', |
122 {headers: {'Cookies': 'x', 'X-Key': '1'}}), | 122 {headers: {'Cookies': 'x', 'X-Key': '1'}}), |
123 response: new Response('', | 123 response: new Response('', |
124 {headers: {'Vary': '*'}}) | 124 {headers: {'Vary': '*'}}) |
125 } | 125 } |
126 ]; | 126 ]; |
127 | 127 |
128 prepopulated_cache_test(simple_entries, function(cache, entries) { | 128 prepopulated_cache_test(simple_entries, function(cache, entries) { |
129 return cache.matchAll('not-present-in-the-cache') | 129 return cache.matchAll('not-present-in-the-cache') |
130 .then(function(result) { | 130 .then(function(result) { |
131 assert_array_equivalent( | 131 assert_response_array_equivalent( |
132 result, [], | 132 result, [], |
133 'Cache.matchAll should resolve with an empty array on failure.'); | 133 'Cache.matchAll should resolve with an empty array on failure.'); |
134 }); | 134 }); |
135 }, 'Cache.matchAll with no matching entries'); | 135 }, 'Cache.matchAll with no matching entries'); |
136 | 136 |
137 prepopulated_cache_test(simple_entries, function(cache, entries) { | 137 prepopulated_cache_test(simple_entries, function(cache, entries) { |
138 return cache.match('not-present-in-the-cache') | 138 return cache.match('not-present-in-the-cache') |
139 .then(function(result) { | 139 .then(function(result) { |
140 assert_equals(result, undefined, | 140 assert_equals(result, undefined, |
141 'Cache.match failures should resolve with undefined.'); | 141 'Cache.match failures should resolve with undefined.'); |
142 }); | 142 }); |
143 }, 'Cache.match with no matching entries'); | 143 }, 'Cache.match with no matching entries'); |
144 | 144 |
145 prepopulated_cache_test(simple_entries, function(cache, entries) { | 145 prepopulated_cache_test(simple_entries, function(cache, entries) { |
146 return cache.matchAll(entries.a.request.url) | 146 return cache.matchAll(entries.a.request.url) |
147 .then(function(result) { | 147 .then(function(result) { |
148 assert_array_equivalent(result, [entries.a.response], | 148 assert_response_array_equivalent(result, [entries.a.response], |
149 'Cache.matchAll should match by URL.'); | 149 'Cache.matchAll should match by URL.'); |
150 }); | 150 }); |
151 }, 'Cache.matchAll with URL'); | 151 }, 'Cache.matchAll with URL'); |
152 | 152 |
153 prepopulated_cache_test(simple_entries, function(cache, entries) { | 153 prepopulated_cache_test(simple_entries, function(cache, entries) { |
154 return cache.match(entries.a.request.url) | 154 return cache.match(entries.a.request.url) |
155 .then(function(result) { | 155 .then(function(result) { |
156 assert_object_equals_fixed(result, entries.a.response, | 156 assert_response_equals(result, entries.a.response, |
157 'Cache.match should match by URL.'); | 157 'Cache.match should match by URL.'); |
158 }); | 158 }); |
159 }, 'Cache.match with URL'); | 159 }, 'Cache.match with URL'); |
160 | 160 |
161 prepopulated_cache_test(simple_entries, function(cache, entries) { | 161 prepopulated_cache_test(simple_entries, function(cache, entries) { |
162 return cache.matchAll(entries.a.request) | 162 return cache.matchAll(entries.a.request) |
163 .then(function(result) { | 163 .then(function(result) { |
164 assert_array_equivalent(result, [entries.a.response], | 164 assert_response_array_equivalent(result, [entries.a.response], |
165 'Cache.matchAll should match by Request.'); | 165 'Cache.matchAll should match by Request.'); |
166 }); | 166 }); |
167 }, 'Cache.matchAll with Request'); | 167 }, 'Cache.matchAll with Request'); |
168 | 168 |
169 prepopulated_cache_test(simple_entries, function(cache, entries) { | 169 prepopulated_cache_test(simple_entries, function(cache, entries) { |
170 return cache.match(entries.a.request) | 170 return cache.match(entries.a.request) |
171 .then(function(result) { | 171 .then(function(result) { |
172 assert_object_equals_fixed(result, entries.a.response, | 172 assert_response_equals(result, entries.a.response, |
173 'Cache.match should match by Request.'); | 173 'Cache.match should match by Request.'); |
174 }); | 174 }); |
175 }, 'Cache.match with Request'); | 175 }, 'Cache.match with Request'); |
176 | 176 |
177 prepopulated_cache_test(simple_entries, function(cache, entries) { | 177 prepopulated_cache_test(simple_entries, function(cache, entries) { |
178 return cache.matchAll(new Request(entries.a.request.url)) | 178 return cache.matchAll(new Request(entries.a.request.url)) |
179 .then(function(result) { | 179 .then(function(result) { |
180 assert_array_equivalent(result, [entries.a.response], | 180 assert_response_array_equivalent(result, [entries.a.response], |
181 'Cache.matchAll should match by Request.'); | 181 'Cache.matchAll should match by Request.'); |
182 }); | 182 }); |
183 }, 'Cache.matchAll with new Request'); | 183 }, 'Cache.matchAll with new Request'); |
184 | 184 |
185 prepopulated_cache_test(simple_entries, function(cache, entries) { | 185 prepopulated_cache_test(simple_entries, function(cache, entries) { |
186 return cache.match(new Request(entries.a.request.url)) | 186 return cache.match(new Request(entries.a.request.url)) |
187 .then(function(result) { | 187 .then(function(result) { |
188 assert_object_equals_fixed(result, entries.a.response, | 188 assert_response_equals(result, entries.a.response, |
189 'Cache.match should match by Request.'); | 189 'Cache.match should match by Request.'); |
190 }); | 190 }); |
191 }, 'Cache.match with new Request'); | 191 }, 'Cache.match with new Request'); |
192 | 192 |
193 prepopulated_cache_test(simple_entries, function(cache, entries) { | 193 prepopulated_cache_test(simple_entries, function(cache, entries) { |
194 return cache.matchAll(entries.a.request, | 194 return cache.matchAll(entries.a.request, |
195 {ignoreSearch: true}) | 195 {ignoreSearch: true}) |
196 .then(function(result) { | 196 .then(function(result) { |
197 assert_array_equivalent( | 197 assert_response_array_equivalent( |
198 result, | 198 result, |
199 [ | 199 [ |
200 entries.a.response, | 200 entries.a.response, |
201 entries.a_with_query.response | 201 entries.a_with_query.response |
202 ], | 202 ], |
203 'Cache.matchAll with ignoreSearch should ignore the ' + | 203 'Cache.matchAll with ignoreSearch should ignore the ' + |
204 'search parameters of cached request.'); | 204 'search parameters of cached request.'); |
205 }); | 205 }); |
206 }, | 206 }, |
207 'Cache.matchAll with ignoreSearch option (request with no search ' + | 207 'Cache.matchAll with ignoreSearch option (request with no search ' + |
208 'parameters)'); | 208 'parameters)'); |
209 | 209 |
210 prepopulated_cache_test(simple_entries, function(cache, entries) { | 210 prepopulated_cache_test(simple_entries, function(cache, entries) { |
211 return cache.match(entries.a.request, | 211 return cache.match(entries.a.request, |
212 {ignoreSearch: true}) | 212 {ignoreSearch: true}) |
213 .then(function(result) { | 213 .then(function(result) { |
214 assert_object_in_array( | 214 assert_response_in_array( |
215 result, | 215 result, |
216 [ | 216 [ |
217 entries.a.response, | 217 entries.a.response, |
218 entries.a_with_query.response | 218 entries.a_with_query.response |
219 ], | 219 ], |
220 'Cache.match with ignoreSearch should ignore the ' + | 220 'Cache.match with ignoreSearch should ignore the ' + |
221 'search parameters of cached request.'); | 221 'search parameters of cached request.'); |
222 }); | 222 }); |
223 }, | 223 }, |
224 'Cache.match with ignoreSearch option (request with no search ' + | 224 'Cache.match with ignoreSearch option (request with no search ' + |
225 'parameters)'); | 225 'parameters)'); |
226 | 226 |
227 prepopulated_cache_test(simple_entries, function(cache, entries) { | 227 prepopulated_cache_test(simple_entries, function(cache, entries) { |
228 return cache.matchAll(entries.a_with_query.request, | 228 return cache.matchAll(entries.a_with_query.request, |
229 {ignoreSearch: true}) | 229 {ignoreSearch: true}) |
230 .then(function(result) { | 230 .then(function(result) { |
231 assert_array_equivalent( | 231 assert_response_array_equivalent( |
232 result, | 232 result, |
233 [ | 233 [ |
234 entries.a.response, | 234 entries.a.response, |
235 entries.a_with_query.response | 235 entries.a_with_query.response |
236 ], | 236 ], |
237 'Cache.matchAll with ignoreSearch should ignore the ' + | 237 'Cache.matchAll with ignoreSearch should ignore the ' + |
238 'search parameters of request.'); | 238 'search parameters of request.'); |
239 }); | 239 }); |
240 }, | 240 }, |
241 'Cache.matchAll with ignoreSearch option (request with search parameter)'); | 241 'Cache.matchAll with ignoreSearch option (request with search parameter)'); |
242 | 242 |
243 prepopulated_cache_test(simple_entries, function(cache, entries) { | 243 prepopulated_cache_test(simple_entries, function(cache, entries) { |
244 return cache.match(entries.a_with_query.request, | 244 return cache.match(entries.a_with_query.request, |
245 {ignoreSearch: true}) | 245 {ignoreSearch: true}) |
246 .then(function(result) { | 246 .then(function(result) { |
247 assert_object_in_array( | 247 assert_response_in_array( |
248 result, | 248 result, |
249 [ | 249 [ |
250 entries.a.response, | 250 entries.a.response, |
251 entries.a_with_query.response | 251 entries.a_with_query.response |
252 ], | 252 ], |
253 'Cache.match with ignoreSearch should ignore the ' + | 253 'Cache.match with ignoreSearch should ignore the ' + |
254 'search parameters of request.'); | 254 'search parameters of request.'); |
255 }); | 255 }); |
256 }, | 256 }, |
257 'Cache.match with ignoreSearch option (request with search parameter)'); | 257 'Cache.match with ignoreSearch option (request with search parameter)'); |
258 | 258 |
259 prepopulated_cache_test(simple_entries, function(cache, entries) { | 259 prepopulated_cache_test(simple_entries, function(cache, entries) { |
260 return cache.matchAll(entries.cat.request.url + '#mouse') | 260 return cache.matchAll(entries.cat.request.url + '#mouse') |
261 .then(function(result) { | 261 .then(function(result) { |
262 assert_array_equivalent( | 262 assert_response_array_equivalent( |
263 result, | 263 result, |
264 [ | 264 [ |
265 entries.cat.response, | 265 entries.cat.response, |
266 ], | 266 ], |
267 'Cache.matchAll should ignore URL fragment.'); | 267 'Cache.matchAll should ignore URL fragment.'); |
268 }); | 268 }); |
269 }, 'Cache.matchAll with URL containing fragment'); | 269 }, 'Cache.matchAll with URL containing fragment'); |
270 | 270 |
271 prepopulated_cache_test(simple_entries, function(cache, entries) { | 271 prepopulated_cache_test(simple_entries, function(cache, entries) { |
272 return cache.match(entries.cat.request.url + '#mouse') | 272 return cache.match(entries.cat.request.url + '#mouse') |
273 .then(function(result) { | 273 .then(function(result) { |
274 assert_object_equals_fixed(result, entries.cat.response, | 274 assert_response_equals(result, entries.cat.response, |
275 'Cache.match should ignore URL fragment.'); | 275 'Cache.match should ignore URL fragment.'); |
276 }); | 276 }); |
277 }, 'Cache.match with URL containing fragment'); | 277 }, 'Cache.match with URL containing fragment'); |
278 | 278 |
279 prepopulated_cache_test(simple_entries, function(cache, entries) { | 279 prepopulated_cache_test(simple_entries, function(cache, entries) { |
280 return cache.matchAll('http') | 280 return cache.matchAll('http') |
281 .then(function(result) { | 281 .then(function(result) { |
282 assert_array_equivalent( | 282 assert_response_array_equivalent( |
283 result, [], | 283 result, [], |
284 'Cache.matchAll should treat query as a URL and not ' + | 284 'Cache.matchAll should treat query as a URL and not ' + |
285 'just a string fragment.'); | 285 'just a string fragment.'); |
286 }); | 286 }); |
287 }, 'Cache.matchAll with string fragment "http" as query'); | 287 }, 'Cache.matchAll with string fragment "http" as query'); |
288 | 288 |
289 prepopulated_cache_test(simple_entries, function(cache, entries) { | 289 prepopulated_cache_test(simple_entries, function(cache, entries) { |
290 return cache.match('http') | 290 return cache.match('http') |
291 .then(function(result) { | 291 .then(function(result) { |
292 assert_equals( | 292 assert_equals( |
293 result, undefined, | 293 result, undefined, |
294 'Cache.match should treat query as a URL and not ' + | 294 'Cache.match should treat query as a URL and not ' + |
295 'just a string fragment.'); | 295 'just a string fragment.'); |
296 }); | 296 }); |
297 }, 'Cache.match with string fragment "http" as query'); | 297 }, 'Cache.match with string fragment "http" as query'); |
298 | 298 |
299 prepopulated_cache_test(simple_entries, function(cache, entries) { | 299 prepopulated_cache_test(simple_entries, function(cache, entries) { |
300 return cache.matchAll(entries.secret_cat.request.url) | 300 return cache.matchAll(entries.secret_cat.request.url) |
301 .then(function(result) { | 301 .then(function(result) { |
302 assert_array_equivalent( | 302 assert_response_array_equivalent( |
303 result, [entries.secret_cat.response], | 303 result, [entries.secret_cat.response], |
304 'Cache.matchAll should not ignore embedded credentials'); | 304 'Cache.matchAll should not ignore embedded credentials'); |
305 }); | 305 }); |
306 }, 'Cache.matchAll with URL containing credentials'); | 306 }, 'Cache.matchAll with URL containing credentials'); |
307 | 307 |
308 prepopulated_cache_test(simple_entries, function(cache, entries) { | 308 prepopulated_cache_test(simple_entries, function(cache, entries) { |
309 return cache.match(entries.secret_cat.request.url) | 309 return cache.match(entries.secret_cat.request.url) |
310 .then(function(result) { | 310 .then(function(result) { |
311 assert_object_equals_fixed( | 311 assert_response_equals( |
312 result, entries.secret_cat.response, | 312 result, entries.secret_cat.response, |
313 'Cache.match should not ignore embedded credentials'); | 313 'Cache.match should not ignore embedded credentials'); |
314 }); | 314 }); |
315 }, 'Cache.match with URL containing credentials'); | 315 }, 'Cache.match with URL containing credentials'); |
316 | 316 |
317 prepopulated_cache_test(vary_entries, function(cache, entries) { | 317 prepopulated_cache_test(vary_entries, function(cache, entries) { |
318 return cache.matchAll('http://example.com/c') | 318 return cache.matchAll('http://example.com/c') |
319 .then(function(result) { | 319 .then(function(result) { |
320 assert_array_equivalent( | 320 assert_response_array_equivalent( |
321 result, | 321 result, |
322 [ | 322 [ |
323 entries.vary_wildcard.response, | 323 entries.vary_wildcard.response, |
324 entries.vary_cookie_absent.response | 324 entries.vary_cookie_absent.response |
325 ], | 325 ], |
326 'Cache.matchAll should exclude matches if a vary header is ' + | 326 'Cache.matchAll should exclude matches if a vary header is ' + |
327 'missing in the query request, but is present in the cached ' + | 327 'missing in the query request, but is present in the cached ' + |
328 'request.'); | 328 'request.'); |
329 }) | 329 }) |
330 | 330 |
331 .then(function() { | 331 .then(function() { |
332 return cache.matchAll( | 332 return cache.matchAll( |
333 new Request('http://example.com/c', | 333 new Request('http://example.com/c', |
334 {headers: {'Cookies': 'none-of-the-above'}})); | 334 {headers: {'Cookies': 'none-of-the-above'}})); |
335 }) | 335 }) |
336 .then(function(result) { | 336 .then(function(result) { |
337 assert_array_equivalent( | 337 assert_response_array_equivalent( |
338 result, | 338 result, |
339 [ | 339 [ |
340 entries.vary_wildcard.response | 340 entries.vary_wildcard.response |
341 ], | 341 ], |
342 'Cache.matchAll should exclude matches if a vary header is ' + | 342 'Cache.matchAll should exclude matches if a vary header is ' + |
343 'missing in the cached request, but is present in the query ' + | 343 'missing in the cached request, but is present in the query ' + |
344 'request.'); | 344 'request.'); |
345 }) | 345 }) |
346 | 346 |
347 .then(function() { | 347 .then(function() { |
348 return cache.matchAll( | 348 return cache.matchAll( |
349 new Request('http://example.com/c', | 349 new Request('http://example.com/c', |
350 {headers: {'Cookies': 'is-for-cookie'}})); | 350 {headers: {'Cookies': 'is-for-cookie'}})); |
351 }) | 351 }) |
352 .then(function(result) { | 352 .then(function(result) { |
353 assert_array_equivalent( | 353 assert_response_array_equivalent( |
354 result, | 354 result, |
355 [entries.vary_cookie_is_cookie.response], | 355 [entries.vary_cookie_is_cookie.response], |
356 'Cache.matchAll should match the entire header if a vary header ' + | 356 'Cache.matchAll should match the entire header if a vary header ' + |
357 'is present in both the query and cached requests.'); | 357 'is present in both the query and cached requests.'); |
358 }); | 358 }); |
359 }, 'Cache.matchAll with responses containing "Vary" header'); | 359 }, 'Cache.matchAll with responses containing "Vary" header'); |
360 | 360 |
361 prepopulated_cache_test(vary_entries, function(cache, entries) { | 361 prepopulated_cache_test(vary_entries, function(cache, entries) { |
362 return cache.match('http://example.com/c') | 362 return cache.match('http://example.com/c') |
363 .then(function(result) { | 363 .then(function(result) { |
364 assert_object_in_array( | 364 assert_response_in_array( |
365 result, | 365 result, |
366 [ | 366 [ |
367 entries.vary_wildcard.response, | 367 entries.vary_wildcard.response, |
368 entries.vary_cookie_absent.response | 368 entries.vary_cookie_absent.response |
369 ], | 369 ], |
370 'Cache.match should honor "Vary" header.'); | 370 'Cache.match should honor "Vary" header.'); |
371 }); | 371 }); |
372 }, 'Cache.match with responses containing "Vary" header'); | 372 }, 'Cache.match with responses containing "Vary" header'); |
373 | 373 |
374 prepopulated_cache_test(vary_entries, function(cache, entries) { | 374 prepopulated_cache_test(vary_entries, function(cache, entries) { |
375 return cache.matchAll('http://example.com/c', | 375 return cache.matchAll('http://example.com/c', |
376 {ignoreVary: true}) | 376 {ignoreVary: true}) |
377 .then(function(result) { | 377 .then(function(result) { |
378 assert_array_equivalent( | 378 assert_response_array_equivalent( |
379 result, | 379 result, |
380 [ | 380 [ |
381 entries.vary_cookie_is_cookie.response, | 381 entries.vary_cookie_is_cookie.response, |
382 entries.vary_cookie_is_good.response, | 382 entries.vary_cookie_is_good.response, |
383 entries.vary_cookie_absent.response, | 383 entries.vary_cookie_absent.response, |
384 entries.vary_wildcard.response | 384 entries.vary_wildcard.response |
385 ], | 385 ], |
386 'Cache.matchAll should honor "ignoreVary" parameter.'); | 386 'Cache.matchAll should honor "ignoreVary" parameter.'); |
387 }); | 387 }); |
388 }, 'Cache.matchAll with "ignoreVary" parameter'); | 388 }, 'Cache.matchAll with "ignoreVary" parameter'); |
389 | 389 |
390 cache_test(function(cache) { | 390 cache_test(function(cache) { |
391 var request = new Request('http://example.com'); | 391 var request = new Request('http://example.com'); |
392 var response; | 392 var response; |
393 var request_url = new URL('../resources/simple.txt', location.href).href; | 393 var request_url = new URL('../resources/simple.txt', location.href).href; |
394 return fetch(request_url) | 394 return fetch(request_url) |
395 .then(function(fetch_result) { | 395 .then(function(fetch_result) { |
396 response = fetch_result; | 396 response = fetch_result; |
397 assert_equals( | 397 assert_equals( |
398 response.url, request_url, | 398 response.url, request_url, |
399 '[https://fetch.spec.whatwg.org/#dom-response-url] ' + | 399 '[https://fetch.spec.whatwg.org/#dom-response-url] ' + |
400 'Reponse.url should return the URL of the response.'); | 400 'Reponse.url should return the URL of the response.'); |
401 return cache.put(request, response.clone()); | 401 return cache.put(request, response.clone()); |
402 }) | 402 }) |
403 .then(function() { | 403 .then(function() { |
404 return cache.match(request.url); | 404 return cache.match(request.url); |
405 }) | 405 }) |
406 .then(function(result) { | 406 .then(function(result) { |
407 assert_object_equals_fixed( | 407 assert_response_equals( |
408 result, response, | 408 result, response, |
409 'Cache.match should return a Response object that has the same ' + | 409 'Cache.match should return a Response object that has the same ' + |
410 'properties as the stored response.'); | 410 'properties as the stored response.'); |
411 return cache.match(response.url); | 411 return cache.match(response.url); |
412 }) | 412 }) |
413 .then(function(result) { | 413 .then(function(result) { |
414 assert_equals( | 414 assert_equals( |
415 result, undefined, | 415 result, undefined, |
416 'Cache.match should not match cache entry based on response URL.'); | 416 'Cache.match should not match cache entry based on response URL.'); |
417 }); | 417 }); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 .then(function(result) { | 453 .then(function(result) { |
454 assert_equals(result, undefined, | 454 assert_equals(result, undefined, |
455 'Cache.match should not find a match'); | 455 'Cache.match should not find a match'); |
456 }); | 456 }); |
457 }, 'Cache.match with POST Request'); | 457 }, 'Cache.match with POST Request'); |
458 | 458 |
459 prepopulated_cache_test(simple_entries, function(cache, entries) { | 459 prepopulated_cache_test(simple_entries, function(cache, entries) { |
460 var response = entries.non_2xx_response.response; | 460 var response = entries.non_2xx_response.response; |
461 return cache.match(entries.non_2xx_response.request.url) | 461 return cache.match(entries.non_2xx_response.request.url) |
462 .then(function(result) { | 462 .then(function(result) { |
463 assert_object_equals_fixed( | 463 assert_response_equals( |
464 result, entries.non_2xx_response.response, | 464 result, entries.non_2xx_response.response, |
465 'Cache.match should return a Response object that has the ' + | 465 'Cache.match should return a Response object that has the ' + |
466 'same properties as a stored non-2xx response.'); | 466 'same properties as a stored non-2xx response.'); |
467 }); | 467 }); |
468 }, 'Cache.match with a non-2xx Response'); | 468 }, 'Cache.match with a non-2xx Response'); |
469 | 469 |
470 prepopulated_cache_test(simple_entries, function(cache, entries) { | 470 prepopulated_cache_test(simple_entries, function(cache, entries) { |
471 var response = entries.error_response.response; | 471 var response = entries.error_response.response; |
472 return cache.match(entries.error_response.request.url) | 472 return cache.match(entries.error_response.request.url) |
473 .then(function(result) { | 473 .then(function(result) { |
474 assert_object_equals_fixed( | 474 assert_response_equals( |
475 result, entries.error_response.response, | 475 result, entries.error_response.response, |
476 'Cache.match should return a Response object that has the ' + | 476 'Cache.match should return a Response object that has the ' + |
477 'same properties as a stored network error response.'); | 477 'same properties as a stored network error response.'); |
478 }); | 478 }); |
479 }, 'Cache.match with a network error Response'); | 479 }, 'Cache.match with a network error Response'); |
480 | 480 |
481 // Helpers --- | 481 // Helpers --- |
482 | 482 |
483 // Run |test_function| with a Cache object as its only parameter. Prior to the | 483 // Run |test_function| with a Cache object as its only parameter. Prior to the |
484 // call, the Cache is populated by cache entries from |entries|. The latter is | 484 // call, the Cache is populated by cache entries from |entries|. The latter is |
(...skipping 21 matching lines...) Expand all Loading... |
506 assert_equals(Object.keys(hash).length, entries.length); | 506 assert_equals(Object.keys(hash).length, entries.length); |
507 }); | 507 }); |
508 | 508 |
509 return p.then(function() { | 509 return p.then(function() { |
510 return test_function(cache, hash); | 510 return test_function(cache, hash); |
511 }); | 511 }); |
512 }, description); | 512 }, description); |
513 } | 513 } |
514 | 514 |
515 done(); | 515 done(); |
OLD | NEW |