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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/foreign-fetch-basics.html

Issue 1867293004: Set service worker response info data for foreign fetch intercepted fetches. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ff-check-origin
Patch Set: address comment Created 4 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="../resources/get-host-info.js"></script> 4 <script src="../resources/get-host-info.js"></script>
5 <script src="resources/test-helpers.js"></script> 5 <script src="resources/test-helpers.js"></script>
6 <body> 6 <body>
7 <script> 7 <script>
8 var host_info = get_host_info(); 8 var host_info = get_host_info();
9 9
10 function worker_for_origins(origins) { 10 function worker_for_origins(origins) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 .then(frame => new Promise(resolve => { 110 .then(frame => new Promise(resolve => {
111 var channel = new MessageChannel(); 111 var channel = new MessageChannel();
112 frame.contentWindow.postMessage('ping', '*', [channel.port1]); 112 frame.contentWindow.postMessage('ping', '*', [channel.port1]);
113 channel.port2.onmessage = reply => resolve(reply.data); 113 channel.port2.onmessage = reply => resolve(reply.data);
114 })) 114 }))
115 .then(reply => { 115 .then(reply => {
116 assert_equals(reply, 'ping'); 116 assert_equals(reply, 'ping');
117 }); 117 });
118 }, 'Service Worker does not intercept navigations.'); 118 }, 'Service Worker does not intercept navigations.');
119 119
120 promise_test(t => {
121 var scope = 'simple.txt?fallback';
122 var remote_url =
123 host_info.HTTPS_REMOTE_ORIGIN + '/serviceworker/resources/' + scope;
124 return install_cross_origin_worker(t, worker_for_scopes(['']), scope)
125 .then(() => fetch(remote_url))
126 .then(response => {});
127 }, 'Service Worker that fallback to network should not crash.');
128
129 promise_test(t => {
130 var ff_scope = 'foreign-fetch/scope/controlled?basic';
131 var remote_url =
132 host_info.HTTPS_REMOTE_ORIGIN + '/serviceworker/resources/' + ff_scope;
133 var scope = 'resources/simple.html';
134 var worker = 'resources/empty-worker.js';
135 return install_cross_origin_worker(t, worker_for_scopes(['']), ff_scope)
136 .then(() => service_worker_unregister_and_register(t, worker, scope))
137 .then(r => {
138 add_completion_callback(() => r.unregister());
139 return wait_for_state(t, r.installing, 'activated');
140 })
141 .then(() => with_iframe(scope))
142 .then(frame => frame.contentWindow.fetch(remote_url))
143 .then(response => response.text())
144 .then(response_text => {
145 assert_equals(response_text, 'Foreign Fetch');
146 });
147 }, 'Foreign fetch can intercept requests from SW controlled pages.');
148
120 </script> 149 </script>
121 </body> 150 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698