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

Side by Side Diff: LayoutTests/http/tests/serviceworker/fetch-cors-xhr.html

Issue 600393004: [ServiceWorker] Set FetchRequestMode and handle wasFetchedViaServiceWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated falken's comment Created 6 years, 2 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 <title>Service Worker: CORS XHR of fetch()</title> 2 <title>Service Worker: CORS XHR of fetch()</title>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js?pipe=sub"></script> 5 <script src="resources/test-helpers.js?pipe=sub"></script>
6 <body>
6 <script> 7 <script>
7 async_test(function(t) { 8 async_test(function(t) {
9 var login1 =
10 test_login(t, 'http://127.0.0.1:8000', 'username1', 'password1');
11 var login2 =
12 test_login(t, 'http://localhost:8000', 'username2', 'password2');
8 var SCOPE = 'resources/fetch-cors-xhr-iframe.html'; 13 var SCOPE = 'resources/fetch-cors-xhr-iframe.html';
9 var SCRIPT = 'resources/fetch-rewrite-worker.js'; 14 var SCRIPT = 'resources/fetch-rewrite-worker.js';
10 var host_info = get_host_info(); 15 var host_info = get_host_info();
11 service_worker_unregister_and_register(t, SCRIPT, SCOPE) 16
17 Promise.all([login1, login2])
18 .then(function() {
19 return service_worker_unregister_and_register(t, SCRIPT, SCOPE);
20 })
12 .then(function(registration) { 21 .then(function(registration) {
13 return wait_for_update(t, registration); 22 return wait_for_update(t, registration);
14 }) 23 })
15 .then(function(sw) { 24 .then(function(sw) {
16 return wait_for_state(t, sw, 'activated'); 25 return wait_for_state(t, sw, 'activated');
17 }) 26 })
18 .then(function() { return with_iframe(SCOPE); }) 27 .then(function() { return with_iframe(SCOPE); })
19 .then(function(frame) { 28 .then(function(frame) {
20 return new Promise(function(resolve, reject) { 29 return new Promise(function(resolve, reject) {
21 var channel = new MessageChannel(); 30 var channel = new MessageChannel();
22 channel.port1.onmessage = t.step_func(function(e) { 31 channel.port1.onmessage = t.step_func(function(e) {
23 assert_equals(e.data.results, 'finish'); 32 assert_equals(e.data.results, 'finish');
falken 2014/10/09 07:56:51 delete the frame here
horo 2014/10/09 08:12:27 Done.
24 service_worker_unregister_and_done(t, SCOPE); 33 service_worker_unregister_and_done(t, SCOPE);
25 }); 34 });
26 frame.contentWindow.postMessage({}, 35 frame.contentWindow.postMessage({},
27 [channel.port2], 36 [channel.port2],
28 host_info['HTTP_ORIGIN']); 37 host_info['HTTP_ORIGIN']);
29 }); 38 });
30 }) 39 })
31 .catch(unreached_rejection(t)); 40 .catch(unreached_rejection(t));
32 }, 'Verify CORS XHR of fetch() in a Service Worker'); 41 }, 'Verify CORS XHR of fetch() in a Service Worker');
33 </script> 42 </script>
43 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698