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