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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/resources/addressspace-test.js

Issue 1754713006: CORS-RFC1918: Introduce the 'addressSpace' IDL attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: philip Created 4 years, 10 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/http/tests/security/cors-rfc1918/resources/addressspace-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/resources/addressspace-test.js b/third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/resources/addressspace-test.js
new file mode 100644
index 0000000000000000000000000000000000000000..fb43ae1fa351042a28abae23c97acccc1760c32e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/resources/addressspace-test.js
@@ -0,0 +1,29 @@
+function createIFrame(origin, type) {
+ var file;
+ if (type == "document") {
+ file = "post-addressspace-to-parent.html";
+ } else if (type == "document+csp") {
+ file = "post-addressspace-to-parent.html?csp";
+ } else if (type == "worker") {
+ file = "post-addressspace-from-worker.html";
+ }
+
+ var i = document.createElement('iframe');
+ i.src = origin + "/security/cors-rfc1918/resources/" + file;
+ return i;
+}
+
+function addressSpaceTest(origin, type, expected) {
+ async_test(function (t) {
+ var i = createIFrame(origin, type);
+ window.addEventListener("message", t.step_func(function (e) {
+ if (e.source == i.contentWindow) {
+ assert_equals(e.data.origin, origin);
+ assert_equals(e.data.addressSpace, expected);
+ t.done();
+ }
+ }));
+
+ document.body.appendChild(i);
+ }, origin + " = '" + expected + "'");
+}

Powered by Google App Engine
This is Rietveld 408576698