| 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_monster.h" | 5 #include "net/cookies/cookie_monster.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 CookieMonster* CreateMonsterForGC(int num_cookies) { | 780 CookieMonster* CreateMonsterForGC(int num_cookies) { |
| 781 CookieMonster* cm(new CookieMonster(NULL, NULL)); | 781 CookieMonster* cm(new CookieMonster(NULL, NULL)); |
| 782 for (int i = 0; i < num_cookies; i++) { | 782 for (int i = 0; i < num_cookies; i++) { |
| 783 SetCookie(cm, GURL(base::StringPrintf("http://h%05d.izzle", i)), "a=1"); | 783 SetCookie(cm, GURL(base::StringPrintf("http://h%05d.izzle", i)), "a=1"); |
| 784 } | 784 } |
| 785 return cm; | 785 return cm; |
| 786 } | 786 } |
| 787 | 787 |
| 788 bool IsCookieInList(const CanonicalCookie& cookie, const CookieList& list) { | 788 bool IsCookieInList(const CanonicalCookie& cookie, const CookieList& list) { |
| 789 for (CookieList::const_iterator it = list.begin(); it != list.end(); ++it) { | 789 for (CookieList::const_iterator it = list.begin(); it != list.end(); ++it) { |
| 790 if (it->Source() == cookie.Source() && it->Name() == cookie.Name() && | 790 if (it->Name() == cookie.Name() && it->Value() == cookie.Value() && |
| 791 it->Value() == cookie.Value() && it->Domain() == cookie.Domain() && | 791 it->Domain() == cookie.Domain() && it->Path() == cookie.Path() && |
| 792 it->Path() == cookie.Path() && | |
| 793 it->CreationDate() == cookie.CreationDate() && | 792 it->CreationDate() == cookie.CreationDate() && |
| 794 it->ExpiryDate() == cookie.ExpiryDate() && | 793 it->ExpiryDate() == cookie.ExpiryDate() && |
| 795 it->LastAccessDate() == cookie.LastAccessDate() && | 794 it->LastAccessDate() == cookie.LastAccessDate() && |
| 796 it->IsSecure() == cookie.IsSecure() && | 795 it->IsSecure() == cookie.IsSecure() && |
| 797 it->IsHttpOnly() == cookie.IsHttpOnly() && | 796 it->IsHttpOnly() == cookie.IsHttpOnly() && |
| 798 it->Priority() == cookie.Priority()) { | 797 it->Priority() == cookie.Priority()) { |
| 799 return true; | 798 return true; |
| 800 } | 799 } |
| 801 } | 800 } |
| 802 | 801 |
| (...skipping 2681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3484 monster()->AddCallbackForCookie( | 3483 monster()->AddCallbackForCookie( |
| 3485 test_url_, "abc", | 3484 test_url_, "abc", |
| 3486 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); | 3485 base::Bind(&RecordCookieChanges, &cookies1, nullptr))); |
| 3487 SetCookie(monster(), test_url_, "abc=def"); | 3486 SetCookie(monster(), test_url_, "abc=def"); |
| 3488 base::RunLoop().RunUntilIdle(); | 3487 base::RunLoop().RunUntilIdle(); |
| 3489 EXPECT_EQ(1U, cookies0.size()); | 3488 EXPECT_EQ(1U, cookies0.size()); |
| 3490 EXPECT_EQ(1U, cookies0.size()); | 3489 EXPECT_EQ(1U, cookies0.size()); |
| 3491 } | 3490 } |
| 3492 | 3491 |
| 3493 } // namespace net | 3492 } // namespace net |
| OLD | NEW |