Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/cache-storage-keys-test-worker.js

Issue 430993002: [ServiceWorker] CacheStorage tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 caches.keys()
jsbell 2014/08/15 21:36:13 Can you write 'self.caches' so it's clear to reade
asanka 2014/08/20 03:10:29 Done.
8 .then(test.step_func(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 caches.create(key);
19 }));
20 })
21
22 .then(function() { return caches.keys(); })
23 .then(test.step_func(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');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698