Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / cachestorage / common.html
blob5d652bb231913f0ce5786953b273f202ff120abc
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>
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 });
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);
26 .then(function(message) {
27 return self.caches.open(cache_name);
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 ]);
36 .then(function(responses) {
37 return Promise.all(responses.map(
38 function(response) { return response.text(); }
39 ));
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');
51 </script>