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

Unified 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: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/fetch-event-test-worker.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/fetch-event.html
diff --git a/LayoutTests/http/tests/serviceworker/fetch-event.html b/LayoutTests/http/tests/serviceworker/fetch-event.html
index fd6aba2e8819d1a0dda77511515e1417841a0341..7963b0c10723dc36f9420990045f056810283730 100644
--- a/LayoutTests/http/tests/serviceworker/fetch-event.html
+++ b/LayoutTests/http/tests/serviceworker/fetch-event.html
@@ -149,5 +149,51 @@ async_test(function(t) {
}))
.catch(unreached_rejection(t));
}, 'Service Worker fetches other file in fetch event');
+
+async_test(function(t) {
+ var scope = 'resources/simple.html?form-post';
+ var frame_name = 'xhr-post-frame';
+ service_worker_unregister_and_register(t, worker, scope)
+ .then(function(registration) {
+ return wait_for_update(t, registration);
+ })
+ .then(t.step_func(function(sw) {
+ return wait_for_state(t, sw, 'activated');
+ }))
+ .then(t.step_func(function(sw) {
+ return new Promise(function(resolve) {
+ var frame = document.createElement('iframe');
+ frame.name = frame_name;
+ document.body.appendChild(frame);
+ var form = document.createElement('form');
+ form.target = frame_name;
+ form.action = scope;
+ form.method = 'post';
+ var input1 = document.createElement('input');
+ input1.type = 'text';
+ input1.value = 'testValue1';
+ input1.name = 'testName1'
+ form.appendChild(input1);
+ var input2 = document.createElement('input');
+ input2.type = 'text';
+ input2.value = 'testValue2';
+ input2.name = 'testName2'
+ form.appendChild(input2);
+ document.body.appendChild(form);
+ frame.onload = function() {
+ document.body.removeChild(form);
+ resolve(frame);
+ };
+ form.submit();
+ });
+ }))
+ .then(t.step_func(function(frame) {
+ assert_equals(frame.contentDocument.body.textContent,
+ 'POST:testName1=testValue1&testName2=testValue2');
+ document.body.removeChild(frame);
+ return service_worker_unregister_and_done(t, scope);
+ }))
+ .catch(unreached_rejection(t));
+ }, 'Service Worker responds to fetch event with POST form');
</script>
</body>
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/fetch-event-test-worker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698