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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/navigation-redirect-body.https.html

Issue 2872363002: Upstream service worker navigation tests to WPT (Closed)
Patch Set: 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 <title>Service Worker: Navigation redirection must clear body</title> 2 <title>Service Worker: Navigation redirection must clear body</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/get-host-info.js?pipe=sub"></script> 5 <script src="/common/get-host-info.sub.js"></script>
6 <script src="resources/test-helpers.js"></script> 6 <script src="resources/test-helpers.sub.js"></script>
7 <meta charset="utf-8">
7 <body> 8 <body>
9 <form id="test-form" method="POST" style="display: none;">
10 <input type="submit" id="submit-button" />
11 </form>
8 <script> 12 <script>
9 promise_test(function(t) { 13 promise_test(function(t) {
10 var scope = 'resources/navigation-redirect-body.php'; 14 var scope = 'resources/navigation-redirect-body.py';
11 var script = 'resources/navigation-redirect-body-worker.js'; 15 var script = 'resources/navigation-redirect-body-worker.js';
12 var registration; 16 var registration;
13 var frame = document.createElement('frame'); 17 var frame = document.createElement('frame');
18 var form = document.getElementById('test-form');
19 var submit_button = document.getElementById('submit-button');
20
14 frame.src = 'about:blank'; 21 frame.src = 'about:blank';
15 frame.name = 'target_frame'; 22 frame.name = 'target_frame';
16 frame.id = 'frame'; 23 frame.id = 'frame';
17 document.body.appendChild(frame); 24 document.body.appendChild(frame);
18 var form = document.createElement('form'); 25 t.add_cleanup(function() { document.body.removeChild(frame); });
19 form.method = 'POST'; 26
20 form.action = scope; 27 form.action = scope;
21 form.target = 'target_frame'; 28 form.target = 'target_frame';
22 var hidden_input = document.createElement('input'); 29
23 hidden_input.type = 'hidden';
24 hidden_input.name = 'data';
25 hidden_input.value = 'test data';
26 var submit_button = document.createElement('input');
27 submit_button.type = 'submit';
28 submit_button.value = 'submit';
29 form.appendChild(hidden_input);
30 form.appendChild(submit_button);
31 document.body.appendChild(form);
32 return service_worker_unregister_and_register(t, script, scope) 30 return service_worker_unregister_and_register(t, script, scope)
33 .then(function(r) { 31 .then(function(r) {
34 registration = r; 32 registration = r;
35 return wait_for_state(t, registration.installing, 'activated'); 33 return wait_for_state(t, registration.installing, 'activated');
36 }) 34 })
37 .then(function() { 35 .then(function() {
38 var frame_load_promise = new Promise(function(resolve) { 36 var frame_load_promise = new Promise(function(resolve) {
39 frame.addEventListener('load', function() { 37 frame.addEventListener('load', function() {
40 resolve(frame.contentWindow.document.body.innerText); 38 resolve(frame.contentWindow.document.body.innerText);
41 }, false); 39 }, false);
42 }); 40 });
43 submit_button.click(); 41 submit_button.click();
44 return frame_load_promise; 42 return frame_load_promise;
45 }) 43 })
46 .then(function(text) { 44 .then(function(text) {
47 document.body.removeChild(form);
48 document.body.removeChild(frame);
49 var request_uri = decodeURIComponent(text); 45 var request_uri = decodeURIComponent(text);
50 assert_equals( 46 assert_equals(
51 request_uri, 47 request_uri,
52 '/serviceworker/resources/navigation-redirect-body.php?redirect'); 48 '/service-workers/service-worker/resources/navigation-redirect-bod y.py?redirect');
53 return registration.unregister(); 49 return registration.unregister();
54 }); 50 });
55 }, 'Navigation redirection must clear body'); 51 }, 'Navigation redirection must clear body');
56 </script> 52 </script>
57 </body> 53 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698