| OLD | NEW |
| 1 (function() { | 1 (function() { |
| 2 var next_cache_index = 1; | 2 var next_cache_index = 1; |
| 3 | 3 |
| 4 // Returns a promise that resolves to a newly created Cache object. The | 4 // Returns a promise that resolves to a newly created Cache object. The |
| 5 // returned Cache will be destroyed when |test| completes. | 5 // returned Cache will be destroyed when |test| completes. |
| 6 function create_temporary_cache(test) { | 6 function create_temporary_cache(test) { |
| 7 var uniquifier = String(++next_cache_index); | 7 var uniquifier = String(++next_cache_index); |
| 8 var cache_name = self.location.pathname + '/' + uniquifier; | 8 var cache_name = self.location.pathname + '/' + uniquifier; |
| 9 | 9 |
| 10 test.add_cleanup(function() { | 10 test.add_cleanup(function() { |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 function assert_request_in_array(actual, expected_array, description) { | 285 function assert_request_in_array(actual, expected_array, description) { |
| 286 assert_true(expected_array.some(function(element) { | 286 assert_true(expected_array.some(function(element) { |
| 287 try { | 287 try { |
| 288 assert_request_equals(actual, element); | 288 assert_request_equals(actual, element); |
| 289 return true; | 289 return true; |
| 290 } catch (e) { | 290 } catch (e) { |
| 291 return false; | 291 return false; |
| 292 } | 292 } |
| 293 }), description); | 293 }), description); |
| 294 } | 294 } |
| 295 |
| 296 // Deletes all caches, returning a promise indicating success. |
| 297 function delete_all_caches() { |
| 298 return self.caches.keys() |
| 299 .then(function(keys) { |
| 300 return Promise.all(keys.map(self.caches.delete.bind(self.caches))); |
| 301 }); |
| 302 } |
| OLD | NEW |