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

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

Issue 2790143003: Cache Storage API tests: Fix WPT test bugs, remove redundant local copies (Closed)
Patch Set: Created 3 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
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>
7
8 function wait_for_message(worker) {
9 return new Promise(function(resolve) {
10 worker.addEventListener('message', function listener(e) {
11 resolve(e.data);
12 worker.removeEventListener('message', listener);
13 });
14 });
15 }
16
17 promise_test(function(t) {
18 var cache_name = 'common-test';
19 return self.caches.delete(cache_name)
20 .then(function() {
21 var worker = new Worker('resources/common-worker.js');
22 worker.postMessage({name: cache_name});
23 return wait_for_message(worker);
24 })
25 .then(function(message) {
26 return self.caches.open(cache_name);
27 })
28 .then(function(cache) {
29 return Promise.all([
30 cache.match('https://example.com/a'),
31 cache.match('https://example.com/b'),
32 cache.match('https://example.com/c')
33 ]);
34 })
35 .then(function(responses) {
36 return Promise.all(responses.map(
37 function(response) { return response.text(); }
38 ));
39 })
40 .then(function(bodies) {
41 assert_equals(bodies[0], 'a',
42 'Body should match response put by worker');
43 assert_equals(bodies[1], 'b',
44 'Body should match response put by worker');
45 assert_equals(bodies[2], 'c',
46 'Body should match response put by worker');
47 });
48 }, 'Window sees cache puts by Worker');
49
50 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698