Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/resources/cache-storage-keys-test-worker.js |
| diff --git a/LayoutTests/http/tests/serviceworker/resources/cache-storage-keys-test-worker.js b/LayoutTests/http/tests/serviceworker/resources/cache-storage-keys-test-worker.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7d6c41a84f6e57c2daf04b697c377c6eec2eb213 |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/serviceworker/resources/cache-storage-keys-test-worker.js |
| @@ -0,0 +1,29 @@ |
| +importScripts('worker-test-harness.js'); |
| + |
| +var test_cache_list = ['enum-1', 'enum-2', 'enum-3']; |
| + |
| +promise_test(function(test) { |
| + return caches.keys() |
| + .then(test.step_func(function(keys) { |
| + assert_equals(keys.length, |
| + 0, |
| + 'CacheStorage.keys should return an empty list for ' + |
| + 'a new ServiceWorker.'); |
| + })) |
| + |
| + .then(function() { |
| + return Promise.all(test_cache_list.map(function(key) { |
| + return caches.create(key); |
| + })); |
| + }) |
| + |
| + .then(function() { return caches.keys(); }) |
| + .then(test.step_func(function(keys) { |
| + assert_true(Array.isArray(keys), |
| + 'CacheStorage.keys should return an Array.'); |
| + assert_array_equals(keys, |
| + test_cache_list, |
| + 'CacheStroage.keys should only return ' + |
|
jsbell
2014/08/01 00:09:11
Typo: 'Stroage'
asanka
2014/08/01 06:03:21
Done.
|
| + 'existing caches'); |
| + })); |
| + }, 'CacheStorage keys'); |