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 #include "net/base/cookie_monster_store_test.h" | 5 #include "net/base/cookie_monster_store_test.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 void MockPersistentCookieStore::Flush(Task* completion_task) { | 78 void MockPersistentCookieStore::Flush(Task* completion_task) { |
79 if (completion_task) | 79 if (completion_task) |
80 MessageLoop::current()->PostTask(FROM_HERE, completion_task); | 80 MessageLoop::current()->PostTask(FROM_HERE, completion_task); |
81 } | 81 } |
82 | 82 |
83 // No files are created so nothing to clear either | 83 // No files are created so nothing to clear either |
84 void | 84 void |
85 MockPersistentCookieStore::SetClearLocalStateOnExit(bool clear_local_state) { | 85 MockPersistentCookieStore::SetClearLocalStateOnExit(bool clear_local_state) { |
86 } | 86 } |
87 | 87 |
| 88 void MockPersistentCookieStore::DeleteSessionCookies() { |
| 89 } |
| 90 |
88 MockCookieMonsterDelegate::MockCookieMonsterDelegate() {} | 91 MockCookieMonsterDelegate::MockCookieMonsterDelegate() {} |
89 | 92 |
90 void MockCookieMonsterDelegate::OnCookieChanged( | 93 void MockCookieMonsterDelegate::OnCookieChanged( |
91 const CookieMonster::CanonicalCookie& cookie, | 94 const CookieMonster::CanonicalCookie& cookie, |
92 bool removed, | 95 bool removed, |
93 CookieMonster::Delegate::ChangeCause cause) { | 96 CookieMonster::Delegate::ChangeCause cause) { |
94 CookieNotification notification(cookie, removed); | 97 CookieNotification notification(cookie, removed); |
95 changes_.push_back(notification); | 98 changes_.push_back(notification); |
96 } | 99 } |
97 | 100 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 194 |
192 void MockSimplePersistentCookieStore::Flush(Task* completion_task) { | 195 void MockSimplePersistentCookieStore::Flush(Task* completion_task) { |
193 if (completion_task) | 196 if (completion_task) |
194 MessageLoop::current()->PostTask(FROM_HERE, completion_task); | 197 MessageLoop::current()->PostTask(FROM_HERE, completion_task); |
195 } | 198 } |
196 | 199 |
197 void MockSimplePersistentCookieStore::SetClearLocalStateOnExit( | 200 void MockSimplePersistentCookieStore::SetClearLocalStateOnExit( |
198 bool clear_local_state) { | 201 bool clear_local_state) { |
199 } | 202 } |
200 | 203 |
| 204 void MockSimplePersistentCookieStore::DeleteSessionCookies() { |
| 205 } |
| 206 |
201 CookieMonster* CreateMonsterFromStoreForGC( | 207 CookieMonster* CreateMonsterFromStoreForGC( |
202 int num_cookies, | 208 int num_cookies, |
203 int num_old_cookies, | 209 int num_old_cookies, |
204 int days_old) { | 210 int days_old) { |
205 base::Time current(base::Time::Now()); | 211 base::Time current(base::Time::Now()); |
206 base::Time past_creation(base::Time::Now() - base::TimeDelta::FromDays(1000)); | 212 base::Time past_creation(base::Time::Now() - base::TimeDelta::FromDays(1000)); |
207 scoped_refptr<MockSimplePersistentCookieStore> store( | 213 scoped_refptr<MockSimplePersistentCookieStore> store( |
208 new MockSimplePersistentCookieStore); | 214 new MockSimplePersistentCookieStore); |
209 // Must expire to be persistent | 215 // Must expire to be persistent |
210 for (int i = 0; i < num_cookies; i++) { | 216 for (int i = 0; i < num_cookies; i++) { |
(...skipping 11 matching lines...) Expand all Loading... |
222 GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), "/path", | 228 GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), "/path", |
223 mac_key, mac_algorithm, creation_time, expiration_time, | 229 mac_key, mac_algorithm, creation_time, expiration_time, |
224 last_access_time, false, false, true, true); | 230 last_access_time, false, false, true, true); |
225 store->AddCookie(cc); | 231 store->AddCookie(cc); |
226 } | 232 } |
227 | 233 |
228 return new CookieMonster(store, NULL); | 234 return new CookieMonster(store, NULL); |
229 } | 235 } |
230 | 236 |
231 } // namespace net | 237 } // namespace net |
OLD | NEW |