Index: third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/external-to-internal-fetch.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/external-to-internal-fetch.html b/third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/external-to-internal-fetch.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..268d50f848bdcc66d7ce8e1835888b8f88a66714 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/external-to-internal-fetch.html |
@@ -0,0 +1,29 @@ |
+<!doctype html> |
+<html> |
+<head> |
+ <meta http-equiv="Content-Security-Policy" content="treat-as-public-address"> |
+ <script src="/resources/testharness.js"></script> |
+ <script src="/resources/testharnessreport.js"></script> |
+ <script src="./resources/preflight.js"></script> |
+</head> |
+<body> |
+ <script> |
+ promise_test(function (t) { |
+ return promise_rejects(t, new TypeError(), fetch(preflightURL('fail-with-500', 'json'))); |
+ }, "'fetch()' should fail on failed preflight: 500 status"); |
+ |
+ promise_test(function (t) { |
+ return promise_rejects(t, new TypeError(), fetch(preflightURL('fail-without-allow', 'json'))); |
+ }, "'fetch()' should fail on failed preflight: no allow-external"); |
+ |
+ promise_test(function (t) { |
+ return fetch(preflightURL('pass', 'json')) |
+ .then(function (response) { |
+ return response.json(); |
+ }).then(function (json) { |
+ assert_equals('success', json.jsonpResult); |
+ }); |
+ }, "'fetch()' should pass on successful preflight"); |
+ </script> |
+</body> |
+</html> |