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

Unified Diff: components/sync/engine_impl/model_type_worker_unittest.cc

Issue 2611123005: [Sync] ModelTypeWorker should delete tracker for entity deleted on the server (Closed)
Patch Set: Address comment Created 3 years, 11 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: components/sync/engine_impl/model_type_worker_unittest.cc
diff --git a/components/sync/engine_impl/model_type_worker_unittest.cc b/components/sync/engine_impl/model_type_worker_unittest.cc
index 8cd0f84b488f801116fef918c0f72bfc31914821..cc4fd1bd2ff812e13ede75e9229d9a52bf6ddd15 100644
--- a/components/sync/engine_impl/model_type_worker_unittest.cc
+++ b/components/sync/engine_impl/model_type_worker_unittest.cc
@@ -1145,4 +1145,36 @@ TEST_F(ModelTypeWorkerTest, DisconnectProcessorFromSyncTest) {
EXPECT_TRUE(IsProcessorDisconnected());
}
+// Test that deleted entity can be recreated again.
+TEST_F(ModelTypeWorkerTest, RecreateDeletedEntity) {
+ NormalInitialize();
+
+ // Create, then delete entity.
+ CommitRequest(kTag1, kValue1);
+ ASSERT_TRUE(WillCommit());
+ DoSuccessfulCommit();
+
+ DeleteRequest(kTag1);
+ ASSERT_TRUE(WillCommit());
+ DoSuccessfulCommit();
+
+ // Verify that entity got deleted from the server.
+ {
+ const sync_pb::SyncEntity& entity =
+ server()->GetLastCommittedEntity(kHash1);
+ EXPECT_TRUE(entity.deleted());
+ }
+
+ // Create the same entity again.
+ CommitRequest(kTag1, kValue1);
+ ASSERT_TRUE(WillCommit());
+ DoSuccessfulCommit();
+ // Verify that there is a valid entity on the server.
+ {
+ const sync_pb::SyncEntity& entity =
+ server()->GetLastCommittedEntity(kHash1);
+ EXPECT_FALSE(entity.deleted());
+ }
+}
+
} // namespace syncer
« no previous file with comments | « components/sync/engine_impl/model_type_worker.cc ('k') | components/sync/engine_impl/worker_entity_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698