OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 5 #ifndef NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
6 #define NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 6 #define NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 this->GetCookies( | 580 this->GetCookies( |
581 cs, GURL(this->http_www_google_.Format("http://bla.www.%D")))); | 581 cs, GURL(this->http_www_google_.Format("http://bla.www.%D")))); |
582 this->MatchCookieLines("A=B; C=D; E=F; G=H", | 582 this->MatchCookieLines("A=B; C=D; E=F; G=H", |
583 this->GetCookies(cs, this->http_www_google_.url())); | 583 this->GetCookies(cs, this->http_www_google_.url())); |
584 } | 584 } |
585 | 585 |
586 // FireFox recognizes domains containing trailing periods as valid. | 586 // FireFox recognizes domains containing trailing periods as valid. |
587 // IE and Safari do not. Assert the expected policy here. | 587 // IE and Safari do not. Assert the expected policy here. |
588 TYPED_TEST_P(CookieStoreTest, DomainWithTrailingDotTest) { | 588 TYPED_TEST_P(CookieStoreTest, DomainWithTrailingDotTest) { |
589 CookieStore* cs = this->GetCookieStore(); | 589 CookieStore* cs = this->GetCookieStore(); |
590 EXPECT_FALSE(this->SetCookie(cs, this->http_www_google_.url(), | 590 if (TypeParam::preserves_trailing_dots) { |
591 "a=1; domain=.www.google.com.")); | 591 EXPECT_FALSE(this->SetCookie(cs, this->http_www_google_.url(), |
592 EXPECT_FALSE(this->SetCookie(cs, this->http_www_google_.url(), | 592 "a=1; domain=.www.google.izzle.")); |
593 "b=2; domain=.www.google.com..")); | 593 EXPECT_FALSE(this->SetCookie(cs, this->http_www_google_.url(), |
594 this->MatchCookieLines(std::string(), | 594 "b=2; domain=.www.google.izzle..")); |
595 this->GetCookies(cs, this->http_www_google_.url())); | 595 this->MatchCookieLines(std::string(), |
| 596 this->GetCookies(cs, this->http_www_google_.url())); |
| 597 } else { |
| 598 EXPECT_TRUE(this->SetCookie(cs, this->http_www_google_.url(), |
| 599 "a=1; domain=.www.google.izzle.")); |
| 600 EXPECT_FALSE(this->SetCookie(cs, this->http_www_google_.url(), |
| 601 "b=2; domain=.www.google.izzle..")); |
| 602 this->MatchCookieLines("a=1", |
| 603 this->GetCookies(cs, this->http_www_google_.url())); |
| 604 } |
596 } | 605 } |
597 | 606 |
598 // Test that cookies can bet set on higher level domains. | 607 // Test that cookies can bet set on higher level domains. |
599 TYPED_TEST_P(CookieStoreTest, ValidSubdomainTest) { | 608 TYPED_TEST_P(CookieStoreTest, ValidSubdomainTest) { |
600 CookieStore* cs = this->GetCookieStore(); | 609 CookieStore* cs = this->GetCookieStore(); |
601 GURL url_abcd("http://a.b.c.d.com"); | 610 GURL url_abcd("http://a.b.c.d.com"); |
602 GURL url_bcd("http://b.c.d.com"); | 611 GURL url_bcd("http://b.c.d.com"); |
603 GURL url_cd("http://c.d.com"); | 612 GURL url_cd("http://c.d.com"); |
604 GURL url_d("http://d.com"); | 613 GURL url_d("http://d.com"); |
605 | 614 |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 OverwritePersistentCookie, | 1494 OverwritePersistentCookie, |
1486 CookieOrdering, | 1495 CookieOrdering, |
1487 GetAllCookiesAsync, | 1496 GetAllCookiesAsync, |
1488 DeleteCookieAsync, | 1497 DeleteCookieAsync, |
1489 DeleteCanonicalCookieAsync, | 1498 DeleteCanonicalCookieAsync, |
1490 DeleteSessionCookie); | 1499 DeleteSessionCookie); |
1491 | 1500 |
1492 } // namespace net | 1501 } // namespace net |
1493 | 1502 |
1494 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 1503 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
OLD | NEW |