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 assert_equals(keys.length, 0, |
| 12 'CacheStorage.keys should return an empty list for ' + |
| 13 'a new ServiceWorker.'); |
| 14 }) |
| 15 |
| 16 .then(function() { |
| 17 return Promise.all(test_cache_list.map(function(key) { |
| 18 return self.caches.create(key); |
| 19 })); |
| 20 }) |
| 21 |
| 22 .then(function() { return self.caches.keys(); }) |
| 23 .then(function(keys) { |
| 24 assert_true(Array.isArray(keys), |
| 25 'CacheStorage.keys should return an Array.'); |
| 26 assert_array_equals(keys, |
| 27 test_cache_list, |
| 28 'CacheStorage.keys should only return ' + |
| 29 'existing caches.'); |
| 30 }); |
| 31 }, 'CacheStorage keys'); |
OLD | NEW |