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

Unified Diff: chrome/browser/sync/invalidations/invalidator_storage_unittest.cc

Issue 10824140: Add InvalidationStateTracker::Forget() to erase an entry from storage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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
Index: chrome/browser/sync/invalidations/invalidator_storage_unittest.cc
diff --git a/chrome/browser/sync/invalidations/invalidator_storage_unittest.cc b/chrome/browser/sync/invalidations/invalidator_storage_unittest.cc
index 0c8202f724e7aaad934af3ab990ac09148a623eb..a2f0cb8d2d438ef3a0693c5e786a6fdf93875fbf 100644
--- a/chrome/browser/sync/invalidations/invalidator_storage_unittest.cc
+++ b/chrome/browser/sync/invalidations/invalidator_storage_unittest.cc
@@ -72,6 +72,23 @@ TEST_F(InvalidatorStorageTest, MaxInvalidationVersions) {
EXPECT_EQ(expected_max_versions, storage.GetAllMaxVersions());
}
+// Forgetting an entry should cause that entry to be deleted.
+TEST_F(InvalidatorStorageTest, Forget) {
+ InvalidatorStorage storage(&pref_service_);
+ EXPECT_TRUE(storage.GetAllMaxVersions().empty());
+
+ InvalidationVersionMap expected_max_versions;
+ expected_max_versions[kBookmarksId_] = 2;
+ expected_max_versions[kPreferencesId_] = 5;
+ storage.SetMaxVersion(kBookmarksId_, 2);
+ storage.SetMaxVersion(kPreferencesId_, 5);
+ EXPECT_EQ(expected_max_versions, storage.GetAllMaxVersions());
+
+ expected_max_versions.erase(kPreferencesId_);
+ storage.Forget(kPreferencesId_);
+ EXPECT_EQ(expected_max_versions, storage.GetAllMaxVersions());
+}
+
// Clearing the storage should result in an empty version map.
TEST_F(InvalidatorStorageTest, Clear) {
InvalidatorStorage storage(&pref_service_);

Powered by Google App Engine
This is Rietveld 408576698