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

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

Issue 1701063002: CookieStore: Remove reference counting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@threadsafe
Patch Set: merge Created 4 years, 9 months 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
« no previous file with comments | « net/cookies/cookie_monster_store_test.h ('k') | net/cookies/cookie_monster_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 187 }
188 188
189 void MockSimplePersistentCookieStore::Flush(const base::Closure& callback) { 189 void MockSimplePersistentCookieStore::Flush(const base::Closure& callback) {
190 if (!callback.is_null()) 190 if (!callback.is_null())
191 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); 191 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback);
192 } 192 }
193 193
194 void MockSimplePersistentCookieStore::SetForceKeepSessionState() { 194 void MockSimplePersistentCookieStore::SetForceKeepSessionState() {
195 } 195 }
196 196
197 CookieMonster* CreateMonsterFromStoreForGC(int num_secure_cookies, 197 scoped_ptr<CookieMonster> CreateMonsterFromStoreForGC(
198 int num_old_secure_cookies, 198 int num_secure_cookies,
199 int num_non_secure_cookies, 199 int num_old_secure_cookies,
200 int num_old_non_secure_cookies, 200 int num_non_secure_cookies,
201 int days_old) { 201 int num_old_non_secure_cookies,
202 int days_old) {
202 base::Time current(base::Time::Now()); 203 base::Time current(base::Time::Now());
203 base::Time past_creation(base::Time::Now() - base::TimeDelta::FromDays(1000)); 204 base::Time past_creation(base::Time::Now() - base::TimeDelta::FromDays(1000));
204 scoped_refptr<MockSimplePersistentCookieStore> store( 205 scoped_refptr<MockSimplePersistentCookieStore> store(
205 new MockSimplePersistentCookieStore); 206 new MockSimplePersistentCookieStore);
206 int total_cookies = num_secure_cookies + num_non_secure_cookies; 207 int total_cookies = num_secure_cookies + num_non_secure_cookies;
207 int base = 0; 208 int base = 0;
208 // Must expire to be persistent 209 // Must expire to be persistent
209 for (int i = 0; i < total_cookies; i++) { 210 for (int i = 0; i < total_cookies; i++) {
210 int num_old_cookies; 211 int num_old_cookies;
211 bool secure; 212 bool secure;
(...skipping 13 matching lines...) Expand all
225 ? current - base::TimeDelta::FromDays(days_old) 226 ? current - base::TimeDelta::FromDays(days_old)
226 : current; 227 : current;
227 228
228 CanonicalCookie cc(GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i), 229 CanonicalCookie cc(GURL(), "a", "1", base::StringPrintf("h%05d.izzle", i),
229 "/path", creation_time, expiration_time, 230 "/path", creation_time, expiration_time,
230 last_access_time, secure, false, false, 231 last_access_time, secure, false, false,
231 COOKIE_PRIORITY_DEFAULT); 232 COOKIE_PRIORITY_DEFAULT);
232 store->AddCookie(cc); 233 store->AddCookie(cc);
233 } 234 }
234 235
235 return new CookieMonster(store.get(), NULL); 236 return make_scoped_ptr(new CookieMonster(store.get(), nullptr));
236 } 237 }
237 238
238 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() { 239 MockSimplePersistentCookieStore::~MockSimplePersistentCookieStore() {
239 } 240 }
240 241
241 } // namespace net 242 } // namespace net
OLDNEW
« no previous file with comments | « net/cookies/cookie_monster_store_test.h ('k') | net/cookies/cookie_monster_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698