| Index: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/navigation-redirect.https.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-redirect.html b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/navigation-redirect.https.html
|
| similarity index 90%
|
| copy from third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-redirect.html
|
| copy to third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/navigation-redirect.https.html
|
| index a50a4a960dae39ae1bd7c73364cc7943c5010c83..7b606cf0c3c04dc487acd0317954e36d76418263 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-redirect.html
|
| +++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/navigation-redirect.https.html
|
| @@ -1,31 +1,30 @@
|
| <!DOCTYPE html>
|
| <title>Service Worker: Navigation redirection</title>
|
| -<script src="../resources/testharness.js"></script>
|
| -<script src="../resources/testharnessreport.js"></script>
|
| -<script src="../resources/get-host-info.js?pipe=sub"></script>
|
| -<script src="resources/test-helpers.js"></script>
|
| +<script src="/resources/testharness.js"></script>
|
| +<script src="/resources/testharnessreport.js"></script>
|
| +<script src="resources/get-host-info.sub.js"></script>
|
| +<script src="resources/test-helpers.sub.js"></script>
|
| <body>
|
| <script>
|
| -
|
| var host_info = get_host_info();
|
|
|
| // This test registers three Service Workers at SCOPE1, SCOPE2 and
|
| // OTHER_ORIGIN_SCOPE. And checks the redirected page's URL and the requests
|
| // which are intercepted by Service Worker while loading redirect page.
|
| -var BASE_URL = host_info['HTTP_ORIGIN'] + base_path();
|
| -var OTHER_BASE_URL = host_info['HTTP_REMOTE_ORIGIN'] + base_path();
|
| +var BASE_URL = host_info['HTTPS_ORIGIN'] + base_path();
|
| +var OTHER_BASE_URL = host_info['HTTPS_REMOTE_ORIGIN'] + base_path();
|
|
|
| -var SCOPE1 = BASE_URL + 'resources/navigation-redirect-scope1.php?';
|
| -var SCOPE2 = BASE_URL + 'resources/navigation-redirect-scope2.php?';
|
| -var OUT_SCOPE = BASE_URL + 'resources/navigation-redirect-out-scope.php?';
|
| +var SCOPE1 = BASE_URL + 'resources/navigation-redirect-scope1.py?';
|
| +var SCOPE2 = BASE_URL + 'resources/navigation-redirect-scope2.py?';
|
| +var OUT_SCOPE = BASE_URL + 'resources/navigation-redirect-out-scope.py?';
|
| var SCRIPT = 'resources/navigation-redirect-worker.js';
|
|
|
| var OTHER_ORIGIN_IFRAME_URL =
|
| OTHER_BASE_URL + 'resources/navigation-redirect-other-origin.html';
|
| var OTHER_ORIGIN_SCOPE =
|
| - OTHER_BASE_URL + 'resources/navigation-redirect-scope1.php?';
|
| + OTHER_BASE_URL + 'resources/navigation-redirect-scope1.py?';
|
| var OTHER_ORIGIN_OUT_SCOPE =
|
| - OTHER_BASE_URL + 'resources/navigation-redirect-out-scope.php?';
|
| + OTHER_BASE_URL + 'resources/navigation-redirect-out-scope.py?';
|
|
|
| var workers;
|
| var other_origin_frame;
|
| @@ -74,18 +73,21 @@ function get_effective_worker(registration) {
|
| }
|
|
|
| function check_all_intercepted_urls(expected_urls) {
|
| - return Promise.all(
|
| - [
|
| - // Gets the request URLs which are intercepted by SCOPE1's SW.
|
| - get_intercepted_urls(workers[0]),
|
| - // Gets the request URLs which are intercepted by SCOPE2's SW.
|
| - get_intercepted_urls(workers[1]),
|
| - // Gets the request URLs which are intercepted by OTHER_ORIGIN_SCOPE's
|
| - // SW. This promise will resolve when get_intercepted_urls() in
|
| - // OTHER_ORIGIN_IFRAME_URL resolves.
|
| - send_to_iframe(other_origin_frame, 'get_intercepted_urls')
|
| - ])
|
| - .then(function(urls) {
|
| + var urls = [];
|
| + return get_intercepted_urls(workers[0])
|
| + .then(function(url) {
|
| + urls.push(url);
|
| + return get_intercepted_urls(workers[1]);
|
| + }).then(function(url) {
|
| + urls.push(url);
|
| + // Gets the request URLs which are intercepted by OTHER_ORIGIN_SCOPE's
|
| + // SW. This promise will resolve when get_intercepted_urls() in
|
| + // OTHER_ORIGIN_IFRAME_URL resolves.
|
| + return send_to_iframe(other_origin_frame, 'get_intercepted_urls');
|
| + }).then(function(url) {
|
| + urls.push(url);
|
| + return urls;
|
| + }).then(function(urls) {
|
| assert_object_equals(
|
| urls, expected_urls,
|
| 'Intercepted URLs should match.');
|
| @@ -114,8 +116,8 @@ function test_redirect(url, expected_last_url,
|
| window.addEventListener('message', on_message, false);
|
|
|
| function on_message(e) {
|
| - if (e.origin != host_info['HTTP_REMOTE_ORIGIN'] &&
|
| - e.origin != host_info['HTTP_ORIGIN'] ) {
|
| + if (e.origin != host_info['HTTPS_REMOTE_ORIGIN'] &&
|
| + e.origin != host_info['HTTPS_ORIGIN'] ) {
|
| console.error('invalid origin: ' + e.origin);
|
| return;
|
| }
|
| @@ -130,7 +132,7 @@ function send_to_iframe(frame, message) {
|
| message_resolvers[message_id] = resolve;
|
| frame.contentWindow.postMessage(
|
| {id: message_id, message: message},
|
| - host_info['HTTP_REMOTE_ORIGIN']);
|
| + host_info['HTTPS_REMOTE_ORIGIN']);
|
| });
|
| }
|
|
|
| @@ -174,7 +176,7 @@ promise_test(function(t) {
|
| return test_redirect(
|
| SCOPE1 + 'url=' + encodeURIComponent(SCOPE1),
|
| SCOPE1,
|
| - [[SCOPE1 + 'url=' + encodeURIComponent(SCOPE1), SCOPE1], [], []]);
|
| + [[SCOPE1 + 'url=' + encodeURIComponent(SCOPE1)], [], []]);
|
| });
|
| }, 'SW-fallbacked redirect to same-origin same-scope.');
|
| promise_test(function(t) {
|
| @@ -182,7 +184,7 @@ promise_test(function(t) {
|
| return test_redirect(
|
| SCOPE1 + 'url=' + encodeURIComponent(SCOPE2),
|
| SCOPE2,
|
| - [[SCOPE1 + 'url=' + encodeURIComponent(SCOPE2)], [SCOPE2], []]);
|
| + [[SCOPE1 + 'url=' + encodeURIComponent(SCOPE2)], [], []]);
|
| });
|
| }, 'SW-fallbacked redirect to same-origin other-scope.');
|
| promise_test(function(t) {
|
| @@ -202,7 +204,7 @@ promise_test(function(t) {
|
| OTHER_ORIGIN_SCOPE,
|
| [[SCOPE1 + 'url=' + encodeURIComponent(OTHER_ORIGIN_SCOPE)],
|
| [],
|
| - [OTHER_ORIGIN_SCOPE]]);
|
| + []]);
|
| });
|
| }, 'SW-fallbacked redirect to other-origin in-scope.');
|
|
|
|
|