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