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

Unified 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: Fix typo and formatting Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
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..3d16bde230c2f87de247377cfcc1938a54e3f7ce
--- /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'];
dominicc (has gone to gerrit) 2014/08/11 01:57:36 Is it worth including interesting names like empty
asanka 2014/08/13 01:22:51 Added some variants. It shouldn't hurt, but the re
+
+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,
+ 'CacheStorage.keys should only return ' +
+ 'existing caches');
dominicc (has gone to gerrit) 2014/08/11 01:57:36 There's inconsistency about ending with a period.
asanka 2014/08/13 01:22:51 I added a '.'. The string put together by the test
+ }));
+ }, 'CacheStorage keys');

Powered by Google App Engine
This is Rietveld 408576698