Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: net/base/cookie_monster_store_test.cc

Issue 8533013: SessionRestore: Store session cookies and restore them if chrome crashes or auto-restarts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
89 MockPersistentCookieStore::SetClearSessionStateOnExit(
90 bool clear_session_state) {
91 }
92
88 MockCookieMonsterDelegate::MockCookieMonsterDelegate() {} 93 MockCookieMonsterDelegate::MockCookieMonsterDelegate() {}
89 94
90 void MockCookieMonsterDelegate::OnCookieChanged( 95 void MockCookieMonsterDelegate::OnCookieChanged(
91 const CookieMonster::CanonicalCookie& cookie, 96 const CookieMonster::CanonicalCookie& cookie,
92 bool removed, 97 bool removed,
93 CookieMonster::Delegate::ChangeCause cause) { 98 CookieMonster::Delegate::ChangeCause cause) {
94 CookieNotification notification(cookie, removed); 99 CookieNotification notification(cookie, removed);
95 changes_.push_back(notification); 100 changes_.push_back(notification);
96 } 101 }
97 102
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 196
192 void MockSimplePersistentCookieStore::Flush(Task* completion_task) { 197 void MockSimplePersistentCookieStore::Flush(Task* completion_task) {
193 if (completion_task) 198 if (completion_task)
194 MessageLoop::current()->PostTask(FROM_HERE, completion_task); 199 MessageLoop::current()->PostTask(FROM_HERE, completion_task);
195 } 200 }
196 201
197 void MockSimplePersistentCookieStore::SetClearLocalStateOnExit( 202 void MockSimplePersistentCookieStore::SetClearLocalStateOnExit(
198 bool clear_local_state) { 203 bool clear_local_state) {
199 } 204 }
200 205
206 void MockSimplePersistentCookieStore::SetClearSessionStateOnExit(
207 bool clear_session_state) {
208 }
209
201 CookieMonster* CreateMonsterFromStoreForGC( 210 CookieMonster* CreateMonsterFromStoreForGC(
202 int num_cookies, 211 int num_cookies,
203 int num_old_cookies, 212 int num_old_cookies,
204 int days_old) { 213 int days_old) {
205 base::Time current(base::Time::Now()); 214 base::Time current(base::Time::Now());
206 base::Time past_creation(base::Time::Now() - base::TimeDelta::FromDays(1000)); 215 base::Time past_creation(base::Time::Now() - base::TimeDelta::FromDays(1000));
207 scoped_refptr<MockSimplePersistentCookieStore> store( 216 scoped_refptr<MockSimplePersistentCookieStore> store(
208 new MockSimplePersistentCookieStore); 217 new MockSimplePersistentCookieStore);
209 // Must expire to be persistent 218 // Must expire to be persistent
210 for (int i = 0; i < num_cookies; i++) { 219 for (int i = 0; i < num_cookies; i++) {
(...skipping 11 matching lines...) Expand all
222 GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), "/path", 231 GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), "/path",
223 mac_key, mac_algorithm, creation_time, expiration_time, 232 mac_key, mac_algorithm, creation_time, expiration_time,
224 last_access_time, false, false, true, true); 233 last_access_time, false, false, true, true);
225 store->AddCookie(cc); 234 store->AddCookie(cc);
226 } 235 }
227 236
228 return new CookieMonster(store, NULL); 237 return new CookieMonster(store, NULL);
229 } 238 }
230 239
231 } // namespace net 240 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698