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

Unified Diff: net/url_request/url_request_job_unittest.cc

Issue 2278823004: Stop supporting legacy keywords in Referrer-Policy header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: jochen comment Created 4 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: net/url_request/url_request_job_unittest.cc
diff --git a/net/url_request/url_request_job_unittest.cc b/net/url_request/url_request_job_unittest.cc
index cf338b0520804c32d242152d841af5c7be6372d4..9a0e4d7739c781400791509f018a50093572c868 100644
--- a/net/url_request/url_request_job_unittest.cc
+++ b/net/url_request/url_request_job_unittest.cc
@@ -271,14 +271,16 @@ TEST(URLRequestJob, RedirectTransactionWithReferrerPolicyHeader) {
URLRequest::NO_REFERRER /* expected final policy */,
"" /* expected final referrer */},
- // Same as above but for the legacy keyword 'never'.
+ // Same as above but for the legacy keyword 'never', which should
+ // not be supported.
{"http://foo.test/one" /* original url */,
"http://foo.test/one" /* original referrer */,
"Location: http://foo.test/test\nReferrer-Policy: never\n",
// original policy
URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE,
- URLRequest::NO_REFERRER /* expected final policy */,
- "" /* expected final referrer */},
+ // expected final policy
+ URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE,
+ "http://foo.test/one" /* expected final referrer */},
// If a redirect serves 'Referrer-Policy:
// no-referrer-when-downgrade', then the referrer should be cleared
@@ -293,15 +295,16 @@ TEST(URLRequestJob, RedirectTransactionWithReferrerPolicyHeader) {
URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE,
"" /* expected final referrer */},
- // Same as above but for the legacy keyword 'default'.
+ // Same as above but for the legacy keyword 'default', which
+ // should not be supported.
{"https://foo.test/one" /* original url */,
"https://foo.test/one" /* original referrer */,
"Location: http://foo.test\n"
"Referrer-Policy: default\n",
URLRequest::NEVER_CLEAR_REFERRER /* original policy */,
// expected final policy
- URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE,
- "" /* expected final referrer */},
+ URLRequest::NEVER_CLEAR_REFERRER,
+ "https://foo.test/one" /* expected final referrer */},
// If a redirect serves 'Referrer-Policy: origin', then the referrer
// should be stripped to its origin, even if the original request's
@@ -346,14 +349,16 @@ TEST(URLRequestJob, RedirectTransactionWithReferrerPolicyHeader) {
URLRequest::NEVER_CLEAR_REFERRER /* expected final policy */,
"https://foo.test/one" /* expected final referrer */},
- // Same as above but for the legacy keyword 'always'.
+ // Same as above but for the legacy keyword 'always', which should
+ // not be supported.
{"https://foo.test/one" /* original url */,
"https://foo.test/one" /* original referrer */,
"Location: https://bar.test/two\n"
"Referrer-Policy: always\n",
URLRequest::ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN /* original policy */,
- URLRequest::NEVER_CLEAR_REFERRER /* expected final policy */,
- "https://foo.test/one" /* expected final referrer */},
+ URLRequest::
+ ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN /* expected final policy */,
+ "https://foo.test/" /* expected final referrer */},
// An invalid keyword should leave the policy untouched.
{"https://foo.test/one" /* original url */,

Powered by Google App Engine
This is Rietveld 408576698