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

Unified Diff: LayoutTests/http/tests/security/contentSecurityPolicy/resources/csp-header-is-sent.js

Issue 1009583003: Add CSP header for resources with an active policy (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add return statement to avoid compiler error Created 5 years, 9 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: LayoutTests/http/tests/security/contentSecurityPolicy/resources/csp-header-is-sent.js
diff --git a/LayoutTests/http/tests/security/contentSecurityPolicy/resources/csp-header-is-sent.js b/LayoutTests/http/tests/security/contentSecurityPolicy/resources/csp-header-is-sent.js
new file mode 100644
index 0000000000000000000000000000000000000000..cbb985d033f6b27290d0240bd614fed30bf4b5f7
--- /dev/null
+++ b/LayoutTests/http/tests/security/contentSecurityPolicy/resources/csp-header-is-sent.js
@@ -0,0 +1,17 @@
+async_test(function(t) {
+ var xhr = new XMLHttpRequest();
+ xhr.onload = function () {
+ t.step(function () { assert_true(xhr.status === 404); t.done(); });
+ };
+ // Send a request that returns 200 if and only if CSP header is present.
+ xhr.open(
+ "GET",
+ "http://127.0.0.1:8000/security/contentSecurityPolicy/resources/test-csp-header.pl",
+ true
+ );
+ xhr.send();
+}, 'CSP header is not sent on resource requests for which there is no policy.');
+
+test(function() {
+ assert_true(typeof(script_loaded) !== "undefined");
+}, 'CSP header is sent on resource requests for which there is a policy.');

Powered by Google App Engine
This is Rietveld 408576698