| 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 EXPECT_TRUE(this->SetCookie(cs, url_bcd, "X=cd; domain=.c.d.com")); | 590 EXPECT_TRUE(this->SetCookie(cs, url_bcd, "X=cd; domain=.c.d.com")); |
| 591 this->MatchCookieLines("b=2; c=3; d=4; X=bcd; X=cd", | 591 this->MatchCookieLines("b=2; c=3; d=4; X=bcd; X=cd", |
| 592 this->GetCookies(cs, url_bcd)); | 592 this->GetCookies(cs, url_bcd)); |
| 593 this->MatchCookieLines("c=3; d=4; X=cd", this->GetCookies(cs, url_cd)); | 593 this->MatchCookieLines("c=3; d=4; X=cd", this->GetCookies(cs, url_cd)); |
| 594 } | 594 } |
| 595 | 595 |
| 596 // Test that setting a cookie which specifies an invalid domain has | 596 // Test that setting a cookie which specifies an invalid domain has |
| 597 // no side-effect. An invalid domain in this context is one which does | 597 // no side-effect. An invalid domain in this context is one which does |
| 598 // not match the originating domain. | 598 // not match the originating domain. |
| 599 TYPED_TEST_P(CookieStoreTest, InvalidDomainTest) { | 599 TYPED_TEST_P(CookieStoreTest, InvalidDomainTest) { |
| 600 #if defined(__IPHONE_10_0) | |
| 601 // TODO(crbug.com/639167): Reenable this test on iOS10. | |
| 602 return; | |
| 603 #endif | |
| 604 CookieStore* cs = this->GetCookieStore(); | 600 CookieStore* cs = this->GetCookieStore(); |
| 605 GURL url_foobar("http://foo.bar.com"); | 601 GURL url_foobar("http://foo.bar.com"); |
| 606 | 602 |
| 607 // More specific sub-domain than allowed. | 603 // More specific sub-domain than allowed. |
| 608 EXPECT_FALSE(this->SetCookie(cs, url_foobar, "a=1; domain=.yo.foo.bar.com")); | 604 EXPECT_FALSE(this->SetCookie(cs, url_foobar, "a=1; domain=.yo.foo.bar.com")); |
| 605 |
| 606 // The iOS networking stack uses the iOS cookie parser, which we do not |
| 607 // control. Its handling of multiple domain= values in cookie string varies |
| 608 // depending on iOS version. See https://crbug.com/639167 |
| 609 #if !defined(OS_IOS) |
| 609 // Regression test for https://crbug.com/601786 | 610 // Regression test for https://crbug.com/601786 |
| 610 EXPECT_FALSE( | 611 EXPECT_FALSE( |
| 611 this->SetCookie(cs, url_foobar, "a=1; domain=.yo.foo.bar.com; domain=")); | 612 this->SetCookie(cs, url_foobar, "a=1; domain=.yo.foo.bar.com; domain=")); |
| 613 #endif // !defined(OS_IOS) |
| 612 | 614 |
| 613 EXPECT_FALSE(this->SetCookie(cs, url_foobar, "b=2; domain=.foo.com")); | 615 EXPECT_FALSE(this->SetCookie(cs, url_foobar, "b=2; domain=.foo.com")); |
| 614 EXPECT_FALSE(this->SetCookie(cs, url_foobar, "c=3; domain=.bar.foo.com")); | 616 EXPECT_FALSE(this->SetCookie(cs, url_foobar, "c=3; domain=.bar.foo.com")); |
| 615 | 617 |
| 616 // Different TLD, but the rest is a substring. | 618 // Different TLD, but the rest is a substring. |
| 617 EXPECT_FALSE(this->SetCookie(cs, url_foobar, "d=4; domain=.foo.bar.com.net")); | 619 EXPECT_FALSE(this->SetCookie(cs, url_foobar, "d=4; domain=.foo.bar.com.net")); |
| 618 | 620 |
| 619 // A substring that isn't really a parent domain. | 621 // A substring that isn't really a parent domain. |
| 620 EXPECT_FALSE(this->SetCookie(cs, url_foobar, "e=5; domain=ar.com")); | 622 EXPECT_FALSE(this->SetCookie(cs, url_foobar, "e=5; domain=ar.com")); |
| 621 | 623 |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 OverwritePersistentCookie, | 1456 OverwritePersistentCookie, |
| 1455 CookieOrdering, | 1457 CookieOrdering, |
| 1456 GetAllCookiesAsync, | 1458 GetAllCookiesAsync, |
| 1457 DeleteCookieAsync, | 1459 DeleteCookieAsync, |
| 1458 DeleteCanonicalCookieAsync, | 1460 DeleteCanonicalCookieAsync, |
| 1459 DeleteSessionCookie); | 1461 DeleteSessionCookie); |
| 1460 | 1462 |
| 1461 } // namespace net | 1463 } // namespace net |
| 1462 | 1464 |
| 1463 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 1465 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
| OLD | NEW |