| 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_store_test.h" | 5 #include "net/cookies/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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 const CookieMonster::CanonicalCookie& cookie) { | 71 const CookieMonster::CanonicalCookie& cookie) { |
| 72 commands_.push_back( | 72 commands_.push_back( |
| 73 CookieStoreCommand(CookieStoreCommand::REMOVE, cookie)); | 73 CookieStoreCommand(CookieStoreCommand::REMOVE, cookie)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void MockPersistentCookieStore::Flush(const base::Closure& callback) { | 76 void MockPersistentCookieStore::Flush(const base::Closure& callback) { |
| 77 if (!callback.is_null()) | 77 if (!callback.is_null()) |
| 78 MessageLoop::current()->PostTask(FROM_HERE, callback); | 78 MessageLoop::current()->PostTask(FROM_HERE, callback); |
| 79 } | 79 } |
| 80 | 80 |
| 81 // No files are created so nothing to clear either | 81 void MockPersistentCookieStore::SetKeepSessionCookies() { |
| 82 void | |
| 83 MockPersistentCookieStore::SetClearLocalStateOnExit(bool clear_local_state) { | |
| 84 } | 82 } |
| 85 | 83 |
| 86 MockPersistentCookieStore::~MockPersistentCookieStore() {} | 84 MockPersistentCookieStore::~MockPersistentCookieStore() {} |
| 87 | 85 |
| 88 MockCookieMonsterDelegate::MockCookieMonsterDelegate() {} | 86 MockCookieMonsterDelegate::MockCookieMonsterDelegate() {} |
| 89 | 87 |
| 90 void MockCookieMonsterDelegate::OnCookieChanged( | 88 void MockCookieMonsterDelegate::OnCookieChanged( |
| 91 const CookieMonster::CanonicalCookie& cookie, | 89 const CookieMonster::CanonicalCookie& cookie, |
| 92 bool removed, | 90 bool removed, |
| 93 CookieMonster::Delegate::ChangeCause cause) { | 91 CookieMonster::Delegate::ChangeCause cause) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 CanonicalCookieMap::iterator it = cookies_.find(creation_time); | 184 CanonicalCookieMap::iterator it = cookies_.find(creation_time); |
| 187 ASSERT_TRUE(it != cookies_.end()); | 185 ASSERT_TRUE(it != cookies_.end()); |
| 188 cookies_.erase(it); | 186 cookies_.erase(it); |
| 189 } | 187 } |
| 190 | 188 |
| 191 void MockSimplePersistentCookieStore::Flush(const base::Closure& callback) { | 189 void MockSimplePersistentCookieStore::Flush(const base::Closure& callback) { |
| 192 if (!callback.is_null()) | 190 if (!callback.is_null()) |
| 193 MessageLoop::current()->PostTask(FROM_HERE, callback); | 191 MessageLoop::current()->PostTask(FROM_HERE, callback); |
| 194 } | 192 } |
| 195 | 193 |
| 196 void MockSimplePersistentCookieStore::SetClearLocalStateOnExit( | 194 void MockSimplePersistentCookieStore::SetKeepSessionCookies() { |
| 197 bool clear_local_state) { | |
| 198 } | 195 } |
| 199 | 196 |
| 200 CookieMonster* CreateMonsterFromStoreForGC( | 197 CookieMonster* CreateMonsterFromStoreForGC( |
| 201 int num_cookies, | 198 int num_cookies, |
| 202 int num_old_cookies, | 199 int num_old_cookies, |
| 203 int days_old) { | 200 int days_old) { |
| 204 base::Time current(base::Time::Now()); | 201 base::Time current(base::Time::Now()); |
| 205 base::Time past_creation(base::Time::Now() - base::TimeDelta::FromDays(1000)); | 202 base::Time past_creation(base::Time::Now() - base::TimeDelta::FromDays(1000)); |
| 206 scoped_refptr<MockSimplePersistentCookieStore> store( | 203 scoped_refptr<MockSimplePersistentCookieStore> store( |
| 207 new MockSimplePersistentCookieStore); | 204 new MockSimplePersistentCookieStore); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 223 last_access_time, false, false, true, true); | 220 last_access_time, false, false, true, true); |
| 224 store->AddCookie(cc); | 221 store->AddCookie(cc); |
| 225 } | 222 } |
| 226 | 223 |
| 227 return new CookieMonster(store, NULL); | 224 return new CookieMonster(store, NULL); |
| 228 } | 225 } |
| 229 | 226 |
| 230 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() {} | 227 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() {} |
| 231 | 228 |
| 232 } // namespace net | 229 } // namespace net |
| OLD | NEW |