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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/iframe-upgrade.https.html

Issue 2053693002: WIP: Move 'Upgrade-Insecure-Requests' to the browser process. Base URL: https://chromium.googlesource.com/chromium/src.git@replicate
Patch Set: DCHECK. Created 4 years 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/http/tests/security/upgrade-insecure-requests/iframe-upgrade.https.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/iframe-upgrade.https.html b/third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/iframe-upgrade.https.html
index e6bd69d1c24ed280e5f04e50bf1b3697e0a758ab..5863f5644be6b6dc89f86896f8d79e42d15fd0ab 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/iframe-upgrade.https.html
+++ b/third_party/WebKit/LayoutTests/http/tests/security/upgrade-insecure-requests/iframe-upgrade.https.html
@@ -3,73 +3,20 @@
<title>Upgrade Insecure Requests: IFrames.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
+<script src="./resources/testharness-helper.js"></script>
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
</head>
<body>
<script>
-async_test(t => {
- var i = document.createElement('iframe');
-
- // This is a bit of a hack. UPGRADE doesn't upgrade the port number, so we
- // specify this non-existent URL ('http' over port 8443). If UPGRADE doesn't
- // work, it won't load.
- i.src = "http://127.0.0.1:8443/security/resources/post-origin-to-parent.html";
-
- window.addEventListener('message', t.step_func(e => {
- if (e.source == i.contentWindow) {
- assert_equals("https://127.0.0.1:8443", e.data.origin);
- t.done();
- }
- }));
- document.body.appendChild(i);
-}, "Same-host frames are upgraded.");
-
-async_test(t => {
- var i = document.createElement('iframe');
-
- // This is a bit of a hack. UPGRADE doesn't upgrade the port number, so we
- // specify this non-existent URL ('http' over port 8443). If UPGRADE doesn't
- // work, it won't load.
- i.src = "http://example.test:8443/security/resources/post-origin-to-parent.html";
-
- window.addEventListener('message', t.step_func(e => {
- if (e.source == i.contentWindow) {
- assert_equals("https://example.test:8443", e.data.origin);
- t.done();
- }
- }));
- document.body.appendChild(i);
-}, "Cross-host frames are upgraded.");
-
-async_test(t => {
- var i = document.createElement('iframe');
- i.srcdoc = "<a href='http://127.0.0.1:8443/security/resources/post-origin-to-parent.html'>Navigate!</a>" +
- "<script>document.querySelector('a').click()</scr" + "ipt>";
-
- window.addEventListener('message', t.step_func(e => {
- if (e.source == i.contentWindow) {
- assert_equals("https://127.0.0.1:8443", e.data.origin);
- t.done();
- }
- }));
-
- document.body.appendChild(i);
-}, "Upgrade policy cascades to nested, same-host frames.");
-
-async_test(t => {
- var i = document.createElement('iframe');
- i.srcdoc = "<a href='http://example.test:8443/security/resources/post-origin-to-parent.html'>Navigate!</a>" +
- "<script>document.querySelector('a').click()</scr" + "ipt>";
-
- window.addEventListener('message', t.step_func(e => {
- if (e.source == i.contentWindow) {
- assert_equals("https://example.test:8443", e.data.origin);
- t.done();
- }
- }));
-
- document.body.appendChild(i);
-}, "Upgrade policy cascades to nested, cross-host frames.");
+var tests = [
+ generateURL(Host.SAME_ORIGIN, Protocol.INSECURE, ResourceType.FRAME),
+ generateURL(Host.SAME_ORIGIN, Protocol.SECURE, ResourceType.FRAME),
+ generateURL(Host.CROSS_ORIGIN, Protocol.INSECURE, ResourceType.FRAME),
+ generateURL(Host.CROSS_ORIGIN, Protocol.SECURE, ResourceType.FRAME),
+];
+
+tests.forEach(test => {
+ async_test(t => assert_frame_loads(t, test.url), test.name);
+});
</script>
-</body>

Powered by Google App Engine
This is Rietveld 408576698