| OLD | NEW |
| (Empty) |
| 1 if (self.importScripts) { | |
| 2 importScripts('/resources/testharness.js'); | |
| 3 importScripts('../resources/test-helpers.js'); | |
| 4 } | |
| 5 | |
| 6 var test_cache_list = | |
| 7 ['', 'example', 'Another cache name', 'A', 'a', 'ex ample']; | |
| 8 | |
| 9 promise_test(function(test) { | |
| 10 return self.caches.keys() | |
| 11 .then(function(keys) { | |
| 12 assert_true(Array.isArray(keys), | |
| 13 'CacheStorage.keys should return an Array.'); | |
| 14 return Promise.all(keys.map(function(key) { | |
| 15 return self.caches.delete(key); | |
| 16 })); | |
| 17 }) | |
| 18 .then(function() { | |
| 19 return Promise.all(test_cache_list.map(function(key) { | |
| 20 return self.caches.open(key); | |
| 21 })); | |
| 22 }) | |
| 23 | |
| 24 .then(function() { return self.caches.keys(); }) | |
| 25 .then(function(keys) { | |
| 26 assert_true(Array.isArray(keys), | |
| 27 'CacheStorage.keys should return an Array.'); | |
| 28 assert_array_equals(keys, | |
| 29 test_cache_list, | |
| 30 'CacheStorage.keys should only return ' + | |
| 31 'existing caches.'); | |
| 32 }); | |
| 33 }, 'CacheStorage keys'); | |
| 34 | |
| 35 done(); | |
| OLD | NEW |