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

Unified Diff: net/cookies/cookie_store_unittest.h

Issue 2246613003: Update cookie value and attribute setting behavior to match other UAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Updated ParsedCookie unittests 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
« no previous file with comments | « no previous file | net/cookies/parsed_cookie.cc » ('j') | net/cookies/parsed_cookie.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/cookie_store_unittest.h
diff --git a/net/cookies/cookie_store_unittest.h b/net/cookies/cookie_store_unittest.h
index 3f8b037cef84c7e61ccd3acb8f2cb93b3cbf6d33..65bf4aec1f01e0f954f657aa80f4ae14a7274143 100644
--- a/net/cookies/cookie_store_unittest.h
+++ b/net/cookies/cookie_store_unittest.h
@@ -465,6 +465,40 @@ TYPED_TEST_P(CookieStoreTest, SetCookieWithDetailsAsync) {
EXPECT_TRUE(++it == cookies.end());
}
+TYPED_TEST_P(CookieStoreTest, EmptyKeyTest) {
+ CookieStore* cs = this->GetCookieStore();
+
+ GURL url1("http://foo1.bar.com");
+ EXPECT_TRUE(this->SetCookie(cs, url1, "foo"));
+ EXPECT_EQ("foo", this->GetCookies(cs, url1));
+
+ // Regression tests for https://crbug.com/601786
+ GURL url2("http://foo2.bar.com");
+ EXPECT_TRUE(this->SetCookie(cs, url2, "foo"));
+ EXPECT_TRUE(this->SetCookie(cs, url2, "\t"));
+ EXPECT_EQ("", this->GetCookies(cs, url2));
+
+ GURL url3("http://foo3.bar.com");
+ EXPECT_TRUE(this->SetCookie(cs, url3, "foo"));
+ EXPECT_TRUE(this->SetCookie(cs, url3, "="));
+ EXPECT_EQ("", this->GetCookies(cs, url3));
+
+ GURL url4("http://foo4.bar.com");
+ EXPECT_TRUE(this->SetCookie(cs, url4, "foo"));
+ EXPECT_TRUE(this->SetCookie(cs, url4, ""));
+ EXPECT_EQ("", this->GetCookies(cs, url4));
+
+ GURL url5("http://foo5.bar.com");
+ EXPECT_TRUE(this->SetCookie(cs, url5, "foo"));
+ EXPECT_TRUE(this->SetCookie(cs, url5, "; bar"));
+ EXPECT_EQ("", this->GetCookies(cs, url5));
+
+ GURL url6("http://foo6.bar.com");
+ EXPECT_TRUE(this->SetCookie(cs, url6, "foo"));
+ EXPECT_TRUE(this->SetCookie(cs, url6, " "));
+ EXPECT_EQ("", this->GetCookies(cs, url6));
+}
+
TYPED_TEST_P(CookieStoreTest, DomainTest) {
CookieStore* cs = this->GetCookieStore();
EXPECT_TRUE(this->SetCookie(cs, this->http_www_google_.url(), "A=B"));
@@ -562,6 +596,9 @@ TYPED_TEST_P(CookieStoreTest, InvalidDomainTest) {
// More specific sub-domain than allowed.
EXPECT_FALSE(this->SetCookie(cs, url_foobar, "a=1; domain=.yo.foo.bar.com"));
+ // Regression test for https://crbug.com/601786
+ EXPECT_FALSE(
+ this->SetCookie(cs, url_foobar, "a=1; domain=.yo.foo.bar.com; domain="));
mmenke 2016/08/15 21:11:03 Why does this fail? Aren't we ignoring the "domai
jww 2016/08/16 02:24:23 No, that's part of the issue and difference in beh
mmenke 2016/08/16 15:06:46 Oh, I missed that the previous line was also EXPEC
EXPECT_FALSE(this->SetCookie(cs, url_foobar, "b=2; domain=.foo.com"));
EXPECT_FALSE(this->SetCookie(cs, url_foobar, "c=3; domain=.bar.foo.com"));
@@ -1374,6 +1411,7 @@ TYPED_TEST_P(CookieStoreTest, DeleteSessionCookie) {
REGISTER_TYPED_TEST_CASE_P(CookieStoreTest,
SetCookieWithDetailsAsync,
+ EmptyKeyTest,
DomainTest,
DomainWithTrailingDotTest,
ValidSubdomainTest,
« no previous file with comments | « no previous file | net/cookies/parsed_cookie.cc » ('j') | net/cookies/parsed_cookie.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698