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

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

Issue 1312723002: Service workers: Add test for HTTP to HTTPS redirect (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: wait for unregister Created 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/register.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>register on a secure page after redirect from an non-secure url</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharness-helpers.js"></script>
5 <script src="../resources/testharnessreport.js"></script>
6 <script src="../resources/get-host-info.js?pipe=sub"></script>
7 <script src="resources/test-helpers.js"></script>
8 <body>
9 <script>
10
11 // Loads a non-secure url in an iframe, which redirects to |target_url|.
12 // That page then registers a service worker, and messages back with the result.
13 // Returns a promise that resolves with the result.
14 function redirect_and_register(target_url) {
15 var redirect_url = get_host_info()['UNAUTHENTICATED_ORIGIN'] +
16 '/serviceworker/resources/redirect.php?Redirect=';
17 var frame;
18
19 return with_iframe(redirect_url + encodeURIComponent(target_url))
20 .then(f => {
21 frame = f;
22 return new Promise(resolve => {
23 window.addEventListener('message', e => {resolve(e.data);});
24 });
25 })
26 .then(result => {
27 frame.remove();
28 return result;
29 });
30 }
31
32 promise_test(function(t) {
33 var target_url = window.location.origin +
34 '/serviceworker/resources/register.html';
35
36 return redirect_and_register(target_url)
37 .then(result => { assert_equals(result, 'OK'); });
38 }, 'register on a secure page after redirect from an non-secure url');
39
40 promise_test(function(t) {
41 var target_url = get_host_info()['UNAUTHENTICATED_ORIGIN'] +
42 '/serviceworker/resources/register.html';
43
44 return redirect_and_register(target_url)
45 .then(result => {assert_equals(result, 'FAIL: NotSupportedError');});
46 }, 'register on a non-secure page after redirect from an non-secure url');
47 </script>
48 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/resources/register.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698