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

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

Issue 7831056: Fix a memory leak in a unit test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « net/base/cookie_monster_store_test.cc ('k') | no next file » | 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) 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 <time.h> 5 #include <time.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 DeleteAllForHostAction( 1287 DeleteAllForHostAction(
1288 &cookie_monster(), url_google_, &delete_callback)); 1288 &cookie_monster(), url_google_, &delete_callback));
1289 EXPECT_CALL(delete_callback, Invoke(false)).WillOnce( 1289 EXPECT_CALL(delete_callback, Invoke(false)).WillOnce(
1290 QuitCurrentMessageLoop()); 1290 QuitCurrentMessageLoop());
1291 1291
1292 CompleteLoadingAndWait(); 1292 CompleteLoadingAndWait();
1293 } 1293 }
1294 1294
1295 TEST_F(DeferredCookieTaskTest, DeferredDeleteCanonicalCookie) { 1295 TEST_F(DeferredCookieTaskTest, DeferredDeleteCanonicalCookie) {
1296 std::vector<CookieMonster::CanonicalCookie*> cookies; 1296 std::vector<CookieMonster::CanonicalCookie*> cookies;
1297 AddCookieToList("www.google.com", "X=1; path=/", base::Time::Now(), &cookies); 1297 CookieMonster::CanonicalCookie cookie = BuildCanonicalCookie(
1298 "www.google.com", "X=1; path=/", base::Time::Now());
1298 1299
1299 MockDeleteCookieCallback delete_cookie_callback; 1300 MockDeleteCookieCallback delete_cookie_callback;
1300 1301
1301 BeginWith(DeleteCanonicalCookieAction( 1302 BeginWith(DeleteCanonicalCookieAction(
1302 &cookie_monster(), *cookies[0], &delete_cookie_callback)); 1303 &cookie_monster(), cookie, &delete_cookie_callback));
1303 1304
1304 WaitForLoadCall(); 1305 WaitForLoadCall();
1305 1306
1306 EXPECT_CALL(delete_cookie_callback, Invoke(false)).WillOnce( 1307 EXPECT_CALL(delete_cookie_callback, Invoke(false)).WillOnce(
1307 DeleteCanonicalCookieAction( 1308 DeleteCanonicalCookieAction(
1308 &cookie_monster(), *cookies[0], &delete_cookie_callback)); 1309 &cookie_monster(), cookie, &delete_cookie_callback));
1309 EXPECT_CALL(delete_cookie_callback, Invoke(false)).WillOnce( 1310 EXPECT_CALL(delete_cookie_callback, Invoke(false)).WillOnce(
1310 QuitCurrentMessageLoop()); 1311 QuitCurrentMessageLoop());
1311 1312
1312 CompleteLoadingAndWait(); 1313 CompleteLoadingAndWait();
1313 } 1314 }
1314 1315
1315 // Verify that a series of queued tasks are executed in order upon loading of 1316 // Verify that a series of queued tasks are executed in order upon loading of
1316 // the backing store and that new tasks received while the queued tasks are 1317 // the backing store and that new tasks received while the queued tasks are
1317 // being dispatched go to the end of the queue. 1318 // being dispatched go to the end of the queue.
1318 TEST_F(DeferredCookieTaskTest, DeferredTaskOrder) { 1319 TEST_F(DeferredCookieTaskTest, DeferredTaskOrder) {
(...skipping 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3485 base::Closure task = base::Bind( 3486 base::Closure task = base::Bind(
3486 &net::MultiThreadedCookieMonsterTest::DeleteCanonicalCookieTask, 3487 &net::MultiThreadedCookieMonsterTest::DeleteCanonicalCookieTask,
3487 base::Unretained(this), 3488 base::Unretained(this),
3488 cm, *it, &callback); 3489 cm, *it, &callback);
3489 RunOnOtherThread(task); 3490 RunOnOtherThread(task);
3490 EXPECT_TRUE(callback.did_run()); 3491 EXPECT_TRUE(callback.did_run());
3491 EXPECT_TRUE(callback.result()); 3492 EXPECT_TRUE(callback.result());
3492 } 3493 }
3493 3494
3494 } // namespace net 3495 } // namespace net
OLDNEW
« no previous file with comments | « net/base/cookie_monster_store_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698