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

Unified Diff: chrome/common/extensions/csp_validator_unittest.cc

Issue 10855122: Whitelisting `127.0.0.1` and `localhost` for HTTP in extensions' CSP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Second pass. Created 8 years, 4 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: chrome/common/extensions/csp_validator_unittest.cc
diff --git a/chrome/common/extensions/csp_validator_unittest.cc b/chrome/common/extensions/csp_validator_unittest.cc
index 33c3deb164e650095f0608b9457318793b514fa1..4caab6d6f3bb6329e7986dcd6698f834c432e9b9 100644
--- a/chrome/common/extensions/csp_validator_unittest.cc
+++ b/chrome/common/extensions/csp_validator_unittest.cc
@@ -76,6 +76,21 @@ TEST(ExtensionCSPValidator, IsSecure) {
"default-src 'self' google.com"));
EXPECT_TRUE(ContentSecurityPolicyIsSecure(
"default-src 'self' https://*.google.com"));
+
+ EXPECT_TRUE(ContentSecurityPolicyIsSecure(
+ "default-src 'self' http://127.0.0.1"));
+ EXPECT_TRUE(ContentSecurityPolicyIsSecure(
+ "default-src 'self' http://localhost"));
+ EXPECT_TRUE(ContentSecurityPolicyIsSecure(
+ "default-src 'self' http://lOcAlHoSt"));
+ EXPECT_TRUE(ContentSecurityPolicyIsSecure(
+ "default-src 'self' http://127.0.0.1:9999"));
+ EXPECT_TRUE(ContentSecurityPolicyIsSecure(
+ "default-src 'self' http://localhost:8888"));
+ EXPECT_FALSE(ContentSecurityPolicyIsSecure(
+ "default-src 'self' http://127.0.0.1.example.com"));
+ EXPECT_FALSE(ContentSecurityPolicyIsSecure(
+ "default-src 'self' http://localhost.example.com"));
}
TEST(ExtensionCSPValidator, IsSandboxed) {
« no previous file with comments | « chrome/common/extensions/csp_validator.cc ('k') | chrome/common/extensions/docs/extensions/contentSecurityPolicy.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698