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

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

Issue 2657623005: WIP: Give developers an opt-in mechanism to block some parser-inserted scripts.
Patch Set: Refactor. Created 3 years, 11 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/Source/core/frame/csp/SourceListDirectiveTest.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/SourceListDirectiveTest.cpp b/third_party/WebKit/Source/core/frame/csp/SourceListDirectiveTest.cpp
index a2e10a38b846664ddcaaaf7bb2b28cc0de2ae483..891bfdde62afdd530dd13a2d6f9b547998f68457 100644
--- a/third_party/WebKit/Source/core/frame/csp/SourceListDirectiveTest.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/SourceListDirectiveTest.cpp
@@ -80,6 +80,22 @@ TEST_F(SourceListDirectiveTest, BasicMatchingUnsafeHashedAttributes) {
EXPECT_TRUE(sourceList.allowHashedAttributes());
}
+TEST_F(SourceListDirectiveTest, BasicMatchingParserInserted) {
+ {
+ String sources = "https://example.com 'strict-dynamic'";
+ SourceListDirective sourceList("script-src", sources, csp.get());
+ EXPECT_TRUE(sourceList.allowParserInsertedFromScript());
+ }
+
+ {
+ String sources =
+ "'disallow-all-the-parser-inserted-scripts-ever-except-for-the-ones-we-"
+ "like'";
+ SourceListDirective sourceList("script-src", sources, csp.get());
+ EXPECT_FALSE(sourceList.allowParserInsertedFromScript());
+ }
+}
+
TEST_F(SourceListDirectiveTest, BasicMatchingStar) {
KURL base;
String sources = "*";

Powered by Google App Engine
This is Rietveld 408576698