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

Side by Side Diff: LayoutTests/http/tests/cachestorage/common.html

Issue 1032623008: Expose Cache Storage API in global window/worker scope (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update webexposed expectations Created 5 years, 8 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/cachestorage/resources/blank.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Cache Storage: Verify that Window and Workers see same storage</title>
3 <link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_ worker/#cache-storage">
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <script src="/resources/testharness-helpers.js"></script>
7 <script>
8
9 function wait_for_message(worker) {
10 return new Promise(function(resolve) {
11 worker.addEventListener('message', function listener(e) {
12 resolve(e.data);
13 worker.removeEventListener('message', listener);
14 });
15 });
16 }
17
18 promise_test(function(t) {
19 var cache_name = 'common-test';
20 return self.caches.delete(cache_name)
21 .then(function() {
22 var worker = new Worker('resources/common-worker.js');
23 worker.postMessage({name: cache_name});
24 return wait_for_message(worker);
25 })
26 .then(function(message) {
27 return self.caches.open(cache_name);
28 })
29 .then(function(cache) {
30 return Promise.all([
31 cache.match('https://example.com/a'),
32 cache.match('https://example.com/b'),
33 cache.match('https://example.com/c')
34 ]);
35 })
36 .then(function(responses) {
37 return Promise.all(responses.map(
38 function(response) { return response.text(); }
39 ));
40 })
41 .then(function(bodies) {
42 assert_equals(bodies[0], 'a',
43 'Body should match response put by worker');
44 assert_equals(bodies[1], 'b',
45 'Body should match response put by worker');
46 assert_equals(bodies[2], 'c',
47 'Body should match response put by worker');
48 });
49 }, 'Window sees cache puts by Worker');
50
51 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/cachestorage/resources/blank.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698