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

Unified Diff: net/cookies/cookie_monster_unittest.cc

Issue 1083883002: Add a unittest that DeleteAll(CookieMonster*) does flush (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cookies/cookie_monster_unittest.cc
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc
index 60caa67ea6ad7533b3b7071a332b0af0dbc4874d..c76c03f7b13d5e2f1042472edcaf78292c3c9bba 100644
--- a/net/cookies/cookie_monster_unittest.cc
+++ b/net/cookies/cookie_monster_unittest.cc
@@ -2311,6 +2311,20 @@ TEST_F(CookieMonsterTest, ComputeCookieDiff) {
EXPECT_FALSE(IsCookieInList(cookie7_with_new_path, cookies_to_delete));
}
+// Check that DeleteAll does flush (as a sanity check that flush_count()
+// works).
+TEST_F(CookieMonsterTest, DeleteAll) {
+ scoped_refptr<FlushablePersistentStore> store(new FlushablePersistentStore());
+ scoped_refptr<CookieMonster> cm(new CookieMonster(store.get(), NULL));
+ cm->SetPersistSessionCookies(true);
+
+ EXPECT_TRUE(SetCookie(cm.get(), url_google_, "X=Y; path=/"));
+
+ ASSERT_EQ(0, store->flush_count());
+ EXPECT_EQ(1, DeleteAll(cm.get()));
+ EXPECT_EQ(1, store->flush_count());
+}
+
TEST_F(CookieMonsterTest, HistogramCheck) {
scoped_refptr<CookieMonster> cm(new CookieMonster(NULL, NULL));
// Should match call in InitializeHistograms, but doesn't really matter
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698