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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium.insecure-parent-frame.html

Issue 2869093002: Upstream Service Worker window test to WPT
Patch Set: Incorporate review feedback 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 <!-- This test's file name is prefixed with `chromium.` because while a roughly
3 equivalent version is available in the Web Platform Tests project, the
4 limitations of the WPT infrastructure precludes the use of iframes for this
5 purpose. This version should be maintained only insofar as the functionality
6 under test concerns iframe contexts specifically; otherwise, modifications
7 should be contributed to the shared version. -->
2 <meta charset="utf-8"> 8 <meta charset="utf-8">
3 <script src="../resources/testharness.js"></script> 9 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 10 <script src="../resources/testharnessreport.js"></script>
5 <script src="../resources/get-host-info.js?pipe=sub"></script> 11 <script src="../resources/get-host-info.js?pipe=sub"></script>
6 <script src="resources/test-helpers.js"></script> 12 <script src="resources/test-helpers.js"></script>
7 <title>Insecure parent frame test</title> 13 <title>Insecure parent frame test</title>
8 <body></body> 14 <body></body>
9 <script> 15 <script>
10 // Asks |worker| to call clients.claim. Returns a promise that resolves when 16 // Asks |worker| to call clients.claim. Returns a promise that resolves when
11 // the worker acks that claim finished. 17 // the worker acks that claim finished.
(...skipping 21 matching lines...) Expand all
33 } 39 }
34 40
35 // This test creates https iframes inside insecure http iframes. It registers a 41 // This test creates https iframes inside insecure http iframes. It registers a
36 // service worker that should not control the in-scope iframes. The iframes 42 // service worker that should not control the in-scope iframes. The iframes
37 // communicate whether they have a controller to the top-level frame. 43 // communicate whether they have a controller to the top-level frame.
38 promise_test(t => { 44 promise_test(t => {
39 var script = 'resources/claim-worker.js'; 45 var script = 'resources/claim-worker.js';
40 var scope = 'resources/insecure-inscope'; 46 var scope = 'resources/insecure-inscope';
41 var registration; 47 var registration;
42 var insecure_url = get_host_info().UNAUTHENTICATED_ORIGIN + 48 var insecure_url = get_host_info().UNAUTHENTICATED_ORIGIN +
43 '/serviceworker/resources/insecure-parent.html'; 49 '/serviceworker/resources/insecure-parent-iframe.html';
44 var pre_registration_frame; 50 var pre_registration_frame;
45 var post_registration_frame; 51 var post_registration_frame;
46 52
47 return navigator.serviceWorker.getRegistration(scope) 53 return navigator.serviceWorker.getRegistration(scope)
48 // Unregister. 54 // Unregister.
49 .then(reg => { 55 .then(reg => {
50 if (reg) 56 if (reg)
51 return reg.unregister(); 57 return reg.unregister();
52 }) 58 })
53 59
(...skipping 22 matching lines...) Expand all
76 'post_registration_frame should not be controlled')) 82 'post_registration_frame should not be controlled'))
77 83
78 // Attempt to claim. The iframes should still have no controllers. 84 // Attempt to claim. The iframes should still have no controllers.
79 .then(() => wait_for_claim(registration.active)) 85 .then(() => wait_for_claim(registration.active))
80 .then(() => assert_no_controller(pre_registration_frame, 86 .then(() => assert_no_controller(pre_registration_frame,
81 'pre_registration_frame should not be claimed')) 87 'pre_registration_frame should not be claimed'))
82 .then(() => assert_no_controller(post_registration_frame, 88 .then(() => assert_no_controller(post_registration_frame,
83 'post_registration_frame should not be claimed')); 89 'post_registration_frame should not be claimed'));
84 }, 'Service worker does not control a subframe of an insecure frame'); 90 }, 'Service worker does not control a subframe of an insecure frame');
85 </script> 91 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698