| 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 19 matching lines...) Expand all Loading... |
| 30 #include "net/cookies/cookie_monster.h" | 30 #include "net/cookies/cookie_monster.h" |
| 31 #include "net/cookies/cookie_monster_store_test.h" // For CookieStore mock | 31 #include "net/cookies/cookie_monster_store_test.h" // For CookieStore mock |
| 32 #include "net/cookies/cookie_util.h" | 32 #include "net/cookies/cookie_util.h" |
| 33 #include "net/cookies/parsed_cookie.h" | 33 #include "net/cookies/parsed_cookie.h" |
| 34 #include "testing/gmock/include/gmock/gmock.h" | 34 #include "testing/gmock/include/gmock/gmock.h" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
| 36 #include "url/gurl.h" | 36 #include "url/gurl.h" |
| 37 | 37 |
| 38 namespace net { | 38 namespace net { |
| 39 | 39 |
| 40 using CookiePredicate = CookieStore::CookiePredicate; |
| 40 using base::Time; | 41 using base::Time; |
| 41 using base::TimeDelta; | 42 using base::TimeDelta; |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 45 // TODO(erikwright): Replace the pre-existing MockPersistentCookieStore (and | 46 // TODO(erikwright): Replace the pre-existing MockPersistentCookieStore (and |
| 46 // brethren) with this one, and remove the 'New' prefix. | 47 // brethren) with this one, and remove the 'New' prefix. |
| 47 class NewMockPersistentCookieStore | 48 class NewMockPersistentCookieStore |
| 48 : public CookieMonster::PersistentCookieStore { | 49 : public CookieMonster::PersistentCookieStore { |
| 49 public: | 50 public: |
| 50 MOCK_METHOD1(Load, void(const LoadedCallback& loaded_callback)); | 51 MOCK_METHOD1(Load, void(const LoadedCallback& loaded_callback)); |
| 51 MOCK_METHOD2(LoadCookiesForKey, | 52 MOCK_METHOD2(LoadCookiesForKey, |
| 52 void(const std::string& key, | 53 void(const std::string& key, |
| 53 const LoadedCallback& loaded_callback)); | 54 const LoadedCallback& loaded_callback)); |
| 54 MOCK_METHOD1(AddCookie, void(const CanonicalCookie& cc)); | 55 MOCK_METHOD1(AddCookie, void(const CanonicalCookie& cc)); |
| 55 MOCK_METHOD1(UpdateCookieAccessTime, void(const CanonicalCookie& cc)); | 56 MOCK_METHOD1(UpdateCookieAccessTime, void(const CanonicalCookie& cc)); |
| 56 MOCK_METHOD1(DeleteCookie, void(const CanonicalCookie& cc)); | 57 MOCK_METHOD1(DeleteCookie, void(const CanonicalCookie& cc)); |
| 57 virtual void Flush(const base::Closure& callback) { | 58 virtual void Flush(const base::Closure& callback) { |
| 58 if (!callback.is_null()) | 59 if (!callback.is_null()) |
| 59 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); | 60 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); |
| 60 } | 61 } |
| 61 MOCK_METHOD0(SetForceKeepSessionState, void()); | 62 MOCK_METHOD0(SetForceKeepSessionState, void()); |
| 62 | 63 |
| 63 private: | 64 private: |
| 64 virtual ~NewMockPersistentCookieStore() {} | 65 virtual ~NewMockPersistentCookieStore() {} |
| 65 }; | 66 }; |
| 66 | 67 |
| 68 // False means 'less than or equal', so we test both ways for full equal. |
| 69 MATCHER_P(CookieEquals, expected, "") { |
| 70 return !(arg.FullCompare(expected) || expected.FullCompare(arg)); |
| 71 } |
| 72 |
| 67 const char kTopLevelDomainPlus1[] = "http://www.harvard.edu"; | 73 const char kTopLevelDomainPlus1[] = "http://www.harvard.edu"; |
| 68 const char kTopLevelDomainPlus2[] = "http://www.math.harvard.edu"; | 74 const char kTopLevelDomainPlus2[] = "http://www.math.harvard.edu"; |
| 69 const char kTopLevelDomainPlus2Secure[] = "https://www.math.harvard.edu"; | 75 const char kTopLevelDomainPlus2Secure[] = "https://www.math.harvard.edu"; |
| 70 const char kTopLevelDomainPlus3[] = "http://www.bourbaki.math.harvard.edu"; | 76 const char kTopLevelDomainPlus3[] = "http://www.bourbaki.math.harvard.edu"; |
| 71 const char kOtherDomain[] = "http://www.mit.edu"; | 77 const char kOtherDomain[] = "http://www.mit.edu"; |
| 72 | 78 |
| 79 bool AlwaysTrueCookiePredicate(CanonicalCookie* to_save, |
| 80 const CanonicalCookie& cookie) { |
| 81 if (to_save) |
| 82 *to_save = cookie; |
| 83 return true; |
| 84 } |
| 85 |
| 86 bool AlwaysFalseCookiePredicate(CanonicalCookie* to_save, |
| 87 const CanonicalCookie& cookie) { |
| 88 if (to_save) |
| 89 *to_save = cookie; |
| 90 return false; |
| 91 } |
| 92 |
| 93 bool CookieValuePredicate(const std::string& true_value, |
| 94 const CanonicalCookie& cookie) { |
| 95 return cookie.Value() == true_value; |
| 96 } |
| 97 |
| 73 struct CookieMonsterTestTraits { | 98 struct CookieMonsterTestTraits { |
| 74 static scoped_ptr<CookieStore> Create() { | 99 static scoped_ptr<CookieStore> Create() { |
| 75 return make_scoped_ptr(new CookieMonster(nullptr, nullptr)); | 100 return make_scoped_ptr(new CookieMonster(nullptr, nullptr)); |
| 76 } | 101 } |
| 77 | 102 |
| 78 static const bool supports_http_only = true; | 103 static const bool supports_http_only = true; |
| 79 static const bool supports_non_dotted_domains = true; | 104 static const bool supports_non_dotted_domains = true; |
| 80 static const bool preserves_trailing_dots = true; | 105 static const bool preserves_trailing_dots = true; |
| 81 static const bool filters_schemes = true; | 106 static const bool filters_schemes = true; |
| 82 static const bool has_path_prefix_bug = false; | 107 static const bool has_path_prefix_bug = false; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 DCHECK(cm); | 168 DCHECK(cm); |
| 144 ResultSavingCookieCallback<int> callback; | 169 ResultSavingCookieCallback<int> callback; |
| 145 cm->DeleteAllCreatedBetweenAsync( | 170 cm->DeleteAllCreatedBetweenAsync( |
| 146 delete_begin, delete_end, | 171 delete_begin, delete_end, |
| 147 base::Bind(&ResultSavingCookieCallback<int>::Run, | 172 base::Bind(&ResultSavingCookieCallback<int>::Run, |
| 148 base::Unretained(&callback))); | 173 base::Unretained(&callback))); |
| 149 callback.WaitUntilDone(); | 174 callback.WaitUntilDone(); |
| 150 return callback.result(); | 175 return callback.result(); |
| 151 } | 176 } |
| 152 | 177 |
| 153 int DeleteAllCreatedBetweenForHost(CookieMonster* cm, | 178 int DeleteAllCreatedBetweenWithPredicate(CookieMonster* cm, |
| 154 const base::Time delete_begin, | 179 const base::Time delete_begin, |
| 155 const base::Time delete_end, | 180 const base::Time delete_end, |
| 156 const GURL& url) { | 181 const CookiePredicate& predicate) { |
| 157 DCHECK(cm); | 182 DCHECK(cm); |
| 158 ResultSavingCookieCallback<int> callback; | 183 ResultSavingCookieCallback<int> callback; |
| 159 cm->DeleteAllCreatedBetweenForHostAsync( | 184 cm->DeleteAllCreatedBetweenWithPredicateAsync( |
| 160 delete_begin, delete_end, url, | 185 delete_begin, delete_end, predicate, |
| 161 base::Bind(&ResultSavingCookieCallback<int>::Run, | 186 base::Bind(&ResultSavingCookieCallback<int>::Run, |
| 162 base::Unretained(&callback))); | 187 base::Unretained(&callback))); |
| 163 callback.WaitUntilDone(); | 188 callback.WaitUntilDone(); |
| 164 return callback.result(); | 189 return callback.result(); |
| 165 } | 190 } |
| 166 | 191 |
| 167 // Helper for DeleteAllForHost test; repopulates CM with same layout | 192 // Helper for PredicateSeesAllCookies test; repopulates CM with same layout |
| 168 // each time. | 193 // each time. |
| 169 void PopulateCmForDeleteAllForHost(CookieMonster* cm) { | 194 void PopulateCmForPredicateCheck(CookieMonster* cm) { |
| 170 GURL url_top_level_domain_plus_1(kTopLevelDomainPlus1); | 195 GURL url_top_level_domain_plus_1(kTopLevelDomainPlus1); |
| 171 GURL url_top_level_domain_plus_2(kTopLevelDomainPlus2); | 196 GURL url_top_level_domain_plus_2(kTopLevelDomainPlus2); |
| 172 GURL url_top_level_domain_plus_2_secure(kTopLevelDomainPlus2Secure); | 197 GURL url_top_level_domain_plus_2_secure(kTopLevelDomainPlus2Secure); |
| 173 GURL url_top_level_domain_plus_3(kTopLevelDomainPlus3); | 198 GURL url_top_level_domain_plus_3(kTopLevelDomainPlus3); |
| 174 GURL url_other(kOtherDomain); | 199 GURL url_other(kOtherDomain); |
| 175 | 200 |
| 176 this->DeleteAll(cm); | 201 this->DeleteAll(cm); |
| 177 | 202 |
| 178 // Static population for probe: | 203 // Static population for probe: |
| 179 // * Three levels of domain cookie (.b.a, .c.b.a, .d.c.b.a) | 204 // * Three levels of domain cookie (.b.a, .c.b.a, .d.c.b.a) |
| 180 // * Three levels of host cookie (w.b.a, w.c.b.a, w.d.c.b.a) | 205 // * 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) | 206 // * http_only cookie (w.c.b.a) |
| 182 // * same_site cookie (w.c.b.a) | 207 // * same_site cookie (w.c.b.a) |
| 183 // * Two secure cookies (.c.b.a, w.c.b.a) | 208 // * Two secure cookies (.c.b.a, w.c.b.a) |
| 184 // * Two domain path cookies (.c.b.a/dir1, .c.b.a/dir1/dir2) | 209 // * 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) | 210 // * Two host path cookies (w.c.b.a/dir1, w.c.b.a/dir1/dir2) |
| 186 | 211 |
| 187 // Domain cookies | 212 // Domain cookies |
| 188 EXPECT_TRUE(this->SetCookieWithDetails( | 213 EXPECT_TRUE(this->SetCookieWithDetails( |
| 189 cm, url_top_level_domain_plus_1, "dom_1", "X", ".harvard.edu", "/", | 214 cm, url_top_level_domain_plus_1, "dom_1", "A", ".harvard.edu", "/", |
| 190 base::Time(), base::Time(), base::Time(), false, false, | 215 base::Time(), base::Time(), base::Time(), false, false, |
| 191 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); | 216 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 192 EXPECT_TRUE(this->SetCookieWithDetails( | 217 EXPECT_TRUE(this->SetCookieWithDetails( |
| 193 cm, url_top_level_domain_plus_2, "dom_2", "X", ".math.harvard.edu", "/", | 218 cm, url_top_level_domain_plus_2, "dom_2", "B", ".math.harvard.edu", "/", |
| 194 base::Time(), base::Time(), base::Time(), false, false, | 219 base::Time(), base::Time(), base::Time(), false, false, |
| 195 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); | 220 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 196 EXPECT_TRUE(this->SetCookieWithDetails( | 221 EXPECT_TRUE(this->SetCookieWithDetails( |
| 197 cm, url_top_level_domain_plus_3, "dom_3", "X", | 222 cm, url_top_level_domain_plus_3, "dom_3", "C", |
| 198 ".bourbaki.math.harvard.edu", "/", base::Time(), base::Time(), | 223 ".bourbaki.math.harvard.edu", "/", base::Time(), base::Time(), |
| 199 base::Time(), false, false, CookieSameSite::DEFAULT_MODE, | 224 base::Time(), false, false, CookieSameSite::DEFAULT_MODE, |
| 200 COOKIE_PRIORITY_DEFAULT)); | 225 COOKIE_PRIORITY_DEFAULT)); |
| 201 | 226 |
| 202 // Host cookies | 227 // Host cookies |
| 203 EXPECT_TRUE(this->SetCookieWithDetails( | 228 EXPECT_TRUE(this->SetCookieWithDetails( |
| 204 cm, url_top_level_domain_plus_1, "host_1", "X", std::string(), "/", | 229 cm, url_top_level_domain_plus_1, "host_1", "A", std::string(), "/", |
| 205 base::Time(), base::Time(), base::Time(), false, false, | 230 base::Time(), base::Time(), base::Time(), false, false, |
| 206 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); | 231 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 207 EXPECT_TRUE(this->SetCookieWithDetails( | 232 EXPECT_TRUE(this->SetCookieWithDetails( |
| 208 cm, url_top_level_domain_plus_2, "host_2", "X", std::string(), "/", | 233 cm, url_top_level_domain_plus_2, "host_2", "B", std::string(), "/", |
| 209 base::Time(), base::Time(), base::Time(), false, false, | 234 base::Time(), base::Time(), base::Time(), false, false, |
| 210 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); | 235 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 211 EXPECT_TRUE(this->SetCookieWithDetails( | 236 EXPECT_TRUE(this->SetCookieWithDetails( |
| 212 cm, url_top_level_domain_plus_3, "host_3", "X", std::string(), "/", | 237 cm, url_top_level_domain_plus_3, "host_3", "C", std::string(), "/", |
| 213 base::Time(), base::Time(), base::Time(), false, false, | 238 base::Time(), base::Time(), base::Time(), false, false, |
| 214 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); | 239 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 215 | 240 |
| 216 // http_only cookie | 241 // http_only cookie |
| 217 EXPECT_TRUE(this->SetCookieWithDetails( | 242 EXPECT_TRUE(this->SetCookieWithDetails( |
| 218 cm, url_top_level_domain_plus_2, "httpo_check", "x", std::string(), "/", | 243 cm, url_top_level_domain_plus_2, "httpo_check", "A", std::string(), "/", |
| 219 base::Time(), base::Time(), base::Time(), false, true, | 244 base::Time(), base::Time(), base::Time(), false, true, |
| 220 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); | 245 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 221 | 246 |
| 222 // same-site cookie | 247 // same-site cookie |
| 223 EXPECT_TRUE(this->SetCookieWithDetails( | 248 EXPECT_TRUE(this->SetCookieWithDetails( |
| 224 cm, url_top_level_domain_plus_2, "firstp_check", "x", std::string(), | 249 cm, url_top_level_domain_plus_2, "firstp_check", "A", std::string(), |
| 225 "/", base::Time(), base::Time(), base::Time(), false, false, | 250 "/", base::Time(), base::Time(), base::Time(), false, false, |
| 226 CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT)); | 251 CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 227 | 252 |
| 228 // Secure cookies | 253 // Secure cookies |
| 229 EXPECT_TRUE(this->SetCookieWithDetails( | 254 EXPECT_TRUE(this->SetCookieWithDetails( |
| 230 cm, url_top_level_domain_plus_2_secure, "sec_dom", "X", | 255 cm, url_top_level_domain_plus_2_secure, "sec_dom", "A", |
| 231 ".math.harvard.edu", "/", base::Time(), base::Time(), base::Time(), | 256 ".math.harvard.edu", "/", base::Time(), base::Time(), base::Time(), |
| 232 true, false, CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); | 257 true, false, CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 233 EXPECT_TRUE(this->SetCookieWithDetails( | 258 EXPECT_TRUE(this->SetCookieWithDetails( |
| 234 cm, url_top_level_domain_plus_2_secure, "sec_host", "X", std::string(), | 259 cm, url_top_level_domain_plus_2_secure, "sec_host", "B", std::string(), |
| 235 "/", base::Time(), base::Time(), base::Time(), true, false, | 260 "/", base::Time(), base::Time(), base::Time(), true, false, |
| 236 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); | 261 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 237 | 262 |
| 238 // Domain path cookies | 263 // Domain path cookies |
| 239 EXPECT_TRUE(this->SetCookieWithDetails( | 264 EXPECT_TRUE(this->SetCookieWithDetails( |
| 240 cm, url_top_level_domain_plus_2, "dom_path_1", "X", ".math.harvard.edu", | 265 cm, url_top_level_domain_plus_2, "dom_path_1", "A", ".math.harvard.edu", |
| 241 "/dir1", base::Time(), base::Time(), base::Time(), false, false, | 266 "/dir1", base::Time(), base::Time(), base::Time(), false, false, |
| 242 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); | 267 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 243 EXPECT_TRUE(this->SetCookieWithDetails( | 268 EXPECT_TRUE(this->SetCookieWithDetails( |
| 244 cm, url_top_level_domain_plus_2, "dom_path_2", "X", ".math.harvard.edu", | 269 cm, url_top_level_domain_plus_2, "dom_path_2", "B", ".math.harvard.edu", |
| 245 "/dir1/dir2", base::Time(), base::Time(), base::Time(), false, false, | 270 "/dir1/dir2", base::Time(), base::Time(), base::Time(), false, false, |
| 246 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); | 271 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 247 | 272 |
| 248 // Host path cookies | 273 // Host path cookies |
| 249 EXPECT_TRUE(this->SetCookieWithDetails( | 274 EXPECT_TRUE(this->SetCookieWithDetails( |
| 250 cm, url_top_level_domain_plus_2, "host_path_1", "X", std::string(), | 275 cm, url_top_level_domain_plus_2, "host_path_1", "A", std::string(), |
| 251 "/dir1", base::Time(), base::Time(), base::Time(), false, false, | 276 "/dir1", base::Time(), base::Time(), base::Time(), false, false, |
| 252 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); | 277 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 253 EXPECT_TRUE(this->SetCookieWithDetails( | 278 EXPECT_TRUE(this->SetCookieWithDetails( |
| 254 cm, url_top_level_domain_plus_2, "host_path_2", "X", std::string(), | 279 cm, url_top_level_domain_plus_2, "host_path_2", "B", std::string(), |
| 255 "/dir1/dir2", base::Time(), base::Time(), base::Time(), false, false, | 280 "/dir1/dir2", base::Time(), base::Time(), base::Time(), false, false, |
| 256 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); | 281 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT)); |
| 257 | 282 |
| 258 EXPECT_EQ(14U, this->GetAllCookies(cm).size()); | 283 EXPECT_EQ(14U, this->GetAllCookies(cm).size()); |
| 259 } | 284 } |
| 260 | 285 |
| 261 Time GetFirstCookieAccessDate(CookieMonster* cm) { | 286 Time GetFirstCookieAccessDate(CookieMonster* cm) { |
| 262 const CookieList all_cookies(this->GetAllCookies(cm)); | 287 const CookieList all_cookies(this->GetAllCookies(cm)); |
| 263 return all_cookies.front().LastAccessDate(); | 288 return all_cookies.front().LastAccessDate(); |
| 264 } | 289 } |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 cc.url, cc.name, cc.value, cc.domain, cc.path, base::Time(), | 685 cc.url, cc.name, cc.value, cc.domain, cc.path, base::Time(), |
| 661 cc.expiration_time, base::Time(), cc.secure, cc.http_only, cc.same_site, | 686 cc.expiration_time, base::Time(), cc.secure, cc.http_only, cc.same_site, |
| 662 false /* enforces strict secure cookies */, cc.priority, | 687 false /* enforces strict secure cookies */, cc.priority, |
| 663 callback->AsCallback()); | 688 callback->AsCallback()); |
| 664 } | 689 } |
| 665 | 690 |
| 666 ACTION_P2(GetAllCookiesAction, cookie_monster, callback) { | 691 ACTION_P2(GetAllCookiesAction, cookie_monster, callback) { |
| 667 cookie_monster->GetAllCookiesAsync(callback->AsCallback()); | 692 cookie_monster->GetAllCookiesAsync(callback->AsCallback()); |
| 668 } | 693 } |
| 669 | 694 |
| 670 ACTION_P5(DeleteAllCreatedBetweenForHostAction, | 695 ACTION_P5(DeleteAllCreatedBetweenWithPredicateAction, |
| 671 cookie_monster, | 696 cookie_monster, |
| 672 delete_begin, | 697 delete_begin, |
| 673 delete_end, | 698 delete_end, |
| 674 url, | 699 predicate, |
| 675 callback) { | 700 callback) { |
| 676 cookie_monster->DeleteAllCreatedBetweenForHostAsync( | 701 cookie_monster->DeleteAllCreatedBetweenWithPredicateAsync( |
| 677 delete_begin, delete_end, url, callback->AsCallback()); | 702 delete_begin, delete_end, predicate, callback->AsCallback()); |
| 678 } | 703 } |
| 679 | 704 |
| 680 ACTION_P3(DeleteCanonicalCookieAction, cookie_monster, cookie, callback) { | 705 ACTION_P3(DeleteCanonicalCookieAction, cookie_monster, cookie, callback) { |
| 681 cookie_monster->DeleteCanonicalCookieAsync(cookie, callback->AsCallback()); | 706 cookie_monster->DeleteCanonicalCookieAsync(cookie, callback->AsCallback()); |
| 682 } | 707 } |
| 683 | 708 |
| 684 ACTION_P2(DeleteAllAction, cookie_monster, callback) { | 709 ACTION_P2(DeleteAllAction, cookie_monster, callback) { |
| 685 cookie_monster->DeleteAllAsync(callback->AsCallback()); | 710 cookie_monster->DeleteAllAsync(callback->AsCallback()); |
| 686 } | 711 } |
| 687 | 712 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 .WillOnce(DeleteAllCreatedBetweenAction(&cookie_monster(), base::Time(), | 1068 .WillOnce(DeleteAllCreatedBetweenAction(&cookie_monster(), base::Time(), |
| 1044 base::Time::Now(), | 1069 base::Time::Now(), |
| 1045 &delete_callback)); | 1070 &delete_callback)); |
| 1046 base::RunLoop loop; | 1071 base::RunLoop loop; |
| 1047 EXPECT_CALL(delete_callback, Invoke(false)).WillOnce(QuitRunLoop(&loop)); | 1072 EXPECT_CALL(delete_callback, Invoke(false)).WillOnce(QuitRunLoop(&loop)); |
| 1048 | 1073 |
| 1049 CompleteLoading(); | 1074 CompleteLoading(); |
| 1050 loop.Run(); | 1075 loop.Run(); |
| 1051 } | 1076 } |
| 1052 | 1077 |
| 1053 TEST_F(DeferredCookieTaskTest, DeferredDeleteAllForHostCreatedBetweenCookies) { | 1078 TEST_F(DeferredCookieTaskTest, |
| 1079 DeferredDeleteAllWithPredicateCreatedBetweenCookies) { |
| 1054 MockDeleteCallback delete_callback; | 1080 MockDeleteCallback delete_callback; |
| 1055 | 1081 |
| 1056 BeginWithForDomainKey(http_www_google_.domain(), | 1082 CookiePredicate predicate = base::Bind(&AlwaysTrueCookiePredicate, nullptr); |
| 1057 DeleteAllCreatedBetweenForHostAction( | 1083 |
| 1058 &cookie_monster(), base::Time(), base::Time::Now(), | 1084 BeginWith(DeleteAllCreatedBetweenWithPredicateAction( |
| 1059 http_www_google_.url(), &delete_callback)); | 1085 &cookie_monster(), base::Time(), base::Time::Now(), predicate, |
| 1086 &delete_callback)); |
| 1060 | 1087 |
| 1061 WaitForLoadCall(); | 1088 WaitForLoadCall(); |
| 1062 | 1089 |
| 1063 EXPECT_CALL(delete_callback, Invoke(false)) | 1090 EXPECT_CALL(delete_callback, Invoke(false)) |
| 1064 .WillOnce(DeleteAllCreatedBetweenForHostAction( | 1091 .WillOnce(DeleteAllCreatedBetweenWithPredicateAction( |
| 1065 &cookie_monster(), base::Time(), base::Time::Now(), | 1092 &cookie_monster(), base::Time(), base::Time::Now(), predicate, |
| 1066 http_www_google_.url(), &delete_callback)); | 1093 &delete_callback)); |
| 1067 base::RunLoop loop; | 1094 base::RunLoop loop; |
| 1068 EXPECT_CALL(delete_callback, Invoke(false)).WillOnce(QuitRunLoop(&loop)); | 1095 EXPECT_CALL(delete_callback, Invoke(false)).WillOnce(QuitRunLoop(&loop)); |
| 1069 | 1096 |
| 1070 CompleteLoading(); | 1097 CompleteLoading(); |
| 1071 loop.Run(); | 1098 loop.Run(); |
| 1072 } | 1099 } |
| 1073 | 1100 |
| 1074 TEST_F(DeferredCookieTaskTest, DeferredDeleteCanonicalCookie) { | 1101 TEST_F(DeferredCookieTaskTest, DeferredDeleteCanonicalCookie) { |
| 1075 std::vector<CanonicalCookie*> cookies; | 1102 std::vector<CanonicalCookie*> cookies; |
| 1076 scoped_ptr<CanonicalCookie> cookie = BuildCanonicalCookie( | 1103 scoped_ptr<CanonicalCookie> cookie = BuildCanonicalCookie( |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 } | 1207 } |
| 1181 | 1208 |
| 1182 TEST_F(CookieMonsterTest, TestCookieDeleteAllCreatedBetweenTimestamps) { | 1209 TEST_F(CookieMonsterTest, TestCookieDeleteAllCreatedBetweenTimestamps) { |
| 1183 scoped_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr)); | 1210 scoped_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr)); |
| 1184 Time now = Time::Now(); | 1211 Time now = Time::Now(); |
| 1185 | 1212 |
| 1186 // Nothing has been added so nothing should be deleted. | 1213 // Nothing has been added so nothing should be deleted. |
| 1187 EXPECT_EQ(0, DeleteAllCreatedBetween(cm.get(), now - TimeDelta::FromDays(99), | 1214 EXPECT_EQ(0, DeleteAllCreatedBetween(cm.get(), now - TimeDelta::FromDays(99), |
| 1188 Time())); | 1215 Time())); |
| 1189 | 1216 |
| 1190 // Create 3 cookies with creation date of today, yesterday and the day before. | 1217 // Create 5 cookies with different creation dates. |
| 1191 EXPECT_TRUE( | 1218 EXPECT_TRUE( |
| 1192 cm->SetCookieWithCreationTime(http_www_google_.url(), "T-0=Now", now)); | 1219 cm->SetCookieWithCreationTime(http_www_google_.url(), "T-0=Now", now)); |
| 1193 EXPECT_TRUE(cm->SetCookieWithCreationTime( | 1220 EXPECT_TRUE(cm->SetCookieWithCreationTime( |
| 1194 http_www_google_.url(), "T-1=Yesterday", now - TimeDelta::FromDays(1))); | 1221 http_www_google_.url(), "T-1=Yesterday", now - TimeDelta::FromDays(1))); |
| 1195 EXPECT_TRUE(cm->SetCookieWithCreationTime( | 1222 EXPECT_TRUE(cm->SetCookieWithCreationTime( |
| 1196 http_www_google_.url(), "T-2=DayBefore", now - TimeDelta::FromDays(2))); | 1223 http_www_google_.url(), "T-2=DayBefore", now - TimeDelta::FromDays(2))); |
| 1197 EXPECT_TRUE(cm->SetCookieWithCreationTime( | 1224 EXPECT_TRUE(cm->SetCookieWithCreationTime( |
| 1198 http_www_google_.url(), "T-3=ThreeDays", now - TimeDelta::FromDays(3))); | 1225 http_www_google_.url(), "T-3=ThreeDays", now - TimeDelta::FromDays(3))); |
| 1199 EXPECT_TRUE(cm->SetCookieWithCreationTime( | 1226 EXPECT_TRUE(cm->SetCookieWithCreationTime( |
| 1200 http_www_google_.url(), "T-7=LastWeek", now - TimeDelta::FromDays(7))); | 1227 http_www_google_.url(), "T-7=LastWeek", now - TimeDelta::FromDays(7))); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1212 EXPECT_EQ( | 1239 EXPECT_EQ( |
| 1213 1, DeleteAllCreatedBetween(cm.get(), now - TimeDelta::FromDays(7), now)); | 1240 1, DeleteAllCreatedBetween(cm.get(), now - TimeDelta::FromDays(7), now)); |
| 1214 | 1241 |
| 1215 // Delete the last (now) item. | 1242 // Delete the last (now) item. |
| 1216 EXPECT_EQ(1, DeleteAllCreatedBetween(cm.get(), Time(), Time())); | 1243 EXPECT_EQ(1, DeleteAllCreatedBetween(cm.get(), Time(), Time())); |
| 1217 | 1244 |
| 1218 // Really make sure everything is gone. | 1245 // Really make sure everything is gone. |
| 1219 EXPECT_EQ(0, DeleteAll(cm.get())); | 1246 EXPECT_EQ(0, DeleteAll(cm.get())); |
| 1220 } | 1247 } |
| 1221 | 1248 |
| 1249 TEST_F(CookieMonsterTest, |
| 1250 TestCookieDeleteAllCreatedBetweenTimestampsWithPredicate) { |
| 1251 scoped_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr)); |
| 1252 Time now = Time::Now(); |
| 1253 |
| 1254 CanonicalCookie test_cookie; |
| 1255 CookiePredicate true_predicate = |
| 1256 base::Bind(&AlwaysTrueCookiePredicate, &test_cookie); |
| 1257 |
| 1258 CookiePredicate false_predicate = |
| 1259 base::Bind(&AlwaysFalseCookiePredicate, &test_cookie); |
| 1260 |
| 1261 // Nothing has been added so nothing should be deleted. |
| 1262 EXPECT_EQ( |
| 1263 0, DeleteAllCreatedBetweenWithPredicate( |
| 1264 cm.get(), now - TimeDelta::FromDays(99), Time(), true_predicate)); |
| 1265 |
| 1266 // Create 5 cookies with different creation dates. |
| 1267 EXPECT_TRUE( |
| 1268 cm->SetCookieWithCreationTime(http_www_google_.url(), "T-0=Now", now)); |
| 1269 EXPECT_TRUE(cm->SetCookieWithCreationTime( |
| 1270 http_www_google_.url(), "T-1=Yesterday", now - TimeDelta::FromDays(1))); |
| 1271 EXPECT_TRUE(cm->SetCookieWithCreationTime( |
| 1272 http_www_google_.url(), "T-2=DayBefore", now - TimeDelta::FromDays(2))); |
| 1273 EXPECT_TRUE(cm->SetCookieWithCreationTime( |
| 1274 http_www_google_.url(), "T-3=ThreeDays", now - TimeDelta::FromDays(3))); |
| 1275 EXPECT_TRUE(cm->SetCookieWithCreationTime( |
| 1276 http_www_google_.url(), "T-7=LastWeek", now - TimeDelta::FromDays(7))); |
| 1277 |
| 1278 // Try to delete threedays and the daybefore, but we should do nothing due |
| 1279 // to the predicate. |
| 1280 EXPECT_EQ(0, DeleteAllCreatedBetweenWithPredicate( |
| 1281 cm.get(), now - TimeDelta::FromDays(3), |
| 1282 now - TimeDelta::FromDays(1), false_predicate)); |
| 1283 // Same as above with a null predicate, so it shouldn't delete anything. |
| 1284 EXPECT_EQ(0, DeleteAllCreatedBetweenWithPredicate( |
| 1285 cm.get(), now - TimeDelta::FromDays(3), |
| 1286 now - TimeDelta::FromDays(1), CookiePredicate())); |
| 1287 // Same as above, but we use the true_predicate, so it works. |
| 1288 EXPECT_EQ(2, DeleteAllCreatedBetweenWithPredicate( |
| 1289 cm.get(), now - TimeDelta::FromDays(3), |
| 1290 now - TimeDelta::FromDays(1), true_predicate)); |
| 1291 |
| 1292 // Try to delete yesterday, also make sure that delete_end is not |
| 1293 // inclusive. |
| 1294 EXPECT_EQ(0, |
| 1295 DeleteAllCreatedBetweenWithPredicate( |
| 1296 cm.get(), now - TimeDelta::FromDays(2), now, false_predicate)); |
| 1297 EXPECT_EQ(1, |
| 1298 DeleteAllCreatedBetweenWithPredicate( |
| 1299 cm.get(), now - TimeDelta::FromDays(2), now, true_predicate)); |
| 1300 // Check our cookie values. |
| 1301 scoped_ptr<CanonicalCookie> expected_cookie = |
| 1302 CanonicalCookie::Create(http_www_google_.url(), "T-1=Yesterday", |
| 1303 now - TimeDelta::FromDays(1), CookieOptions()); |
| 1304 EXPECT_THAT(test_cookie, CookieEquals(*expected_cookie)) |
| 1305 << "Actual:\n" |
| 1306 << test_cookie.DebugString() << "\nExpected:\n" |
| 1307 << expected_cookie->DebugString(); |
| 1308 |
| 1309 // Make sure the delete_begin is inclusive. |
| 1310 EXPECT_EQ(0, |
| 1311 DeleteAllCreatedBetweenWithPredicate( |
| 1312 cm.get(), now - TimeDelta::FromDays(7), now, false_predicate)); |
| 1313 EXPECT_EQ(1, |
| 1314 DeleteAllCreatedBetweenWithPredicate( |
| 1315 cm.get(), now - TimeDelta::FromDays(7), now, true_predicate)); |
| 1316 |
| 1317 // Delete the last (now) item. |
| 1318 EXPECT_EQ(0, DeleteAllCreatedBetweenWithPredicate(cm.get(), Time(), Time(), |
| 1319 false_predicate)); |
| 1320 EXPECT_EQ(1, DeleteAllCreatedBetweenWithPredicate(cm.get(), Time(), Time(), |
| 1321 true_predicate)); |
| 1322 expected_cookie = CanonicalCookie::Create(http_www_google_.url(), "T-0=Now", |
| 1323 now, CookieOptions()); |
| 1324 EXPECT_THAT(test_cookie, CookieEquals(*expected_cookie)) |
| 1325 << "Actual:\n" |
| 1326 << test_cookie.DebugString() << "\nExpected:\n" |
| 1327 << expected_cookie->DebugString(); |
| 1328 |
| 1329 // Really make sure everything is gone. |
| 1330 EXPECT_EQ(0, DeleteAll(cm.get())); |
| 1331 } |
| 1332 |
| 1222 static const int kAccessDelayMs = kLastAccessThresholdMilliseconds + 20; | 1333 static const int kAccessDelayMs = kLastAccessThresholdMilliseconds + 20; |
| 1223 | 1334 |
| 1224 TEST_F(CookieMonsterTest, TestLastAccess) { | 1335 TEST_F(CookieMonsterTest, TestLastAccess) { |
| 1225 scoped_ptr<CookieMonster> cm( | 1336 scoped_ptr<CookieMonster> cm( |
| 1226 new CookieMonster(nullptr, nullptr, kLastAccessThresholdMilliseconds)); | 1337 new CookieMonster(nullptr, nullptr, kLastAccessThresholdMilliseconds)); |
| 1227 | 1338 |
| 1228 EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "A=B")); | 1339 EXPECT_TRUE(SetCookie(cm.get(), http_www_google_.url(), "A=B")); |
| 1229 const Time last_access_date(GetFirstCookieAccessDate(cm.get())); | 1340 const Time last_access_date(GetFirstCookieAccessDate(cm.get())); |
| 1230 | 1341 |
| 1231 // Reading the cookie again immediately shouldn't update the access date, | 1342 // Reading the cookie again immediately shouldn't update the access date, |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 EXPECT_EQ("a", delegate->changes()[0].first.Name()); | 1755 EXPECT_EQ("a", delegate->changes()[0].first.Name()); |
| 1645 EXPECT_EQ("val1", delegate->changes()[0].first.Value()); | 1756 EXPECT_EQ("val1", delegate->changes()[0].first.Value()); |
| 1646 EXPECT_EQ(http_www_google_.url().host(), | 1757 EXPECT_EQ(http_www_google_.url().host(), |
| 1647 delegate->changes()[1].first.Domain()); | 1758 delegate->changes()[1].first.Domain()); |
| 1648 EXPECT_FALSE(delegate->changes()[1].second); | 1759 EXPECT_FALSE(delegate->changes()[1].second); |
| 1649 EXPECT_EQ("a", delegate->changes()[1].first.Name()); | 1760 EXPECT_EQ("a", delegate->changes()[1].first.Name()); |
| 1650 EXPECT_EQ("val2", delegate->changes()[1].first.Value()); | 1761 EXPECT_EQ("val2", delegate->changes()[1].first.Value()); |
| 1651 delegate->reset(); | 1762 delegate->reset(); |
| 1652 } | 1763 } |
| 1653 | 1764 |
| 1654 TEST_F(CookieMonsterTest, DeleteAllForHost) { | 1765 TEST_F(CookieMonsterTest, PredicateSeesAllCookies) { |
| 1766 const std::string kTrueValue = "A"; |
| 1655 scoped_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr)); | 1767 scoped_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr)); |
| 1768 // We test that we can see all cookies with our predicated. This includes |
| 1769 // host, http_only, host secure, and all domain cookies. |
| 1770 CookiePredicate value_matcher = base::Bind(&CookieValuePredicate, kTrueValue); |
| 1656 | 1771 |
| 1657 // Test probes: | 1772 PopulateCmForPredicateCheck(cm.get()); |
| 1658 // * Non-secure URL, mid-level (http://w.c.b.a) | 1773 EXPECT_EQ(7, DeleteAllCreatedBetweenWithPredicate( |
| 1659 // * Secure URL, mid-level (https://w.c.b.a) | 1774 cm.get(), base::Time(), base::Time::Now(), value_matcher)); |
| 1660 // * URL with path, mid-level (https:/w.c.b.a/dir1/xx) | 1775 |
| 1661 // All three tests should nuke only the midlevel host cookie, | 1776 EXPECT_EQ("dom_2=B; dom_3=C; host_3=C", |
| 1662 // the http_only cookie, the host secure cookie, and the two host | |
| 1663 // path cookies. http_only, secure, and paths are ignored by | |
| 1664 // this call, and domain cookies arent touched. | |
| 1665 PopulateCmForDeleteAllForHost(cm.get()); | |
| 1666 EXPECT_EQ("dom_1=X; dom_2=X; dom_3=X; host_3=X", | |
| 1667 GetCookies(cm.get(), GURL(kTopLevelDomainPlus3))); | 1777 GetCookies(cm.get(), GURL(kTopLevelDomainPlus3))); |
| 1668 EXPECT_EQ("dom_1=X; dom_2=X; host_2=X; sec_dom=X; sec_host=X", | 1778 EXPECT_EQ("dom_2=B; host_2=B; sec_host=B", |
| 1669 GetCookies(cm.get(), GURL(kTopLevelDomainPlus2Secure))); | 1779 GetCookies(cm.get(), GURL(kTopLevelDomainPlus2Secure))); |
| 1670 EXPECT_EQ("dom_1=X; host_1=X", | 1780 EXPECT_EQ("", GetCookies(cm.get(), GURL(kTopLevelDomainPlus1))); |
| 1671 GetCookies(cm.get(), GURL(kTopLevelDomainPlus1))); | 1781 EXPECT_EQ("dom_path_2=B; host_path_2=B; dom_2=B; host_2=B; sec_host=B", |
| 1672 EXPECT_EQ( | |
| 1673 "dom_path_2=X; host_path_2=X; dom_path_1=X; host_path_1=X; " | |
| 1674 "dom_1=X; dom_2=X; host_2=X; sec_dom=X; sec_host=X", | |
| 1675 GetCookies(cm.get(), GURL(kTopLevelDomainPlus2Secure + | |
| 1676 std::string("/dir1/dir2/xxx")))); | |
| 1677 | |
| 1678 EXPECT_EQ(6, DeleteAllCreatedBetweenForHost(cm.get(), base::Time(), | |
| 1679 base::Time::Now(), | |
| 1680 GURL(kTopLevelDomainPlus2))); | |
| 1681 EXPECT_EQ(8U, GetAllCookies(cm.get()).size()); | |
| 1682 | |
| 1683 EXPECT_EQ("dom_1=X; dom_2=X; dom_3=X; host_3=X", | |
| 1684 GetCookies(cm.get(), GURL(kTopLevelDomainPlus3))); | |
| 1685 EXPECT_EQ("dom_1=X; dom_2=X; sec_dom=X", | |
| 1686 GetCookies(cm.get(), GURL(kTopLevelDomainPlus2Secure))); | |
| 1687 EXPECT_EQ("dom_1=X; host_1=X", | |
| 1688 GetCookies(cm.get(), GURL(kTopLevelDomainPlus1))); | |
| 1689 EXPECT_EQ("dom_path_2=X; dom_path_1=X; dom_1=X; dom_2=X; sec_dom=X", | |
| 1690 GetCookies(cm.get(), GURL(kTopLevelDomainPlus2Secure + | |
| 1691 std::string("/dir1/dir2/xxx")))); | |
| 1692 | |
| 1693 PopulateCmForDeleteAllForHost(cm.get()); | |
| 1694 EXPECT_EQ(6, DeleteAllCreatedBetweenForHost( | |
| 1695 cm.get(), base::Time(), base::Time::Now(), | |
| 1696 GURL(kTopLevelDomainPlus2Secure))); | |
| 1697 EXPECT_EQ(8U, GetAllCookies(cm.get()).size()); | |
| 1698 | |
| 1699 EXPECT_EQ("dom_1=X; dom_2=X; dom_3=X; host_3=X", | |
| 1700 GetCookies(cm.get(), GURL(kTopLevelDomainPlus3))); | |
| 1701 EXPECT_EQ("dom_1=X; dom_2=X; sec_dom=X", | |
| 1702 GetCookies(cm.get(), GURL(kTopLevelDomainPlus2Secure))); | |
| 1703 EXPECT_EQ("dom_1=X; host_1=X", | |
| 1704 GetCookies(cm.get(), GURL(kTopLevelDomainPlus1))); | |
| 1705 EXPECT_EQ("dom_path_2=X; dom_path_1=X; dom_1=X; dom_2=X; sec_dom=X", | |
| 1706 GetCookies(cm.get(), GURL(kTopLevelDomainPlus2Secure + | |
| 1707 std::string("/dir1/dir2/xxx")))); | |
| 1708 | |
| 1709 PopulateCmForDeleteAllForHost(cm.get()); | |
| 1710 EXPECT_EQ(6, | |
| 1711 DeleteAllCreatedBetweenForHost( | |
| 1712 cm.get(), base::Time(), base::Time::Now(), | |
| 1713 GURL(kTopLevelDomainPlus2Secure + std::string("/dir1/xxx")))); | |
| 1714 EXPECT_EQ(8U, GetAllCookies(cm.get()).size()); | |
| 1715 | |
| 1716 EXPECT_EQ("dom_1=X; dom_2=X; dom_3=X; host_3=X", | |
| 1717 GetCookies(cm.get(), GURL(kTopLevelDomainPlus3))); | |
| 1718 EXPECT_EQ("dom_1=X; dom_2=X; sec_dom=X", | |
| 1719 GetCookies(cm.get(), GURL(kTopLevelDomainPlus2Secure))); | |
| 1720 EXPECT_EQ("dom_1=X; host_1=X", | |
| 1721 GetCookies(cm.get(), GURL(kTopLevelDomainPlus1))); | |
| 1722 EXPECT_EQ("dom_path_2=X; dom_path_1=X; dom_1=X; dom_2=X; sec_dom=X", | |
| 1723 GetCookies(cm.get(), GURL(kTopLevelDomainPlus2Secure + | 1782 GetCookies(cm.get(), GURL(kTopLevelDomainPlus2Secure + |
| 1724 std::string("/dir1/dir2/xxx")))); | 1783 std::string("/dir1/dir2/xxx")))); |
| 1725 } | 1784 } |
| 1726 | 1785 |
| 1727 TEST_F(CookieMonsterTest, UniqueCreationTime) { | 1786 TEST_F(CookieMonsterTest, UniqueCreationTime) { |
| 1728 scoped_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr)); | 1787 scoped_ptr<CookieMonster> cm(new CookieMonster(nullptr, nullptr)); |
| 1729 CookieOptions options; | 1788 CookieOptions options; |
| 1730 | 1789 |
| 1731 // Add in three cookies through every public interface to the | 1790 // Add in three cookies through every public interface to the |
| 1732 // CookieMonster and confirm that none of them have duplicate | 1791 // CookieMonster and confirm that none of them have duplicate |
| (...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3196 monster()->AddCallbackForCookie( | 3255 monster()->AddCallbackForCookie( |
| 3197 test_url_, "abc", | 3256 test_url_, "abc", |
| 3198 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); | 3257 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); |
| 3199 SetCookie(monster(), test_url_, "abc=def"); | 3258 SetCookie(monster(), test_url_, "abc=def"); |
| 3200 base::MessageLoop::current()->RunUntilIdle(); | 3259 base::MessageLoop::current()->RunUntilIdle(); |
| 3201 EXPECT_EQ(1U, cookies0.size()); | 3260 EXPECT_EQ(1U, cookies0.size()); |
| 3202 EXPECT_EQ(1U, cookies0.size()); | 3261 EXPECT_EQ(1U, cookies0.size()); |
| 3203 } | 3262 } |
| 3204 | 3263 |
| 3205 } // namespace net | 3264 } // namespace net |
| OLD | NEW |