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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/http-to-https-redirect-and-register.https.html

Issue 2911073002: Upstream service wrkr "HTTP to HTTPS" 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/http-to-https-redirect-and-register.https.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/http-to-https-redirect-and-register.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/http-to-https-redirect-and-register.https.html
new file mode 100644
index 0000000000000000000000000000000000000000..d78b23a49e9801eb9296a1da407dac4f34f43f1b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/http-to-https-redirect-and-register.https.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<title>register on a secure page after redirect from an non-secure url</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
+<body>
+<script>
+'use strict';
+
+// Loads a non-secure url in a new window, which redirects to |target_url|.
+// That page then registers a service worker, and messages back with the result.
+// Returns a promise that resolves with the result.
+function redirect_and_register(target_url) {
+ var redirect_url = get_host_info()['UNAUTHENTICATED_ORIGIN'] + base_path() +
+ 'resources/redirect.py?Redirect=';
+ var child = window.open(redirect_url + encodeURIComponent(target_url));
+ return new Promise(resolve => {
+ window.addEventListener('message', e => resolve(e.data));
+ })
+ .then(function(result) {
+ child.close();
+ return result;
+ });
+}
+
+promise_test(function(t) {
+ var target_url = window.location.origin + base_path() +
+ 'resources/http-to-https-redirect-and-register-iframe.html';
+
+ return redirect_and_register(target_url)
+ .then(result => {
+ assert_equals(result, 'OK');
+ });
+ }, 'register on a secure page after redirect from an non-secure url');
+
+promise_test(function(t) {
+ var target_url = get_host_info()['UNAUTHENTICATED_ORIGIN'] + base_path() +
+ 'resources/http-to-https-redirect-and-register-iframe.html';
+
+ return redirect_and_register(target_url)
+ .then(result => {
+ assert_equals(result, 'FAIL: SecurityError');
+ });
+ }, 'register on a non-secure page after redirect from an non-secure url');
+</script>
+</body>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/http-to-https-redirect-and-register-iframe.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698