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 // 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_COOKIES_COOKIE_MONSTER_STORE_TEST_H_ | 10 #ifndef NET_COOKIES_COOKIE_MONSTER_STORE_TEST_H_ |
11 #define NET_COOKIES_COOKIE_MONSTER_STORE_TEST_H_ | 11 #define NET_COOKIES_COOKIE_MONSTER_STORE_TEST_H_ |
12 | 12 |
13 #include <stdint.h> | 13 #include <stdint.h> |
14 | 14 |
15 #include <map> | 15 #include <map> |
16 #include <string> | 16 #include <string> |
17 #include <utility> | 17 #include <utility> |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "base/macros.h" | 20 #include "base/macros.h" |
| 21 #include "base/memory/scoped_ptr.h" |
21 #include "net/cookies/canonical_cookie.h" | 22 #include "net/cookies/canonical_cookie.h" |
22 #include "net/cookies/cookie_monster.h" | 23 #include "net/cookies/cookie_monster.h" |
23 | 24 |
24 namespace base { | 25 namespace base { |
25 class Time; | 26 class Time; |
26 } | 27 } |
27 | 28 |
28 namespace net { | 29 namespace net { |
29 | 30 |
30 // Wrapper class for posting a loaded callback. Since the Callback class is not | 31 // Wrapper class for posting a loaded callback. Since the Callback class is not |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 182 |
182 // Helper function for creating a CookieMonster backed by a | 183 // Helper function for creating a CookieMonster backed by a |
183 // MockSimplePersistentCookieStore for garbage collection testing. | 184 // MockSimplePersistentCookieStore for garbage collection testing. |
184 // | 185 // |
185 // Fill the store through import with |num_*_cookies| cookies, | 186 // Fill the store through import with |num_*_cookies| cookies, |
186 // |num_old_*_cookies| with access time Now()-days_old, the rest with access | 187 // |num_old_*_cookies| with access time Now()-days_old, the rest with access |
187 // time Now(). Cookies made by |num_secure_cookies| and |num_non_secure_cookies| | 188 // time Now(). Cookies made by |num_secure_cookies| and |num_non_secure_cookies| |
188 // will be marked secure and non-secure, respectively. Do two SetCookies(). | 189 // will be marked secure and non-secure, respectively. Do two SetCookies(). |
189 // Return whether each of the two SetCookies() took longer than |gc_perf_micros| | 190 // Return whether each of the two SetCookies() took longer than |gc_perf_micros| |
190 // to complete, and how many cookie were left in the store afterwards. | 191 // to complete, and how many cookie were left in the store afterwards. |
191 CookieMonster* CreateMonsterFromStoreForGC(int num_secure_cookies, | 192 scoped_ptr<CookieMonster> CreateMonsterFromStoreForGC( |
192 int num_old_secure_cookies, | 193 int num_secure_cookies, |
193 int num_non_secure_cookies, | 194 int num_old_secure_cookies, |
194 int num_old_non_secure_cookies, | 195 int num_non_secure_cookies, |
195 int days_old); | 196 int num_old_non_secure_cookies, |
| 197 int days_old); |
196 | 198 |
197 } // namespace net | 199 } // namespace net |
198 | 200 |
199 #endif // NET_COOKIES_COOKIE_MONSTER_STORE_TEST_H_ | 201 #endif // NET_COOKIES_COOKIE_MONSTER_STORE_TEST_H_ |
OLD | NEW |