| 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..7bef37fbf5a5e6144125a3da51cd99a32061debb 100644
|
| --- a/net/cookies/cookie_store_unittest.h
|
| +++ b/net/cookies/cookie_store_unittest.h
|
| @@ -465,6 +465,46 @@ TYPED_TEST_P(CookieStoreTest, SetCookieWithDetailsAsync) {
|
| EXPECT_TRUE(++it == cookies.end());
|
| }
|
|
|
| +// The iOS networking stack uses the iOS cookie parser, which we do not
|
| +// control. While it is spec-compliant, that does not match the practical
|
| +// behavior of most UAs in some cases, which we try to replicate. See
|
| +// https://crbug.com/638389 for more information.
|
| +TYPED_TEST_P(CookieStoreTest, EmptyKeyTest) {
|
| +#if !defined(OS_IOS)
|
| + 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));
|
| +#endif
|
| +}
|
| +
|
| TYPED_TEST_P(CookieStoreTest, DomainTest) {
|
| CookieStore* cs = this->GetCookieStore();
|
| EXPECT_TRUE(this->SetCookie(cs, this->http_www_google_.url(), "A=B"));
|
| @@ -562,6 +602,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="));
|
|
|
| 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 +1417,7 @@ TYPED_TEST_P(CookieStoreTest, DeleteSessionCookie) {
|
|
|
| REGISTER_TYPED_TEST_CASE_P(CookieStoreTest,
|
| SetCookieWithDetailsAsync,
|
| + EmptyKeyTest,
|
| DomainTest,
|
| DomainWithTrailingDotTest,
|
| ValidSubdomainTest,
|
|
|