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

Unified Diff: third_party/WebKit/Source/core/dom/DocumentTest.cpp

Issue 2075053003: Add basic Referrer-Policy support for Documents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update test expectation for tweaked console message Created 4 years, 6 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/dom/DocumentTest.cpp
diff --git a/third_party/WebKit/Source/core/dom/DocumentTest.cpp b/third_party/WebKit/Source/core/dom/DocumentTest.cpp
index f4cab42eaa3f5c5c49a0739ce219a5add123a87a..b7f3156c6fb14154f21656d32cebca411fa21ef5 100644
--- a/third_party/WebKit/Source/core/dom/DocumentTest.cpp
+++ b/third_party/WebKit/Source/core/dom/DocumentTest.cpp
@@ -185,12 +185,18 @@ TEST_F(DocumentTest, referrerPolicyParsing)
const char* policy;
ReferrerPolicy expected;
} tests[] = {
+ { "", ReferrerPolicyDefault },
+ // Test that invalid policy values are ignored.
+ { "not-a-real-policy", ReferrerPolicyDefault },
+ { "not-a-real-policy,also-not-a-real-policy", ReferrerPolicyDefault },
+ { "not-a-real-policy,unsafe-url", ReferrerPolicyAlways },
+ { "unsafe-url,not-a-real-policy", ReferrerPolicyAlways },
+ // Test parsing each of the policy values.
{ "always", ReferrerPolicyAlways },
{ "default", ReferrerPolicyNoReferrerWhenDowngrade },
{ "never", ReferrerPolicyNever },
{ "no-referrer", ReferrerPolicyNever },
{ "no-referrer-when-downgrade", ReferrerPolicyNoReferrerWhenDowngrade },
- { "not-a-real-policy", ReferrerPolicyDefault },
{ "origin", ReferrerPolicyOrigin },
{ "origin-when-crossorigin", ReferrerPolicyOriginWhenCrossOrigin },
{ "origin-when-cross-origin", ReferrerPolicyOriginWhenCrossOrigin },
@@ -199,8 +205,7 @@ TEST_F(DocumentTest, referrerPolicyParsing)
for (auto test : tests) {
document().setReferrerPolicy(ReferrerPolicyDefault);
-
- document().processReferrerPolicy(test.policy);
+ document().parseAndSetReferrerPolicy(test.policy);
EXPECT_EQ(test.expected, document().getReferrerPolicy()) << test.policy;
}
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/ExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698