Chromium Code Reviews| 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..0b8bae0e4efc1dd66f2c72511ec2d79c4002a4f6 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/XXXXXX for more information. |
| +#if !defined(OS_IOS) |
| +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)); |
| +} |
| +#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,9 @@ TYPED_TEST_P(CookieStoreTest, DeleteSessionCookie) { |
| REGISTER_TYPED_TEST_CASE_P(CookieStoreTest, |
| SetCookieWithDetailsAsync, |
| +#if !defined(OS_IOS) |
| + EmptyKeyTest, |
| +#endif |
|
mmenke
2016/08/17 16:23:17
Looks like Windows doesn't like this (I guess I do
jww
2016/08/17 16:57:08
Done.
|
| DomainTest, |
| DomainWithTrailingDotTest, |
| ValidSubdomainTest, |