| 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 #include "net/cookies/cookie_store_unittest.h" | 5 #include "net/cookies/cookie_store_unittest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // * Three levels of host cookie (w.b.a, w.c.b.a, w.d.c.b.a) | 180 // * Three levels of host cookie (w.b.a, w.c.b.a, w.d.c.b.a) |
| 181 // * http_only cookie (w.c.b.a) | 181 // * http_only cookie (w.c.b.a) |
| 182 // * same_site cookie (w.c.b.a) | 182 // * same_site cookie (w.c.b.a) |
| 183 // * Two secure cookies (.c.b.a, w.c.b.a) | 183 // * Two secure cookies (.c.b.a, w.c.b.a) |
| 184 // * Two domain path cookies (.c.b.a/dir1, .c.b.a/dir1/dir2) | 184 // * Two domain path cookies (.c.b.a/dir1, .c.b.a/dir1/dir2) |
| 185 // * Two host path cookies (w.c.b.a/dir1, w.c.b.a/dir1/dir2) | 185 // * Two host path cookies (w.c.b.a/dir1, w.c.b.a/dir1/dir2) |
| 186 | 186 |
| 187 // Domain cookies | 187 // Domain cookies |
| 188 EXPECT_TRUE(this->SetCookieWithDetails( | 188 EXPECT_TRUE(this->SetCookieWithDetails( |
| 189 cm, url_top_level_domain_plus_1, "dom_1", "X", ".harvard.edu", "/", | 189 cm, url_top_level_domain_plus_1, "dom_1", "X", ".harvard.edu", "/", |
| 190 base::Time(), base::Time(), base::Time(), false, false, false, | 190 base::Time(), base::Time(), base::Time(), false, false, |
| 191 COOKIE_PRIORITY_DEFAULT)); | 191 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 192 EXPECT_TRUE(this->SetCookieWithDetails( | 192 EXPECT_TRUE(this->SetCookieWithDetails( |
| 193 cm, url_top_level_domain_plus_2, "dom_2", "X", ".math.harvard.edu", "/", | 193 cm, url_top_level_domain_plus_2, "dom_2", "X", ".math.harvard.edu", "/", |
| 194 base::Time(), base::Time(), base::Time(), false, false, false, | 194 base::Time(), base::Time(), base::Time(), false, false, |
| 195 COOKIE_PRIORITY_DEFAULT)); | 195 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 196 EXPECT_TRUE(this->SetCookieWithDetails( | 196 EXPECT_TRUE(this->SetCookieWithDetails( |
| 197 cm, url_top_level_domain_plus_3, "dom_3", "X", | 197 cm, url_top_level_domain_plus_3, "dom_3", "X", |
| 198 ".bourbaki.math.harvard.edu", "/", base::Time(), base::Time(), | 198 ".bourbaki.math.harvard.edu", "/", base::Time(), base::Time(), |
| 199 base::Time(), false, false, false, COOKIE_PRIORITY_DEFAULT)); | 199 base::Time(), false, false, CookieSameSite::DEFAULT_MODE, |
| 200 COOKIE_PRIORITY_DEFAULT)); |
| 200 | 201 |
| 201 // Host cookies | 202 // Host cookies |
| 202 EXPECT_TRUE(this->SetCookieWithDetails( | 203 EXPECT_TRUE(this->SetCookieWithDetails( |
| 203 cm, url_top_level_domain_plus_1, "host_1", "X", std::string(), "/", | 204 cm, url_top_level_domain_plus_1, "host_1", "X", std::string(), "/", |
| 204 base::Time(), base::Time(), base::Time(), false, false, false, | 205 base::Time(), base::Time(), base::Time(), false, false, |
| 205 COOKIE_PRIORITY_DEFAULT)); | 206 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 206 EXPECT_TRUE(this->SetCookieWithDetails( | 207 EXPECT_TRUE(this->SetCookieWithDetails( |
| 207 cm, url_top_level_domain_plus_2, "host_2", "X", std::string(), "/", | 208 cm, url_top_level_domain_plus_2, "host_2", "X", std::string(), "/", |
| 208 base::Time(), base::Time(), base::Time(), false, false, false, | 209 base::Time(), base::Time(), base::Time(), false, false, |
| 209 COOKIE_PRIORITY_DEFAULT)); | 210 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 210 EXPECT_TRUE(this->SetCookieWithDetails( | 211 EXPECT_TRUE(this->SetCookieWithDetails( |
| 211 cm, url_top_level_domain_plus_3, "host_3", "X", std::string(), "/", | 212 cm, url_top_level_domain_plus_3, "host_3", "X", std::string(), "/", |
| 212 base::Time(), base::Time(), base::Time(), false, false, false, | 213 base::Time(), base::Time(), base::Time(), false, false, |
| 213 COOKIE_PRIORITY_DEFAULT)); | 214 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 214 | 215 |
| 215 // http_only cookie | 216 // http_only cookie |
| 216 EXPECT_TRUE(this->SetCookieWithDetails( | 217 EXPECT_TRUE(this->SetCookieWithDetails( |
| 217 cm, url_top_level_domain_plus_2, "httpo_check", "x", std::string(), "/", | 218 cm, url_top_level_domain_plus_2, "httpo_check", "x", std::string(), "/", |
| 218 base::Time(), base::Time(), base::Time(), false, true, false, | 219 base::Time(), base::Time(), base::Time(), false, true, |
| 219 COOKIE_PRIORITY_DEFAULT)); | 220 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 220 | 221 |
| 221 // same-site cookie | 222 // same-site cookie |
| 222 EXPECT_TRUE(this->SetCookieWithDetails( | 223 EXPECT_TRUE(this->SetCookieWithDetails( |
| 223 cm, url_top_level_domain_plus_2, "firstp_check", "x", std::string(), | 224 cm, url_top_level_domain_plus_2, "firstp_check", "x", std::string(), |
| 224 "/", base::Time(), base::Time(), base::Time(), false, false, true, | 225 "/", base::Time(), base::Time(), base::Time(), false, false, |
| 225 COOKIE_PRIORITY_DEFAULT)); | 226 CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 226 | 227 |
| 227 // Secure cookies | 228 // Secure cookies |
| 228 EXPECT_TRUE(this->SetCookieWithDetails( | 229 EXPECT_TRUE(this->SetCookieWithDetails( |
| 229 cm, url_top_level_domain_plus_2_secure, "sec_dom", "X", | 230 cm, url_top_level_domain_plus_2_secure, "sec_dom", "X", |
| 230 ".math.harvard.edu", "/", base::Time(), base::Time(), base::Time(), | 231 ".math.harvard.edu", "/", base::Time(), base::Time(), base::Time(), |
| 231 true, false, false, COOKIE_PRIORITY_DEFAULT)); | 232 true, false, CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 232 EXPECT_TRUE(this->SetCookieWithDetails( | 233 EXPECT_TRUE(this->SetCookieWithDetails( |
| 233 cm, url_top_level_domain_plus_2_secure, "sec_host", "X", std::string(), | 234 cm, url_top_level_domain_plus_2_secure, "sec_host", "X", std::string(), |
| 234 "/", base::Time(), base::Time(), base::Time(), true, false, false, | 235 "/", base::Time(), base::Time(), base::Time(), true, false, |
| 235 COOKIE_PRIORITY_DEFAULT)); | 236 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 236 | 237 |
| 237 // Domain path cookies | 238 // Domain path cookies |
| 238 EXPECT_TRUE(this->SetCookieWithDetails( | 239 EXPECT_TRUE(this->SetCookieWithDetails( |
| 239 cm, url_top_level_domain_plus_2, "dom_path_1", "X", ".math.harvard.edu", | 240 cm, url_top_level_domain_plus_2, "dom_path_1", "X", ".math.harvard.edu", |
| 240 "/dir1", base::Time(), base::Time(), base::Time(), false, false, false, | 241 "/dir1", base::Time(), base::Time(), base::Time(), false, false, |
| 241 COOKIE_PRIORITY_DEFAULT)); | 242 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 242 EXPECT_TRUE(this->SetCookieWithDetails( | 243 EXPECT_TRUE(this->SetCookieWithDetails( |
| 243 cm, url_top_level_domain_plus_2, "dom_path_2", "X", ".math.harvard.edu", | 244 cm, url_top_level_domain_plus_2, "dom_path_2", "X", ".math.harvard.edu", |
| 244 "/dir1/dir2", base::Time(), base::Time(), base::Time(), false, false, | 245 "/dir1/dir2", base::Time(), base::Time(), base::Time(), false, false, |
| 245 false, COOKIE_PRIORITY_DEFAULT)); | 246 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 246 | 247 |
| 247 // Host path cookies | 248 // Host path cookies |
| 248 EXPECT_TRUE(this->SetCookieWithDetails( | 249 EXPECT_TRUE(this->SetCookieWithDetails( |
| 249 cm, url_top_level_domain_plus_2, "host_path_1", "X", std::string(), | 250 cm, url_top_level_domain_plus_2, "host_path_1", "X", std::string(), |
| 250 "/dir1", base::Time(), base::Time(), base::Time(), false, false, false, | 251 "/dir1", base::Time(), base::Time(), base::Time(), false, false, |
| 251 COOKIE_PRIORITY_DEFAULT)); | 252 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 252 EXPECT_TRUE(this->SetCookieWithDetails( | 253 EXPECT_TRUE(this->SetCookieWithDetails( |
| 253 cm, url_top_level_domain_plus_2, "host_path_2", "X", std::string(), | 254 cm, url_top_level_domain_plus_2, "host_path_2", "X", std::string(), |
| 254 "/dir1/dir2", base::Time(), base::Time(), base::Time(), false, false, | 255 "/dir1/dir2", base::Time(), base::Time(), base::Time(), false, false, |
| 255 false, COOKIE_PRIORITY_DEFAULT)); | 256 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 256 | 257 |
| 257 EXPECT_EQ(14U, this->GetAllCookies(cm).size()); | 258 EXPECT_EQ(14U, this->GetAllCookies(cm).size()); |
| 258 } | 259 } |
| 259 | 260 |
| 260 Time GetFirstCookieAccessDate(CookieMonster* cm) { | 261 Time GetFirstCookieAccessDate(CookieMonster* cm) { |
| 261 const CookieList all_cookies(this->GetAllCookies(cm)); | 262 const CookieList all_cookies(this->GetAllCookies(cm)); |
| 262 return all_cookies.front().LastAccessDate(); | 263 return all_cookies.front().LastAccessDate(); |
| 263 } | 264 } |
| 264 | 265 |
| 265 bool FindAndDeleteCookie(CookieMonster* cm, | 266 bool FindAndDeleteCookie(CookieMonster* cm, |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 616 |
| 616 struct CookiesInputInfo { | 617 struct CookiesInputInfo { |
| 617 const GURL url; | 618 const GURL url; |
| 618 const std::string name; | 619 const std::string name; |
| 619 const std::string value; | 620 const std::string value; |
| 620 const std::string domain; | 621 const std::string domain; |
| 621 const std::string path; | 622 const std::string path; |
| 622 const base::Time expiration_time; | 623 const base::Time expiration_time; |
| 623 bool secure; | 624 bool secure; |
| 624 bool http_only; | 625 bool http_only; |
| 625 bool same_site; | 626 CookieSameSite same_site; |
| 626 CookiePriority priority; | 627 CookiePriority priority; |
| 627 }; | 628 }; |
| 628 | 629 |
| 629 ACTION_P(QuitRunLoop, run_loop) { | 630 ACTION_P(QuitRunLoop, run_loop) { |
| 630 run_loop->Quit(); | 631 run_loop->Quit(); |
| 631 } | 632 } |
| 632 | 633 |
| 633 // TODO(erikwright): When the synchronous helpers 'GetCookies' etc. are removed, | 634 // TODO(erikwright): When the synchronous helpers 'GetCookies' etc. are removed, |
| 634 // rename these, removing the 'Action' suffix. | 635 // rename these, removing the 'Action' suffix. |
| 635 ACTION_P4(DeleteCookieAction, cookie_monster, url, name, callback) { | 636 ACTION_P4(DeleteCookieAction, cookie_monster, url, name, callback) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 base::RunLoop loop; | 849 base::RunLoop loop; |
| 849 EXPECT_CALL(set_cookies_callback, Invoke(true)).WillOnce(QuitRunLoop(&loop)); | 850 EXPECT_CALL(set_cookies_callback, Invoke(true)).WillOnce(QuitRunLoop(&loop)); |
| 850 | 851 |
| 851 CompleteLoading(); | 852 CompleteLoading(); |
| 852 loop.Run(); | 853 loop.Run(); |
| 853 } | 854 } |
| 854 | 855 |
| 855 TEST_F(DeferredCookieTaskTest, DeferredSetAllCookies) { | 856 TEST_F(DeferredCookieTaskTest, DeferredSetAllCookies) { |
| 856 MockSetCookiesCallback set_cookies_callback; | 857 MockSetCookiesCallback set_cookies_callback; |
| 857 CookieList list; | 858 CookieList list; |
| 858 list.push_back(CanonicalCookie(http_www_google_.url(), "A", "B", | 859 list.push_back(CanonicalCookie( |
| 859 http_www_google_.domain(), "/", | 860 http_www_google_.url(), "A", "B", http_www_google_.domain(), "/", |
| 860 base::Time::Now(), base::Time(), base::Time(), | 861 base::Time::Now(), base::Time(), base::Time(), false, true, |
| 861 false, true, false, COOKIE_PRIORITY_DEFAULT)); | 862 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 862 list.push_back(CanonicalCookie(http_www_google_.url(), "C", "D", | 863 list.push_back(CanonicalCookie( |
| 863 http_www_google_.domain(), "/", | 864 http_www_google_.url(), "C", "D", http_www_google_.domain(), "/", |
| 864 base::Time::Now(), base::Time(), base::Time(), | 865 base::Time::Now(), base::Time(), base::Time(), false, true, |
| 865 false, true, false, COOKIE_PRIORITY_DEFAULT)); | 866 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 866 | 867 |
| 867 BeginWith( | 868 BeginWith( |
| 868 SetAllCookiesAction(&cookie_monster(), list, &set_cookies_callback)); | 869 SetAllCookiesAction(&cookie_monster(), list, &set_cookies_callback)); |
| 869 | 870 |
| 870 WaitForLoadCall(); | 871 WaitForLoadCall(); |
| 871 | 872 |
| 872 EXPECT_CALL(set_cookies_callback, Invoke(true)) | 873 EXPECT_CALL(set_cookies_callback, Invoke(true)) |
| 873 .WillOnce( | 874 .WillOnce( |
| 874 SetAllCookiesAction(&cookie_monster(), list, &set_cookies_callback)); | 875 SetAllCookiesAction(&cookie_monster(), list, &set_cookies_callback)); |
| 875 base::RunLoop loop; | 876 base::RunLoop loop; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 903 MockSetCookiesCallback set_cookies_callback; | 904 MockSetCookiesCallback set_cookies_callback; |
| 904 | 905 |
| 905 CookiesInputInfo cookie_info = {www_google_foo_.url(), | 906 CookiesInputInfo cookie_info = {www_google_foo_.url(), |
| 906 "A", | 907 "A", |
| 907 "B", | 908 "B", |
| 908 std::string(), | 909 std::string(), |
| 909 "/foo", | 910 "/foo", |
| 910 base::Time(), | 911 base::Time(), |
| 911 false, | 912 false, |
| 912 false, | 913 false, |
| 913 false, | 914 CookieSameSite::DEFAULT_MODE, |
| 914 COOKIE_PRIORITY_DEFAULT}; | 915 COOKIE_PRIORITY_DEFAULT}; |
| 915 BeginWithForDomainKey( | 916 BeginWithForDomainKey( |
| 916 http_www_google_.domain(), | 917 http_www_google_.domain(), |
| 917 SetCookieWithDetailsAction(&cookie_monster(), cookie_info, | 918 SetCookieWithDetailsAction(&cookie_monster(), cookie_info, |
| 918 &set_cookies_callback)); | 919 &set_cookies_callback)); |
| 919 | 920 |
| 920 WaitForLoadCall(); | 921 WaitForLoadCall(); |
| 921 | 922 |
| 922 CookiesInputInfo cookie_info_exp = {www_google_foo_.url(), | 923 CookiesInputInfo cookie_info_exp = {www_google_foo_.url(), |
| 923 "A", | 924 "A", |
| 924 "B", | 925 "B", |
| 925 std::string(), | 926 std::string(), |
| 926 "/foo", | 927 "/foo", |
| 927 base::Time(), | 928 base::Time(), |
| 928 false, | 929 false, |
| 929 false, | 930 false, |
| 930 false, | 931 CookieSameSite::DEFAULT_MODE, |
| 931 COOKIE_PRIORITY_DEFAULT}; | 932 COOKIE_PRIORITY_DEFAULT}; |
| 932 EXPECT_CALL(set_cookies_callback, Invoke(true)) | 933 EXPECT_CALL(set_cookies_callback, Invoke(true)) |
| 933 .WillOnce(SetCookieWithDetailsAction(&cookie_monster(), cookie_info_exp, | 934 .WillOnce(SetCookieWithDetailsAction(&cookie_monster(), cookie_info_exp, |
| 934 &set_cookies_callback)); | 935 &set_cookies_callback)); |
| 935 base::RunLoop loop; | 936 base::RunLoop loop; |
| 936 EXPECT_CALL(set_cookies_callback, Invoke(true)).WillOnce(QuitRunLoop(&loop)); | 937 EXPECT_CALL(set_cookies_callback, Invoke(true)).WillOnce(QuitRunLoop(&loop)); |
| 937 | 938 |
| 938 CompleteLoading(); | 939 CompleteLoading(); |
| 939 loop.Run(); | 940 loop.Run(); |
| 940 } | 941 } |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1736 EXPECT_TRUE(SetCookieWithOptions(cm.get(), http_www_google_.url(), | 1737 EXPECT_TRUE(SetCookieWithOptions(cm.get(), http_www_google_.url(), |
| 1737 "setCookieWithOptions1=A", options)); | 1738 "setCookieWithOptions1=A", options)); |
| 1738 EXPECT_TRUE(SetCookieWithOptions(cm.get(), http_www_google_.url(), | 1739 EXPECT_TRUE(SetCookieWithOptions(cm.get(), http_www_google_.url(), |
| 1739 "setCookieWithOptions2=A", options)); | 1740 "setCookieWithOptions2=A", options)); |
| 1740 EXPECT_TRUE(SetCookieWithOptions(cm.get(), http_www_google_.url(), | 1741 EXPECT_TRUE(SetCookieWithOptions(cm.get(), http_www_google_.url(), |
| 1741 "setCookieWithOptions3=A", options)); | 1742 "setCookieWithOptions3=A", options)); |
| 1742 | 1743 |
| 1743 EXPECT_TRUE(SetCookieWithDetails( | 1744 EXPECT_TRUE(SetCookieWithDetails( |
| 1744 cm.get(), http_www_google_.url(), "setCookieWithDetails1", "A", | 1745 cm.get(), http_www_google_.url(), "setCookieWithDetails1", "A", |
| 1745 http_www_google_.Format(".%D"), "/", Time(), Time(), Time(), false, false, | 1746 http_www_google_.Format(".%D"), "/", Time(), Time(), Time(), false, false, |
| 1746 false, COOKIE_PRIORITY_DEFAULT)); | 1747 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 1747 EXPECT_TRUE(SetCookieWithDetails( | 1748 EXPECT_TRUE(SetCookieWithDetails( |
| 1748 cm.get(), http_www_google_.url(), "setCookieWithDetails2", "A", | 1749 cm.get(), http_www_google_.url(), "setCookieWithDetails2", "A", |
| 1749 http_www_google_.Format(".%D"), "/", Time(), Time(), Time(), false, false, | 1750 http_www_google_.Format(".%D"), "/", Time(), Time(), Time(), false, false, |
| 1750 false, COOKIE_PRIORITY_DEFAULT)); | 1751 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 1751 EXPECT_TRUE(SetCookieWithDetails( | 1752 EXPECT_TRUE(SetCookieWithDetails( |
| 1752 cm.get(), http_www_google_.url(), "setCookieWithDetails3", "A", | 1753 cm.get(), http_www_google_.url(), "setCookieWithDetails3", "A", |
| 1753 http_www_google_.Format(".%D"), "/", Time(), Time(), Time(), false, false, | 1754 http_www_google_.Format(".%D"), "/", Time(), Time(), Time(), false, false, |
| 1754 false, COOKIE_PRIORITY_DEFAULT)); | 1755 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 1755 | 1756 |
| 1756 // Now we check | 1757 // Now we check |
| 1757 CookieList cookie_list(GetAllCookies(cm.get())); | 1758 CookieList cookie_list(GetAllCookies(cm.get())); |
| 1758 EXPECT_EQ(9u, cookie_list.size()); | 1759 EXPECT_EQ(9u, cookie_list.size()); |
| 1759 typedef std::map<int64_t, CanonicalCookie> TimeCookieMap; | 1760 typedef std::map<int64_t, CanonicalCookie> TimeCookieMap; |
| 1760 TimeCookieMap check_map; | 1761 TimeCookieMap check_map; |
| 1761 for (CookieList::const_iterator it = cookie_list.begin(); | 1762 for (CookieList::const_iterator it = cookie_list.begin(); |
| 1762 it != cookie_list.end(); it++) { | 1763 it != cookie_list.end(); it++) { |
| 1763 const int64_t creation_date = it->CreationDate().ToInternalValue(); | 1764 const int64_t creation_date = it->CreationDate().ToInternalValue(); |
| 1764 TimeCookieMap::const_iterator existing_cookie_it( | 1765 TimeCookieMap::const_iterator existing_cookie_it( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 TEST_F(CookieMonsterTest, BackingStoreCommunication) { | 1805 TEST_F(CookieMonsterTest, BackingStoreCommunication) { |
| 1805 // Store details for cookies transforming through the backing store interface. | 1806 // Store details for cookies transforming through the backing store interface. |
| 1806 | 1807 |
| 1807 base::Time current(base::Time::Now()); | 1808 base::Time current(base::Time::Now()); |
| 1808 scoped_refptr<MockSimplePersistentCookieStore> store( | 1809 scoped_refptr<MockSimplePersistentCookieStore> store( |
| 1809 new MockSimplePersistentCookieStore); | 1810 new MockSimplePersistentCookieStore); |
| 1810 base::Time new_access_time; | 1811 base::Time new_access_time; |
| 1811 base::Time expires(base::Time::Now() + base::TimeDelta::FromSeconds(100)); | 1812 base::Time expires(base::Time::Now() + base::TimeDelta::FromSeconds(100)); |
| 1812 | 1813 |
| 1813 const CookiesInputInfo input_info[] = { | 1814 const CookiesInputInfo input_info[] = { |
| 1814 {GURL("http://a.b.google.com"), | 1815 {GURL("http://a.b.google.com"), "a", "1", "", "/path/to/cookie", expires, |
| 1815 "a", | 1816 false, false, CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT}, |
| 1816 "1", | 1817 {GURL("https://www.google.com"), "b", "2", ".google.com", |
| 1817 "", | 1818 "/path/from/cookie", expires + TimeDelta::FromSeconds(10), true, true, |
| 1818 "/path/to/cookie", | 1819 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT}, |
| 1819 expires, | 1820 {GURL("https://google.com"), "c", "3", "", "/another/path/to/cookie", |
| 1820 false, | 1821 base::Time::Now() + base::TimeDelta::FromSeconds(100), true, false, |
| 1821 false, | 1822 CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT}}; |
| 1822 false, | |
| 1823 COOKIE_PRIORITY_DEFAULT}, | |
| 1824 {GURL("https://www.google.com"), | |
| 1825 "b", | |
| 1826 "2", | |
| 1827 ".google.com", | |
| 1828 "/path/from/cookie", | |
| 1829 expires + TimeDelta::FromSeconds(10), | |
| 1830 true, | |
| 1831 true, | |
| 1832 false, | |
| 1833 COOKIE_PRIORITY_DEFAULT}, | |
| 1834 {GURL("https://google.com"), | |
| 1835 "c", | |
| 1836 "3", | |
| 1837 "", | |
| 1838 "/another/path/to/cookie", | |
| 1839 base::Time::Now() + base::TimeDelta::FromSeconds(100), | |
| 1840 true, | |
| 1841 false, | |
| 1842 true, | |
| 1843 COOKIE_PRIORITY_DEFAULT}}; | |
| 1844 const int INPUT_DELETE = 1; | 1823 const int INPUT_DELETE = 1; |
| 1845 | 1824 |
| 1846 // Create new cookies and flush them to the store. | 1825 // Create new cookies and flush them to the store. |
| 1847 { | 1826 { |
| 1848 scoped_ptr<CookieMonster> cmout(new CookieMonster(store.get(), nullptr)); | 1827 scoped_ptr<CookieMonster> cmout(new CookieMonster(store.get(), nullptr)); |
| 1849 for (const CookiesInputInfo* p = input_info; | 1828 for (const CookiesInputInfo* p = input_info; |
| 1850 p < &input_info[arraysize(input_info)]; p++) { | 1829 p < &input_info[arraysize(input_info)]; p++) { |
| 1851 EXPECT_TRUE(SetCookieWithDetails( | 1830 EXPECT_TRUE(SetCookieWithDetails( |
| 1852 cmout.get(), p->url, p->name, p->value, p->domain, p->path, | 1831 cmout.get(), p->url, p->name, p->value, p->domain, p->path, |
| 1853 base::Time(), p->expiration_time, base::Time(), p->secure, | 1832 base::Time(), p->expiration_time, base::Time(), p->secure, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1873 const CanonicalCookie* output = &cookies[output_index]; | 1852 const CanonicalCookie* output = &cookies[output_index]; |
| 1874 | 1853 |
| 1875 EXPECT_EQ(input->name, output->Name()); | 1854 EXPECT_EQ(input->name, output->Name()); |
| 1876 EXPECT_EQ(input->value, output->Value()); | 1855 EXPECT_EQ(input->value, output->Value()); |
| 1877 EXPECT_EQ(input->url.host(), output->Domain()); | 1856 EXPECT_EQ(input->url.host(), output->Domain()); |
| 1878 EXPECT_EQ(input->path, output->Path()); | 1857 EXPECT_EQ(input->path, output->Path()); |
| 1879 EXPECT_LE(current.ToInternalValue(), | 1858 EXPECT_LE(current.ToInternalValue(), |
| 1880 output->CreationDate().ToInternalValue()); | 1859 output->CreationDate().ToInternalValue()); |
| 1881 EXPECT_EQ(input->secure, output->IsSecure()); | 1860 EXPECT_EQ(input->secure, output->IsSecure()); |
| 1882 EXPECT_EQ(input->http_only, output->IsHttpOnly()); | 1861 EXPECT_EQ(input->http_only, output->IsHttpOnly()); |
| 1883 EXPECT_EQ(input->same_site, output->IsSameSite()); | 1862 EXPECT_EQ(input->same_site, output->SameSite()); |
| 1884 EXPECT_TRUE(output->IsPersistent()); | 1863 EXPECT_TRUE(output->IsPersistent()); |
| 1885 EXPECT_EQ(input->expiration_time.ToInternalValue(), | 1864 EXPECT_EQ(input->expiration_time.ToInternalValue(), |
| 1886 output->ExpiryDate().ToInternalValue()); | 1865 output->ExpiryDate().ToInternalValue()); |
| 1887 } | 1866 } |
| 1888 } | 1867 } |
| 1889 } | 1868 } |
| 1890 | 1869 |
| 1891 TEST_F(CookieMonsterTest, CookieListOrdering) { | 1870 TEST_F(CookieMonsterTest, CookieListOrdering) { |
| 1892 // Put a random set of cookies into a monster and make sure | 1871 // Put a random set of cookies into a monster and make sure |
| 1893 // they're returned in the right order. | 1872 // they're returned in the right order. |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2309 TEST_F(CookieMonsterTest, SetAllCookies) { | 2288 TEST_F(CookieMonsterTest, SetAllCookies) { |
| 2310 scoped_refptr<FlushablePersistentStore> store(new FlushablePersistentStore()); | 2289 scoped_refptr<FlushablePersistentStore> store(new FlushablePersistentStore()); |
| 2311 scoped_ptr<CookieMonster> cm(new CookieMonster(store.get(), nullptr)); | 2290 scoped_ptr<CookieMonster> cm(new CookieMonster(store.get(), nullptr)); |
| 2312 cm->SetPersistSessionCookies(true); | 2291 cm->SetPersistSessionCookies(true); |
| 2313 | 2292 |
| 2314 EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "U=V; path=/")); | 2293 EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "U=V; path=/")); |
| 2315 EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "W=X; path=/foo")); | 2294 EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "W=X; path=/foo")); |
| 2316 EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "Y=Z; path=/")); | 2295 EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "Y=Z; path=/")); |
| 2317 | 2296 |
| 2318 CookieList list; | 2297 CookieList list; |
| 2319 list.push_back(CanonicalCookie(http_www_google_.url(), "A", "B", | 2298 list.push_back(CanonicalCookie( |
| 2320 http_www_google_.url().host(), "/", | 2299 http_www_google_.url(), "A", "B", http_www_google_.url().host(), "/", |
| 2321 base::Time::Now(), base::Time(), base::Time(), | 2300 base::Time::Now(), base::Time(), base::Time(), false, false, |
| 2322 false, false, false, COOKIE_PRIORITY_DEFAULT)); | 2301 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 2323 list.push_back(CanonicalCookie(http_www_google_.url(), "W", "X", | 2302 list.push_back(CanonicalCookie( |
| 2324 http_www_google_.url().host(), "/bar", | 2303 http_www_google_.url(), "W", "X", http_www_google_.url().host(), "/bar", |
| 2325 base::Time::Now(), base::Time(), base::Time(), | 2304 base::Time::Now(), base::Time(), base::Time(), false, false, |
| 2326 false, false, false, COOKIE_PRIORITY_DEFAULT)); | 2305 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 2327 list.push_back(CanonicalCookie(http_www_google_.url(), "Y", "Z", | 2306 list.push_back(CanonicalCookie( |
| 2328 http_www_google_.url().host(), "/", | 2307 http_www_google_.url(), "Y", "Z", http_www_google_.url().host(), "/", |
| 2329 base::Time::Now(), base::Time(), base::Time(), | 2308 base::Time::Now(), base::Time(), base::Time(), false, false, |
| 2330 false, false, false, COOKIE_PRIORITY_DEFAULT)); | 2309 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 2331 | 2310 |
| 2332 // SetAllCookies must not flush. | 2311 // SetAllCookies must not flush. |
| 2333 ASSERT_EQ(0, store->flush_count()); | 2312 ASSERT_EQ(0, store->flush_count()); |
| 2334 EXPECT_TRUE(SetAllCookies(cm.get(), list)); | 2313 EXPECT_TRUE(SetAllCookies(cm.get(), list)); |
| 2335 EXPECT_EQ(0, store->flush_count()); | 2314 EXPECT_EQ(0, store->flush_count()); |
| 2336 | 2315 |
| 2337 CookieList cookies = GetAllCookies(cm.get()); | 2316 CookieList cookies = GetAllCookies(cm.get()); |
| 2338 size_t expected_size = 3; // "A", "W" and "Y". "U" is gone. | 2317 size_t expected_size = 3; // "A", "W" and "Y". "U" is gone. |
| 2339 EXPECT_EQ(expected_size, cookies.size()); | 2318 EXPECT_EQ(expected_size, cookies.size()); |
| 2340 CookieList::iterator it = cookies.begin(); | 2319 CookieList::iterator it = cookies.begin(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2352 EXPECT_EQ("Y", it->Name()); | 2331 EXPECT_EQ("Y", it->Name()); |
| 2353 EXPECT_EQ("Z", it->Value()); | 2332 EXPECT_EQ("Z", it->Value()); |
| 2354 } | 2333 } |
| 2355 | 2334 |
| 2356 TEST_F(CookieMonsterTest, ComputeCookieDiff) { | 2335 TEST_F(CookieMonsterTest, ComputeCookieDiff) { |
| 2357 scoped_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr)); | 2336 scoped_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr)); |
| 2358 | 2337 |
| 2359 base::Time now = base::Time::Now(); | 2338 base::Time now = base::Time::Now(); |
| 2360 base::Time creation_time = now - base::TimeDelta::FromSeconds(1); | 2339 base::Time creation_time = now - base::TimeDelta::FromSeconds(1); |
| 2361 | 2340 |
| 2362 CanonicalCookie cookie1(http_www_google_.url(), "A", "B", | 2341 CanonicalCookie cookie1( |
| 2363 http_www_google_.url().host(), "/", creation_time, | 2342 http_www_google_.url(), "A", "B", http_www_google_.url().host(), "/", |
| 2364 base::Time(), base::Time(), false, false, false, | 2343 creation_time, base::Time(), base::Time(), false, false, |
| 2365 COOKIE_PRIORITY_DEFAULT); | 2344 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT); |
| 2366 CanonicalCookie cookie2(http_www_google_.url(), "C", "D", | 2345 CanonicalCookie cookie2( |
| 2367 http_www_google_.url().host(), "/", creation_time, | 2346 http_www_google_.url(), "C", "D", http_www_google_.url().host(), "/", |
| 2368 base::Time(), base::Time(), false, false, false, | 2347 creation_time, base::Time(), base::Time(), false, false, |
| 2369 COOKIE_PRIORITY_DEFAULT); | 2348 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT); |
| 2370 CanonicalCookie cookie3(http_www_google_.url(), "E", "F", | 2349 CanonicalCookie cookie3( |
| 2371 http_www_google_.url().host(), "/", creation_time, | 2350 http_www_google_.url(), "E", "F", http_www_google_.url().host(), "/", |
| 2372 base::Time(), base::Time(), false, false, false, | 2351 creation_time, base::Time(), base::Time(), false, false, |
| 2373 COOKIE_PRIORITY_DEFAULT); | 2352 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT); |
| 2374 CanonicalCookie cookie4(http_www_google_.url(), "G", "H", | 2353 CanonicalCookie cookie4( |
| 2375 http_www_google_.url().host(), "/", creation_time, | 2354 http_www_google_.url(), "G", "H", http_www_google_.url().host(), "/", |
| 2376 base::Time(), base::Time(), false, false, false, | 2355 creation_time, base::Time(), base::Time(), false, false, |
| 2377 COOKIE_PRIORITY_DEFAULT); | 2356 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT); |
| 2378 CanonicalCookie cookie4_with_new_value( | 2357 CanonicalCookie cookie4_with_new_value( |
| 2379 http_www_google_.url(), "G", "iamnew", http_www_google_.url().host(), "/", | 2358 http_www_google_.url(), "G", "iamnew", http_www_google_.url().host(), "/", |
| 2380 creation_time, base::Time(), base::Time(), false, false, false, | 2359 creation_time, base::Time(), base::Time(), false, false, |
| 2381 COOKIE_PRIORITY_DEFAULT); | 2360 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT); |
| 2382 CanonicalCookie cookie5(http_www_google_.url(), "I", "J", | 2361 CanonicalCookie cookie5( |
| 2383 http_www_google_.url().host(), "/", creation_time, | 2362 http_www_google_.url(), "I", "J", http_www_google_.url().host(), "/", |
| 2384 base::Time(), base::Time(), false, false, false, | 2363 creation_time, base::Time(), base::Time(), false, false, |
| 2385 COOKIE_PRIORITY_DEFAULT); | 2364 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT); |
| 2386 CanonicalCookie cookie5_with_new_creation_time( | 2365 CanonicalCookie cookie5_with_new_creation_time( |
| 2387 http_www_google_.url(), "I", "J", http_www_google_.url().host(), "/", now, | 2366 http_www_google_.url(), "I", "J", http_www_google_.url().host(), "/", now, |
| 2388 base::Time(), base::Time(), false, false, false, COOKIE_PRIORITY_DEFAULT); | 2367 base::Time(), base::Time(), false, false, CookieSameSite::DEFAULT_MODE, |
| 2389 CanonicalCookie cookie6(http_www_google_.url(), "K", "L", | 2368 COOKIE_PRIORITY_DEFAULT); |
| 2390 http_www_google_.url().host(), "/foo", creation_time, | 2369 CanonicalCookie cookie6( |
| 2391 base::Time(), base::Time(), false, false, false, | 2370 http_www_google_.url(), "K", "L", http_www_google_.url().host(), "/foo", |
| 2392 COOKIE_PRIORITY_DEFAULT); | 2371 creation_time, base::Time(), base::Time(), false, false, |
| 2372 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT); |
| 2393 CanonicalCookie cookie6_with_new_path( | 2373 CanonicalCookie cookie6_with_new_path( |
| 2394 http_www_google_.url(), "K", "L", http_www_google_.url().host(), "/bar", | 2374 http_www_google_.url(), "K", "L", http_www_google_.url().host(), "/bar", |
| 2395 creation_time, base::Time(), base::Time(), false, false, false, | 2375 creation_time, base::Time(), base::Time(), false, false, |
| 2396 COOKIE_PRIORITY_DEFAULT); | 2376 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT); |
| 2397 CanonicalCookie cookie7(http_www_google_.url(), "M", "N", | 2377 CanonicalCookie cookie7( |
| 2398 http_www_google_.url().host(), "/foo", creation_time, | 2378 http_www_google_.url(), "M", "N", http_www_google_.url().host(), "/foo", |
| 2399 base::Time(), base::Time(), false, false, false, | 2379 creation_time, base::Time(), base::Time(), false, false, |
| 2400 COOKIE_PRIORITY_DEFAULT); | 2380 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT); |
| 2401 CanonicalCookie cookie7_with_new_path( | 2381 CanonicalCookie cookie7_with_new_path( |
| 2402 http_www_google_.url(), "M", "N", http_www_google_.url().host(), "/bar", | 2382 http_www_google_.url(), "M", "N", http_www_google_.url().host(), "/bar", |
| 2403 creation_time, base::Time(), base::Time(), false, false, false, | 2383 creation_time, base::Time(), base::Time(), false, false, |
| 2404 COOKIE_PRIORITY_DEFAULT); | 2384 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT); |
| 2405 | 2385 |
| 2406 CookieList old_cookies; | 2386 CookieList old_cookies; |
| 2407 old_cookies.push_back(cookie1); | 2387 old_cookies.push_back(cookie1); |
| 2408 old_cookies.push_back(cookie2); | 2388 old_cookies.push_back(cookie2); |
| 2409 old_cookies.push_back(cookie4); | 2389 old_cookies.push_back(cookie4); |
| 2410 old_cookies.push_back(cookie5); | 2390 old_cookies.push_back(cookie5); |
| 2411 old_cookies.push_back(cookie6); | 2391 old_cookies.push_back(cookie6); |
| 2412 old_cookies.push_back(cookie7); | 2392 old_cookies.push_back(cookie7); |
| 2413 | 2393 |
| 2414 CookieList new_cookies; | 2394 CookieList new_cookies; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2488 // above. | 2468 // above. |
| 2489 base::HistogramBase* expired_histogram = base::Histogram::FactoryGet( | 2469 base::HistogramBase* expired_histogram = base::Histogram::FactoryGet( |
| 2490 "Cookie.ExpirationDurationMinutes", 1, 10 * 365 * 24 * 60, 50, | 2470 "Cookie.ExpirationDurationMinutes", 1, 10 * 365 * 24 * 60, 50, |
| 2491 base::Histogram::kUmaTargetedHistogramFlag); | 2471 base::Histogram::kUmaTargetedHistogramFlag); |
| 2492 | 2472 |
| 2493 scoped_ptr<base::HistogramSamples> samples1( | 2473 scoped_ptr<base::HistogramSamples> samples1( |
| 2494 expired_histogram->SnapshotSamples()); | 2474 expired_histogram->SnapshotSamples()); |
| 2495 ASSERT_TRUE(SetCookieWithDetails( | 2475 ASSERT_TRUE(SetCookieWithDetails( |
| 2496 cm.get(), GURL("http://fake.a.url"), "a", "b", "a.url", "/", base::Time(), | 2476 cm.get(), GURL("http://fake.a.url"), "a", "b", "a.url", "/", base::Time(), |
| 2497 base::Time::Now() + base::TimeDelta::FromMinutes(59), base::Time(), false, | 2477 base::Time::Now() + base::TimeDelta::FromMinutes(59), base::Time(), false, |
| 2498 false, false, COOKIE_PRIORITY_DEFAULT)); | 2478 false, CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 2499 | 2479 |
| 2500 scoped_ptr<base::HistogramSamples> samples2( | 2480 scoped_ptr<base::HistogramSamples> samples2( |
| 2501 expired_histogram->SnapshotSamples()); | 2481 expired_histogram->SnapshotSamples()); |
| 2502 EXPECT_EQ(samples1->TotalCount() + 1, samples2->TotalCount()); | 2482 EXPECT_EQ(samples1->TotalCount() + 1, samples2->TotalCount()); |
| 2503 | 2483 |
| 2504 // kValidCookieLine creates a session cookie. | 2484 // kValidCookieLine creates a session cookie. |
| 2505 ASSERT_TRUE(SetCookie(cm.get(), http_www_google_.url(), kValidCookieLine)); | 2485 ASSERT_TRUE(SetCookie(cm.get(), http_www_google_.url(), kValidCookieLine)); |
| 2506 | 2486 |
| 2507 scoped_ptr<base::HistogramSamples> samples3( | 2487 scoped_ptr<base::HistogramSamples> samples3( |
| 2508 expired_histogram->SnapshotSamples()); | 2488 expired_histogram->SnapshotSamples()); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2606 const std::string path("/path"); | 2586 const std::string path("/path"); |
| 2607 | 2587 |
| 2608 scoped_refptr<MockPersistentCookieStore> store(new MockPersistentCookieStore); | 2588 scoped_refptr<MockPersistentCookieStore> store(new MockPersistentCookieStore); |
| 2609 | 2589 |
| 2610 std::vector<CanonicalCookie*> initial_cookies; | 2590 std::vector<CanonicalCookie*> initial_cookies; |
| 2611 | 2591 |
| 2612 AddCookieToList(domain, "foo=bar; path=" + path, now1, &initial_cookies); | 2592 AddCookieToList(domain, "foo=bar; path=" + path, now1, &initial_cookies); |
| 2613 | 2593 |
| 2614 // We have to manually build this cookie because it contains a control | 2594 // We have to manually build this cookie because it contains a control |
| 2615 // character, and our cookie line parser rejects control characters. | 2595 // character, and our cookie line parser rejects control characters. |
| 2616 CanonicalCookie* cc = | 2596 CanonicalCookie* cc = new CanonicalCookie( |
| 2617 new CanonicalCookie(url, "baz", | 2597 url, "baz", |
| 2618 "\x05" | 2598 "\x05" |
| 2619 "boo", | 2599 "boo", |
| 2620 domain, path, now2, later, now2, false, false, false, | 2600 domain, path, now2, later, now2, false, false, |
| 2621 COOKIE_PRIORITY_DEFAULT); | 2601 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT); |
| 2622 initial_cookies.push_back(cc); | 2602 initial_cookies.push_back(cc); |
| 2623 | 2603 |
| 2624 AddCookieToList(domain, "hello=world; path=" + path, now3, &initial_cookies); | 2604 AddCookieToList(domain, "hello=world; path=" + path, now3, &initial_cookies); |
| 2625 | 2605 |
| 2626 // Inject our initial cookies into the mock PersistentCookieStore. | 2606 // Inject our initial cookies into the mock PersistentCookieStore. |
| 2627 store->SetLoadExpectation(true, initial_cookies); | 2607 store->SetLoadExpectation(true, initial_cookies); |
| 2628 | 2608 |
| 2629 scoped_ptr<CookieMonster> cm(new CookieMonster(store.get(), nullptr)); | 2609 scoped_ptr<CookieMonster> cm(new CookieMonster(store.get(), nullptr)); |
| 2630 | 2610 |
| 2631 EXPECT_EQ("foo=bar; hello=world", GetCookies(cm.get(), url)); | 2611 EXPECT_EQ("foo=bar; hello=world", GetCookies(cm.get(), url)); |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3207 monster()->AddCallbackForCookie( | 3187 monster()->AddCallbackForCookie( |
| 3208 test_url_, "abc", | 3188 test_url_, "abc", |
| 3209 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); | 3189 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); |
| 3210 SetCookie(monster(), test_url_, "abc=def"); | 3190 SetCookie(monster(), test_url_, "abc=def"); |
| 3211 base::MessageLoop::current()->RunUntilIdle(); | 3191 base::MessageLoop::current()->RunUntilIdle(); |
| 3212 EXPECT_EQ(1U, cookies0.size()); | 3192 EXPECT_EQ(1U, cookies0.size()); |
| 3213 EXPECT_EQ(1U, cookies0.size()); | 3193 EXPECT_EQ(1U, cookies0.size()); |
| 3214 } | 3194 } |
| 3215 | 3195 |
| 3216 } // namespace net | 3196 } // namespace net |
| OLD | NEW |