Chromium Code Reviews| 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 EXPECT_FALSE(this->SetCookie(cs, this->http_www_google_.url(), |
| 591 "a=1; domain=.www.google.com.")); | 591 "a=1; domain=.www.google.izzle.")); |
| 592 EXPECT_FALSE(this->SetCookie(cs, this->http_www_google_.url(), | 592 EXPECT_FALSE(this->SetCookie(cs, this->http_www_google_.url(), |
| 593 "b=2; domain=.www.google.com..")); | 593 "b=2; domain=.www.google.izzle..")); |
| 594 this->MatchCookieLines(std::string(), | 594 this->MatchCookieLines(std::string(), |
| 595 this->GetCookies(cs, this->http_www_google_.url())); | 595 this->GetCookies(cs, this->http_www_google_.url())); |
| 596 } | 596 } |
| 597 | 597 |
| 598 // Test that cookies can bet set on higher level domains. | 598 // Test that cookies can bet set on higher level domains. |
| 599 TYPED_TEST_P(CookieStoreTest, ValidSubdomainTest) { | 599 TYPED_TEST_P(CookieStoreTest, ValidSubdomainTest) { |
| 600 CookieStore* cs = this->GetCookieStore(); | 600 CookieStore* cs = this->GetCookieStore(); |
| 601 GURL url_abcd("http://a.b.c.d.com"); | 601 GURL url_abcd("http://a.b.c.d.com"); |
| 602 GURL url_bcd("http://b.c.d.com"); | 602 GURL url_bcd("http://b.c.d.com"); |
| 603 GURL url_cd("http://c.d.com"); | 603 GURL url_cd("http://c.d.com"); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 689 GURL url_filefront("http://www.filefront.com"); | 689 GURL url_filefront("http://www.filefront.com"); |
| 690 EXPECT_TRUE(this->SetCookie(cs, url_hosted, "sawAd=1; domain=filefront.com")); | 690 EXPECT_TRUE(this->SetCookie(cs, url_hosted, "sawAd=1; domain=filefront.com")); |
| 691 this->MatchCookieLines("sawAd=1", this->GetCookies(cs, url_hosted)); | 691 this->MatchCookieLines("sawAd=1", this->GetCookies(cs, url_hosted)); |
| 692 this->MatchCookieLines("sawAd=1", this->GetCookies(cs, url_filefront)); | 692 this->MatchCookieLines("sawAd=1", this->GetCookies(cs, url_filefront)); |
| 693 } | 693 } |
| 694 | 694 |
| 695 // Even when the specified domain matches the domain of the URL exactly, treat | 695 // Even when the specified domain matches the domain of the URL exactly, treat |
| 696 // it as setting a domain cookie. | 696 // it as setting a domain cookie. |
| 697 TYPED_TEST_P(CookieStoreTest, DomainWithoutLeadingDotSameDomain) { | 697 TYPED_TEST_P(CookieStoreTest, DomainWithoutLeadingDotSameDomain) { |
| 698 CookieStore* cs = this->GetCookieStore(); | 698 CookieStore* cs = this->GetCookieStore(); |
| 699 GURL url("http://www.google.com"); | 699 GURL url("http://www.google.izzle"); |
| 700 EXPECT_TRUE(this->SetCookie(cs, url, "a=1; domain=www.google.com")); | 700 EXPECT_TRUE(this->SetCookie(cs, url, "a=1; domain=www.google.izzle")); |
| 701 this->MatchCookieLines("a=1", this->GetCookies(cs, url)); | 701 this->MatchCookieLines("a=1", this->GetCookies(cs, url)); |
| 702 this->MatchCookieLines( | 702 this->MatchCookieLines( |
| 703 "a=1", this->GetCookies(cs, GURL("http://sub.www.google.com"))); | 703 "a=1", this->GetCookies(cs, GURL("http://sub.www.google.izzle"))); |
| 704 this->MatchCookieLines( | 704 this->MatchCookieLines( |
| 705 std::string(), this->GetCookies(cs, GURL("http://something-else.com"))); | 705 std::string(), this->GetCookies(cs, GURL("http://something-else.com"))); |
| 706 } | 706 } |
| 707 | 707 |
| 708 // Test that the domain specified in cookie string is treated case-insensitive | 708 // Test that the domain specified in cookie string is treated case-insensitive |
| 709 TYPED_TEST_P(CookieStoreTest, CaseInsensitiveDomainTest) { | 709 TYPED_TEST_P(CookieStoreTest, CaseInsensitiveDomainTest) { |
| 710 CookieStore* cs = this->GetCookieStore(); | 710 CookieStore* cs = this->GetCookieStore(); |
| 711 GURL url("http://www.google.com"); | 711 GURL url("http://www.google.izzle"); |
| 712 EXPECT_TRUE(this->SetCookie(cs, url, "a=1; domain=.GOOGLE.COM")); | 712 EXPECT_TRUE(this->SetCookie(cs, url, "a=1; domain=.GOOGLE.IZZLE")); |
| 713 EXPECT_TRUE(this->SetCookie(cs, url, "b=2; domain=.wWw.gOOgLE.coM")); | 713 EXPECT_TRUE(this->SetCookie(cs, url, "b=2; domain=.wWw.gOOgLE.izzLE")); |
|
Randy Smith (Not in Mondays)
2017/06/08 15:47:28
Only location that wasn't a straight query replace
| |
| 714 this->MatchCookieLines("a=1; b=2", this->GetCookies(cs, url)); | 714 this->MatchCookieLines("a=1; b=2", this->GetCookies(cs, url)); |
| 715 } | 715 } |
| 716 | 716 |
| 717 TYPED_TEST_P(CookieStoreTest, TestIpAddress) { | 717 TYPED_TEST_P(CookieStoreTest, TestIpAddress) { |
| 718 GURL url_ip("http://1.2.3.4/weee"); | 718 GURL url_ip("http://1.2.3.4/weee"); |
| 719 CookieStore* cs = this->GetCookieStore(); | 719 CookieStore* cs = this->GetCookieStore(); |
| 720 EXPECT_TRUE(this->SetCookie(cs, url_ip, kValidCookieLine)); | 720 EXPECT_TRUE(this->SetCookie(cs, url_ip, kValidCookieLine)); |
| 721 this->MatchCookieLines("A=B", this->GetCookies(cs, url_ip)); | 721 this->MatchCookieLines("A=B", this->GetCookies(cs, url_ip)); |
| 722 } | 722 } |
| 723 | 723 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 777 TYPED_TEST_P(CookieStoreTest, TestSubdomainSettingCookiesOnUnknownTLD) { | 777 TYPED_TEST_P(CookieStoreTest, TestSubdomainSettingCookiesOnUnknownTLD) { |
| 778 CookieStore* cs = this->GetCookieStore(); | 778 CookieStore* cs = this->GetCookieStore(); |
| 779 GURL url("http://a.b"); | 779 GURL url("http://a.b"); |
| 780 EXPECT_FALSE(this->SetCookie(cs, url, "a=1; domain=.b")); | 780 EXPECT_FALSE(this->SetCookie(cs, url, "a=1; domain=.b")); |
| 781 EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=b")); | 781 EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=b")); |
| 782 this->MatchCookieLines(std::string(), this->GetCookies(cs, url)); | 782 this->MatchCookieLines(std::string(), this->GetCookies(cs, url)); |
| 783 } | 783 } |
| 784 | 784 |
| 785 TYPED_TEST_P(CookieStoreTest, TestSubdomainSettingCookiesOnKnownTLD) { | 785 TYPED_TEST_P(CookieStoreTest, TestSubdomainSettingCookiesOnKnownTLD) { |
| 786 CookieStore* cs = this->GetCookieStore(); | 786 CookieStore* cs = this->GetCookieStore(); |
| 787 GURL url("http://google.com"); | 787 GURL url("http://google.izzle"); |
| 788 EXPECT_FALSE(this->SetCookie(cs, url, "a=1; domain=.com")); | 788 EXPECT_FALSE(this->SetCookie(cs, url, "a=1; domain=.com")); |
| 789 EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=com")); | 789 EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=com")); |
| 790 this->MatchCookieLines(std::string(), this->GetCookies(cs, url)); | 790 this->MatchCookieLines(std::string(), this->GetCookies(cs, url)); |
| 791 } | 791 } |
| 792 | 792 |
| 793 TYPED_TEST_P(CookieStoreTest, TestSubdomainSettingCookiesOnKnownDottedTLD) { | 793 TYPED_TEST_P(CookieStoreTest, TestSubdomainSettingCookiesOnKnownDottedTLD) { |
| 794 CookieStore* cs = this->GetCookieStore(); | 794 CookieStore* cs = this->GetCookieStore(); |
| 795 GURL url("http://google.co.uk"); | 795 GURL url("http://google.co.uk"); |
| 796 EXPECT_FALSE(this->SetCookie(cs, url, "a=1; domain=.co.uk")); | 796 EXPECT_FALSE(this->SetCookie(cs, url, "a=1; domain=.co.uk")); |
| 797 EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=.uk")); | 797 EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=.uk")); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 825 // Make sure it doesn't show up for an intranet subdomain, it should be | 825 // Make sure it doesn't show up for an intranet subdomain, it should be |
| 826 // a host, not domain, cookie. | 826 // a host, not domain, cookie. |
| 827 this->MatchCookieLines( | 827 this->MatchCookieLines( |
| 828 std::string(), | 828 std::string(), |
| 829 this->GetCookies(cs, GURL("http://hopefully-no-cookies.b/"))); | 829 this->GetCookies(cs, GURL("http://hopefully-no-cookies.b/"))); |
| 830 this->MatchCookieLines(std::string(), | 830 this->MatchCookieLines(std::string(), |
| 831 this->GetCookies(cs, GURL("http://.b/"))); | 831 this->GetCookies(cs, GURL("http://.b/"))); |
| 832 } | 832 } |
| 833 | 833 |
| 834 // Test reading/writing cookies when the domain ends with a period, | 834 // Test reading/writing cookies when the domain ends with a period, |
| 835 // as in "www.google.com." | 835 // as in "www.google.izzle." |
| 836 TYPED_TEST_P(CookieStoreTest, TestHostEndsWithDot) { | 836 TYPED_TEST_P(CookieStoreTest, TestHostEndsWithDot) { |
| 837 CookieStore* cs = this->GetCookieStore(); | 837 CookieStore* cs = this->GetCookieStore(); |
| 838 GURL url("http://www.google.com"); | 838 GURL url("http://www.google.izzle"); |
| 839 GURL url_with_dot("http://www.google.com."); | 839 GURL url_with_dot("http://www.google.izzle."); |
| 840 EXPECT_TRUE(this->SetCookie(cs, url, "a=1")); | 840 EXPECT_TRUE(this->SetCookie(cs, url, "a=1")); |
| 841 this->MatchCookieLines("a=1", this->GetCookies(cs, url)); | 841 this->MatchCookieLines("a=1", this->GetCookies(cs, url)); |
| 842 | 842 |
| 843 // Do not share cookie space with the dot version of domain. | 843 // Do not share cookie space with the dot version of domain. |
| 844 // Note: this is not what FireFox does, but it _is_ what IE+Safari do. | 844 // Note: this is not what FireFox does, but it _is_ what IE+Safari do. |
| 845 if (TypeParam::preserves_trailing_dots) { | 845 if (TypeParam::preserves_trailing_dots) { |
| 846 EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=.www.google.com.")); | 846 EXPECT_FALSE(this->SetCookie(cs, url, "b=2; domain=.www.google.izzle.")); |
| 847 this->MatchCookieLines("a=1", this->GetCookies(cs, url)); | 847 this->MatchCookieLines("a=1", this->GetCookies(cs, url)); |
| 848 EXPECT_TRUE(this->SetCookie(cs, url_with_dot, "b=2; domain=.google.com.")); | 848 EXPECT_TRUE( |
| 849 this->SetCookie(cs, url_with_dot, "b=2; domain=.google.izzle.")); | |
| 849 this->MatchCookieLines("b=2", this->GetCookies(cs, url_with_dot)); | 850 this->MatchCookieLines("b=2", this->GetCookies(cs, url_with_dot)); |
| 850 } else { | 851 } else { |
| 851 EXPECT_TRUE(this->SetCookie(cs, url, "b=2; domain=.www.google.com.")); | 852 EXPECT_TRUE(this->SetCookie(cs, url, "b=2; domain=.www.google.izzle.")); |
| 852 this->MatchCookieLines("a=1 b=2", this->GetCookies(cs, url)); | 853 this->MatchCookieLines("a=1 b=2", this->GetCookies(cs, url)); |
| 853 // Setting this cookie should fail, since the trailing dot on the domain | 854 // Setting this cookie should fail, since the trailing dot on the domain |
| 854 // isn't preserved, and then the domain mismatches the URL. | 855 // isn't preserved, and then the domain mismatches the URL. |
| 855 EXPECT_FALSE(this->SetCookie(cs, url_with_dot, "b=2; domain=.google.com.")); | 856 EXPECT_FALSE( |
| 857 this->SetCookie(cs, url_with_dot, "b=2; domain=.google.izzle.")); | |
| 856 } | 858 } |
| 857 | 859 |
| 858 // Make sure there weren't any side effects. | 860 // Make sure there weren't any side effects. |
| 859 this->MatchCookieLines( | 861 this->MatchCookieLines( |
| 860 std::string(), | 862 std::string(), |
| 861 this->GetCookies(cs, GURL("http://hopefully-no-cookies.com/"))); | 863 this->GetCookies(cs, GURL("http://hopefully-no-cookies.com/"))); |
| 862 this->MatchCookieLines(std::string(), | 864 this->MatchCookieLines(std::string(), |
| 863 this->GetCookies(cs, GURL("http://.com/"))); | 865 this->GetCookies(cs, GURL("http://.com/"))); |
| 864 } | 866 } |
| 865 | 867 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1216 EXPECT_TRUE(this->SetCookie(cs, test_url, "x=1")); | 1218 EXPECT_TRUE(this->SetCookie(cs, test_url, "x=1")); |
| 1217 EXPECT_TRUE(this->SetCookie(cs, test_url, "y=2")); | 1219 EXPECT_TRUE(this->SetCookie(cs, test_url, "y=2")); |
| 1218 | 1220 |
| 1219 std::string result = this->GetCookies(cs, test_url); | 1221 std::string result = this->GetCookies(cs, test_url); |
| 1220 EXPECT_FALSE(result.empty()); | 1222 EXPECT_FALSE(result.empty()); |
| 1221 EXPECT_NE(result.find("x=1"), std::string::npos) << result; | 1223 EXPECT_NE(result.find("x=1"), std::string::npos) << result; |
| 1222 EXPECT_NE(result.find("y=2"), std::string::npos) << result; | 1224 EXPECT_NE(result.find("y=2"), std::string::npos) << result; |
| 1223 } | 1225 } |
| 1224 | 1226 |
| 1225 TYPED_TEST_P(CookieStoreTest, OverwritePersistentCookie) { | 1227 TYPED_TEST_P(CookieStoreTest, OverwritePersistentCookie) { |
| 1226 GURL url_google("http://www.google.com/"); | 1228 GURL url_google("http://www.google.izzle/"); |
| 1227 GURL url_chromium("http://chromium.org"); | 1229 GURL url_chromium("http://chromium.org"); |
| 1228 CookieStore* cs = this->GetCookieStore(); | 1230 CookieStore* cs = this->GetCookieStore(); |
| 1229 | 1231 |
| 1230 // Insert a cookie "a" for path "/path1" | 1232 // Insert a cookie "a" for path "/path1" |
| 1231 EXPECT_TRUE(this->SetCookie(cs, url_google, | 1233 EXPECT_TRUE(this->SetCookie(cs, url_google, |
| 1232 "a=val1; path=/path1; " | 1234 "a=val1; path=/path1; " |
| 1233 "expires=Mon, 18-Apr-22 22:50:13 GMT")); | 1235 "expires=Mon, 18-Apr-22 22:50:13 GMT")); |
| 1234 | 1236 |
| 1235 // Insert a cookie "b" for path "/path1" | 1237 // Insert a cookie "b" for path "/path1" |
| 1236 EXPECT_TRUE(this->SetCookie(cs, url_google, | 1238 EXPECT_TRUE(this->SetCookie(cs, url_google, |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1259 | 1261 |
| 1260 // Insert a cookie "a" for path "/path1", but this time for "chromium.org". | 1262 // Insert a cookie "a" for path "/path1", but this time for "chromium.org". |
| 1261 // Although the name and path match, the hostnames do not, so shouldn't | 1263 // Although the name and path match, the hostnames do not, so shouldn't |
| 1262 // overwrite. | 1264 // overwrite. |
| 1263 EXPECT_TRUE(this->SetCookie(cs, url_chromium, | 1265 EXPECT_TRUE(this->SetCookie(cs, url_chromium, |
| 1264 "a=val99; path=/path1; " | 1266 "a=val99; path=/path1; " |
| 1265 "expires=Mon, 18-Apr-22 22:50:14 GMT")); | 1267 "expires=Mon, 18-Apr-22 22:50:14 GMT")); |
| 1266 | 1268 |
| 1267 if (TypeParam::supports_http_only) { | 1269 if (TypeParam::supports_http_only) { |
| 1268 this->MatchCookieLines( | 1270 this->MatchCookieLines( |
| 1269 "a=val33", this->GetCookies(cs, GURL("http://www.google.com/path1"))); | 1271 "a=val33", this->GetCookies(cs, GURL("http://www.google.izzle/path1"))); |
| 1270 } else { | 1272 } else { |
| 1271 this->MatchCookieLines( | 1273 this->MatchCookieLines( |
| 1272 "a=val33; b=val2", | 1274 "a=val33; b=val2", |
| 1273 this->GetCookies(cs, GURL("http://www.google.com/path1"))); | 1275 this->GetCookies(cs, GURL("http://www.google.izzle/path1"))); |
| 1274 } | 1276 } |
| 1275 this->MatchCookieLines( | 1277 this->MatchCookieLines( |
| 1276 "a=val9", this->GetCookies(cs, GURL("http://www.google.com/path2"))); | 1278 "a=val9", this->GetCookies(cs, GURL("http://www.google.izzle/path2"))); |
| 1277 this->MatchCookieLines( | 1279 this->MatchCookieLines( |
| 1278 "a=val99", this->GetCookies(cs, GURL("http://chromium.org/path1"))); | 1280 "a=val99", this->GetCookies(cs, GURL("http://chromium.org/path1"))); |
| 1279 } | 1281 } |
| 1280 | 1282 |
| 1281 TYPED_TEST_P(CookieStoreTest, CookieOrdering) { | 1283 TYPED_TEST_P(CookieStoreTest, CookieOrdering) { |
| 1282 // Put a random set of cookies into a store and make sure they're returned in | 1284 // Put a random set of cookies into a store and make sure they're returned in |
| 1283 // the right order. | 1285 // the right order. |
| 1284 // Cookies should be sorted by path length and creation time, as per RFC6265. | 1286 // Cookies should be sorted by path length and creation time, as per RFC6265. |
| 1285 CookieStore* cs = this->GetCookieStore(); | 1287 CookieStore* cs = this->GetCookieStore(); |
| 1286 EXPECT_TRUE( | 1288 EXPECT_TRUE(this->SetCookie(cs, GURL("http://d.c.b.a.google.izzle/aa/x.html"), |
| 1287 this->SetCookie(cs, GURL("http://d.c.b.a.google.com/aa/x.html"), "c=1")); | 1289 "c=1")); |
| 1288 EXPECT_TRUE(this->SetCookie(cs, GURL("http://b.a.google.com/aa/bb/cc/x.html"), | 1290 EXPECT_TRUE(this->SetCookie(cs, |
| 1289 "d=1; domain=b.a.google.com")); | 1291 GURL("http://b.a.google.izzle/aa/bb/cc/x.html"), |
| 1290 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( | 1292 "d=1; domain=b.a.google.izzle")); |
| 1291 TypeParam::creation_time_granularity_in_ms)); | |
| 1292 EXPECT_TRUE(this->SetCookie(cs, GURL("http://b.a.google.com/aa/bb/cc/x.html"), | |
| 1293 "a=4; domain=b.a.google.com")); | |
| 1294 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( | 1293 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( |
| 1295 TypeParam::creation_time_granularity_in_ms)); | 1294 TypeParam::creation_time_granularity_in_ms)); |
| 1296 EXPECT_TRUE(this->SetCookie(cs, | 1295 EXPECT_TRUE(this->SetCookie(cs, |
| 1297 GURL("http://c.b.a.google.com/aa/bb/cc/x.html"), | 1296 GURL("http://b.a.google.izzle/aa/bb/cc/x.html"), |
| 1298 "e=1; domain=c.b.a.google.com")); | 1297 "a=4; domain=b.a.google.izzle")); |
| 1298 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds( | |
| 1299 TypeParam::creation_time_granularity_in_ms)); | |
| 1300 EXPECT_TRUE(this->SetCookie(cs, | |
| 1301 GURL("http://c.b.a.google.izzle/aa/bb/cc/x.html"), | |
| 1302 "e=1; domain=c.b.a.google.izzle")); | |
| 1299 EXPECT_TRUE(this->SetCookie( | 1303 EXPECT_TRUE(this->SetCookie( |
| 1300 cs, GURL("http://d.c.b.a.google.com/aa/bb/x.html"), "b=1")); | 1304 cs, GURL("http://d.c.b.a.google.izzle/aa/bb/x.html"), "b=1")); |
| 1301 EXPECT_TRUE(this->SetCookie(cs, GURL("http://news.bbc.co.uk/midpath/x.html"), | 1305 EXPECT_TRUE(this->SetCookie(cs, GURL("http://news.bbc.co.uk/midpath/x.html"), |
| 1302 "g=10")); | 1306 "g=10")); |
| 1303 EXPECT_EQ( | 1307 EXPECT_EQ( |
| 1304 "d=1; a=4; e=1; b=1; c=1", | 1308 "d=1; a=4; e=1; b=1; c=1", |
| 1305 this->GetCookies(cs, GURL("http://d.c.b.a.google.com/aa/bb/cc/dd"))); | 1309 this->GetCookies(cs, GURL("http://d.c.b.a.google.izzle/aa/bb/cc/dd"))); |
| 1306 | 1310 |
| 1307 CookieOptions options; | 1311 CookieOptions options; |
| 1308 CookieList cookies = this->GetCookieListWithOptions( | 1312 CookieList cookies = this->GetCookieListWithOptions( |
| 1309 cs, GURL("http://d.c.b.a.google.com/aa/bb/cc/dd"), options); | 1313 cs, GURL("http://d.c.b.a.google.izzle/aa/bb/cc/dd"), options); |
| 1310 CookieList::const_iterator it = cookies.begin(); | 1314 CookieList::const_iterator it = cookies.begin(); |
| 1311 | 1315 |
| 1312 ASSERT_TRUE(it != cookies.end()); | 1316 ASSERT_TRUE(it != cookies.end()); |
| 1313 EXPECT_EQ("d", it->Name()); | 1317 EXPECT_EQ("d", it->Name()); |
| 1314 | 1318 |
| 1315 ASSERT_TRUE(++it != cookies.end()); | 1319 ASSERT_TRUE(++it != cookies.end()); |
| 1316 EXPECT_EQ("a", it->Name()); | 1320 EXPECT_EQ("a", it->Name()); |
| 1317 | 1321 |
| 1318 ASSERT_TRUE(++it != cookies.end()); | 1322 ASSERT_TRUE(++it != cookies.end()); |
| 1319 EXPECT_EQ("e", it->Name()); | 1323 EXPECT_EQ("e", it->Name()); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1485 OverwritePersistentCookie, | 1489 OverwritePersistentCookie, |
| 1486 CookieOrdering, | 1490 CookieOrdering, |
| 1487 GetAllCookiesAsync, | 1491 GetAllCookiesAsync, |
| 1488 DeleteCookieAsync, | 1492 DeleteCookieAsync, |
| 1489 DeleteCanonicalCookieAsync, | 1493 DeleteCanonicalCookieAsync, |
| 1490 DeleteSessionCookie); | 1494 DeleteSessionCookie); |
| 1491 | 1495 |
| 1492 } // namespace net | 1496 } // namespace net |
| 1493 | 1497 |
| 1494 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 1498 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
| OLD | NEW |