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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/fetch-event-async-respond-with.https.html

Issue 2836233002: Upstream service worker `fetch` tests to WPT (Closed)
Patch Set: Extend "-expected.txt" file with reference to new sub-test Created 3 years, 7 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="/resources/testharness.js"></script> 2 <script src="/resources/testharness.js"></script>
3 <script src="resources/testharness-helpers.js"></script>
4 <script src="/resources/testharnessreport.js"></script> 3 <script src="/resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.sub.js"></script> 4 <script src="resources/test-helpers.sub.js"></script>
6 <script> 5 <script>
7 promise_test(function(t) { 6 promise_test(function(t) {
8 var script = 'resources/fetch-event-async-respond-with-worker.js'; 7 var script = 'resources/fetch-event-async-respond-with-worker.js';
9 var scope = 'resources/simple.html'; 8 var scope = 'resources/simple.html';
10 9
11 return service_worker_unregister_and_register(t, script, scope) 10 return service_worker_unregister_and_register(t, script, scope)
12 .then(function(registration) { 11 .then(function(registration) {
13 return wait_for_state(t, registration.installing, 'activated'); 12 return wait_for_state(t, registration.installing, 'activated');
14 }) 13 })
15 .then(function() { 14 .then(function() {
16 return with_iframe(scope); 15 return with_iframe(scope);
17 }) 16 })
18 .then(function(frame) { 17 .then(function(frame) {
18 add_completion_callback(function() { frame.remove(); });
19 var channel = new MessageChannel(); 19 var channel = new MessageChannel();
20 var saw_message = new Promise(function(resolve) { 20 var saw_message = new Promise(function(resolve) {
21 channel.port1.onmessage = function(e) { resolve(e.data); } 21 channel.port1.onmessage = function(e) { resolve(e.data); }
22 }); 22 });
23 var worker = frame.contentWindow.navigator.serviceWorker.controller; 23 var worker = frame.contentWindow.navigator.serviceWorker.controller;
24 24
25 worker.postMessage({port: channel.port2}, [channel.port2]); 25 worker.postMessage({port: channel.port2}, [channel.port2]);
26 frame.remove();
27 return saw_message; 26 return saw_message;
28 }) 27 })
29 .then(function(message) { 28 .then(function(message) {
30 assert_equals(message, 'PASS'); 29 assert_equals(message, 'PASS');
31 return service_worker_unregister_and_done(t, scope); 30 return service_worker_unregister_and_done(t, scope);
32 }) 31 })
33 }, 'Calling respondWith asynchronously throws an exception'); 32 }, 'Calling respondWith asynchronously throws an exception');
34 </script> 33 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698