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

Unified Diff: third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp

Issue 2148793008: CSP: Allow ':80' to match ':443' in source expressions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/csp/CSPSource.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp b/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp
index f888e039bd14c0ccb878764ef5cb5db2ef8ac827..00b142b253ec643d9478a8449819a4afe4a1ca8f 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPSourceTest.cpp
@@ -70,7 +70,7 @@ TEST_F(CSPSourceTest, RedirectMatching)
EXPECT_FALSE(source.matches(KURL(base, "http://example.com:9000/foo/"), ContentSecurityPolicy::DidNotRedirect));
}
-TEST_F(CSPSourceTest, InsecureSourceMatchesSecure)
+TEST_F(CSPSourceTest, InsecureSchemeMatchesSecureScheme)
{
KURL base;
CSPSource source(csp.get(), "http", "", 0, "/", CSPSource::NoWildcard, CSPSource::HasWildcard);
@@ -82,7 +82,7 @@ TEST_F(CSPSourceTest, InsecureSourceMatchesSecure)
EXPECT_FALSE(source.matches(KURL(base, "ftp://example.com:8000/")));
}
-TEST_F(CSPSourceTest, InsecureHostMatchesSecure)
+TEST_F(CSPSourceTest, InsecureHostSchemeMatchesSecureScheme)
{
KURL base;
CSPSource source(csp.get(), "http", "example.com", 0, "/", CSPSource::NoWildcard, CSPSource::HasWildcard);
@@ -93,4 +93,28 @@ TEST_F(CSPSourceTest, InsecureHostMatchesSecure)
EXPECT_FALSE(source.matches(KURL(base, "https://not-example.com:8000/")));
}
+TEST_F(CSPSourceTest, InsecureHostSchemePortMatchesSecurePort)
+{
+ KURL base;
+ CSPSource source(csp.get(), "http", "example.com", 80, "/", CSPSource::NoWildcard, CSPSource::NoWildcard);
+ EXPECT_TRUE(source.matches(KURL(base, "http://example.com/")));
+ EXPECT_TRUE(source.matches(KURL(base, "http://example.com:80/")));
+ EXPECT_TRUE(source.matches(KURL(base, "http://example.com:443/")));
+ EXPECT_TRUE(source.matches(KURL(base, "https://example.com/")));
+ EXPECT_TRUE(source.matches(KURL(base, "https://example.com:80/")));
+ EXPECT_TRUE(source.matches(KURL(base, "https://example.com:443/")));
+
+ EXPECT_FALSE(source.matches(KURL(base, "http://example.com:8443/")));
+ EXPECT_FALSE(source.matches(KURL(base, "https://example.com:8443/")));
+
+ EXPECT_FALSE(source.matches(KURL(base, "http://not-example.com/")));
+ EXPECT_FALSE(source.matches(KURL(base, "http://not-example.com:80/")));
+ EXPECT_FALSE(source.matches(KURL(base, "http://not-example.com:443/")));
+ EXPECT_FALSE(source.matches(KURL(base, "https://not-example.com/")));
+ EXPECT_FALSE(source.matches(KURL(base, "https://not-example.com:80/")));
+ EXPECT_FALSE(source.matches(KURL(base, "https://not-example.com:443/")));
+}
+
+
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/frame/csp/CSPSource.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698