OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file contains test infrastructure for multiple files | 5 // This file contains test infrastructure for multiple files |
6 // (current cookie_monster_unittest.cc and cookie_monster_perftest.cc) | 6 // (current cookie_monster_unittest.cc and cookie_monster_perftest.cc) |
7 // that need to test out CookieMonster interactions with the backing store. | 7 // that need to test out CookieMonster interactions with the backing store. |
8 // It should only be included by test code. | 8 // It should only be included by test code. |
9 | 9 |
10 #ifndef NET_BASE_COOKIE_MONSTER_STORE_TEST_H_ | 10 #ifndef NET_BASE_COOKIE_MONSTER_STORE_TEST_H_ |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 CookieMonster::Delegate::ChangeCause cause); | 102 CookieMonster::Delegate::ChangeCause cause); |
103 | 103 |
104 private: | 104 private: |
105 virtual ~MockCookieMonsterDelegate(); | 105 virtual ~MockCookieMonsterDelegate(); |
106 | 106 |
107 std::vector<CookieNotification> changes_; | 107 std::vector<CookieNotification> changes_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(MockCookieMonsterDelegate); | 109 DISALLOW_COPY_AND_ASSIGN(MockCookieMonsterDelegate); |
110 }; | 110 }; |
111 | 111 |
| 112 // Helper to build a single CanonicalCookie. |
| 113 CookieMonster::CanonicalCookie BuildCanonicalCookie( |
| 114 const std::string& key, |
| 115 const std::string& cookie_line, |
| 116 const base::Time& creation_time); |
| 117 |
112 // Helper to build a list of CanonicalCookie*s. | 118 // Helper to build a list of CanonicalCookie*s. |
113 void AddCookieToList( | 119 void AddCookieToList( |
114 const std::string& key, | 120 const std::string& key, |
115 const std::string& cookie_line, | 121 const std::string& cookie_line, |
116 const base::Time& creation_time, | 122 const base::Time& creation_time, |
117 std::vector<CookieMonster::CanonicalCookie*>* out_list); | 123 std::vector<CookieMonster::CanonicalCookie*>* out_list); |
118 | 124 |
119 // Just act like a backing database. Keep cookie information from | 125 // Just act like a backing database. Keep cookie information from |
120 // Add/Update/Delete and regurgitate it when Load is called. | 126 // Add/Update/Delete and regurgitate it when Load is called. |
121 class MockSimplePersistentCookieStore | 127 class MockSimplePersistentCookieStore |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // longer than |gc_perf_micros| to complete, and how many cookie were | 161 // longer than |gc_perf_micros| to complete, and how many cookie were |
156 // left in the store afterwards. | 162 // left in the store afterwards. |
157 CookieMonster* CreateMonsterFromStoreForGC( | 163 CookieMonster* CreateMonsterFromStoreForGC( |
158 int num_cookies, | 164 int num_cookies, |
159 int num_old_cookies, | 165 int num_old_cookies, |
160 int days_old); | 166 int days_old); |
161 | 167 |
162 } // namespace net | 168 } // namespace net |
163 | 169 |
164 #endif // NET_BASE_COOKIE_MONSTER_STORE_TEST_H_ | 170 #endif // NET_BASE_COOKIE_MONSTER_STORE_TEST_H_ |
OLD | NEW |