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, |