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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium.http-to-https-redirect-and-register-iframe.html

Issue 2911073002: Upstream service wrkr "HTTP to HTTPS" tests to WPT (Closed)
Patch Set: Created 3 years, 6 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 <title>register on a secure page after redirect from an non-secure url</title> 8 <title>register on a secure page after redirect from an non-secure url</title>
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 <body> 13 <body>
8 <script> 14 <script>
15 'use strict';
9 16
10 // Loads a non-secure url in an iframe, which redirects to |target_url|. 17 // Loads a non-secure url in an iframe, which redirects to |target_url|.
11 // That page then registers a service worker, and messages back with the result. 18 // That page then registers a service worker, and messages back with the result.
12 // Returns a promise that resolves with the result. 19 // Returns a promise that resolves with the result.
13 function redirect_and_register(target_url) { 20 function redirect_and_register(target_url) {
14 var redirect_url = get_host_info()['UNAUTHENTICATED_ORIGIN'] + 21 var redirect_url = get_host_info()['UNAUTHENTICATED_ORIGIN'] +
15 '/serviceworker/resources/redirect.php?Redirect='; 22 '/serviceworker/resources/redirect.php?Redirect=';
16 var message_promise = new Promise(resolve => { 23 var message_promise = new Promise(resolve => {
17 window.addEventListener('message', e => resolve(e.data)); 24 window.addEventListener('message', e => resolve(e.data));
18 }); 25 });
(...skipping 15 matching lines...) Expand all
34 41
35 promise_test(function(t) { 42 promise_test(function(t) {
36 var target_url = get_host_info()['UNAUTHENTICATED_ORIGIN'] + 43 var target_url = get_host_info()['UNAUTHENTICATED_ORIGIN'] +
37 '/serviceworker/resources/register.html'; 44 '/serviceworker/resources/register.html';
38 45
39 return redirect_and_register(target_url) 46 return redirect_and_register(target_url)
40 .then(result => {assert_equals(result, 'FAIL: SecurityError');}); 47 .then(result => {assert_equals(result, 'FAIL: SecurityError');});
41 }, 'register on a non-secure page after redirect from an non-secure url'); 48 }, 'register on a non-secure page after redirect from an non-secure url');
42 </script> 49 </script>
43 </body> 50 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698