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

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

Issue 475533005: [ServiceWorker] Add support of FetchEvent's request.body. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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/test-helpers.js"></script> 4 <script src="resources/test-helpers.js"></script>
5 <body> 5 <body>
6 <script> 6 <script>
7 var worker = 'resources/fetch-event-test-worker.js'; 7 var worker = 'resources/fetch-event-test-worker.js';
8 8
9 async_test(function(t) { 9 async_test(function(t) {
10 var scope = 'resources/simple.html?string'; 10 var scope = 'resources/simple.html?string';
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 })) 142 }))
143 .then(t.step_func(function() { return with_iframe(scope); })) 143 .then(t.step_func(function() { return with_iframe(scope); }))
144 .then(t.step_func(function(frame) { 144 .then(t.step_func(function(frame) {
145 assert_equals(frame.contentDocument.body.textContent, 145 assert_equals(frame.contentDocument.body.textContent,
146 'Here\'s an other html file.\n', 146 'Here\'s an other html file.\n',
147 'Response should come from fetched other file'); 147 'Response should come from fetched other file');
148 return service_worker_unregister_and_done(t, scope); 148 return service_worker_unregister_and_done(t, scope);
149 })) 149 }))
150 .catch(unreached_rejection(t)); 150 .catch(unreached_rejection(t));
151 }, 'Service Worker fetches other file in fetch event'); 151 }, 'Service Worker fetches other file in fetch event');
152
153 async_test(function(t) {
154 var scope = 'resources/simple.html?form-post';
155 var frame_name = 'xhr-post-frame';
156 service_worker_unregister_and_register(t, worker, scope)
157 .then(function(registration) {
158 return wait_for_update(t, registration);
159 })
160 .then(t.step_func(function(sw) {
161 return wait_for_state(t, sw, 'activated');
162 }))
163 .then(t.step_func(function(sw) {
164 return new Promise(function(resolve) {
165 var frame = document.createElement('iframe');
166 frame.name = frame_name;
167 document.body.appendChild(frame);
168 var form = document.createElement('form');
169 form.target = frame_name;
170 form.action = scope;
171 form.method = 'post';
172 var input1 = document.createElement('input');
173 input1.type = 'text';
174 input1.value = 'testValue1';
175 input1.name = 'testName1'
176 form.appendChild(input1);
177 var input2 = document.createElement('input');
178 input2.type = 'text';
179 input2.value = 'testValue2';
180 input2.name = 'testName2'
181 form.appendChild(input2);
182 document.body.appendChild(form);
183 frame.onload = function() {
184 resolve(frame);
falken 2014/08/19 04:08:25 can you remove the form here? (or maybe it can be
horo 2014/08/19 04:46:14 Done.
185 };
186 form.submit();
187 });
188 }))
189 .then(t.step_func(function(frame) {
falken 2014/08/19 04:08:25 can you remove the frame here
horo 2014/08/19 04:46:14 Done.
190 assert_equals(frame.contentDocument.body.textContent,
191 'POST:testName1=testValue1&testName2=testValue2');
192 return service_worker_unregister_and_done(t, scope);
193 }))
194 .catch(unreached_rejection(t));
195 }, 'Service Worker responds to fetch event with POST form');
152 </script> 196 </script>
153 </body> 197 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698