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 if (keys.length > 0) { | |
12 return Promise.all(keys.map(function(key) { | |
13 return self.caches.delete(key); | |
14 })); | |
15 } else { | |
16 return Promise.resolve(true); | |
jsbell
2014/08/28 21:07:26
No need for this special case if keys.length === 0
asanka
2014/08/28 21:59:46
Done.
| |
17 } | |
18 }) | |
19 .then(function() { | |
20 return Promise.all(test_cache_list.map(function(key) { | |
21 return self.caches.create(key); | |
22 })); | |
23 }) | |
24 | |
25 .then(function() { return self.caches.keys(); }) | |
26 .then(function(keys) { | |
27 assert_true(Array.isArray(keys), | |
28 'CacheStorage.keys should return an Array.'); | |
29 assert_array_equals(keys, | |
jsbell
2014/08/28 21:07:26
Order is apparently not guaranteed. Needs an "equi
jsbell
2014/08/28 21:49:01
Apparently we're supposed to preserve the order, s
asanka
2014/08/28 21:59:46
Acknowledged.
| |
30 test_cache_list, | |
31 'CacheStorage.keys should only return ' + | |
32 'existing caches.'); | |
33 }); | |
34 }, 'CacheStorage keys'); | |
OLD | NEW |