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

Unified Diff: sync/syncable/directory_unittest.cc

Issue 1393633003: Sync: fix for the code that checks whether the initial download has completed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback Created 5 years, 2 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 | « sync/syncable/directory.cc ('k') | sync/test/engine/mock_connection_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/directory_unittest.cc
diff --git a/sync/syncable/directory_unittest.cc b/sync/syncable/directory_unittest.cc
index 198e534999be4345f87d6bf310722d476234845d..a9d805893b5d44e2eb9f0c0f85ceb90bd6a7db2d 100644
--- a/sync/syncable/directory_unittest.cc
+++ b/sync/syncable/directory_unittest.cc
@@ -2110,6 +2110,28 @@ TEST_F(SyncableDirectoryTest, SharingOfClientAndServerSpecifics) {
item.GetBaseServerSpecifics()));
}
+// Tests checking and marking a type as having its initial sync completed.
+TEST_F(SyncableDirectoryTest, InitialSyncEndedForType) {
+ // Not completed if there is no root node.
+ EXPECT_FALSE(dir()->InitialSyncEndedForType(PREFERENCES));
+
+ WriteTransaction trans(FROM_HERE, UNITTEST, dir().get());
+ // Create the root node.
+ ModelNeutralMutableEntry entry(&trans, syncable::CREATE_NEW_TYPE_ROOT,
+ PREFERENCES);
+ DCHECK(entry.good());
+
+ entry.PutServerIsDir(true);
+ entry.PutUniqueServerTag(ModelTypeToRootTag(PREFERENCES));
+
+ // Should still be marked as incomplete.
+ EXPECT_FALSE(dir()->InitialSyncEndedForType(&trans, PREFERENCES));
+
+ // Mark as complete and verify.
+ dir()->MarkInitialSyncEndedForType(&trans, PREFERENCES);
+ EXPECT_TRUE(dir()->InitialSyncEndedForType(&trans, PREFERENCES));
+}
+
} // namespace syncable
} // namespace syncer
« no previous file with comments | « sync/syncable/directory.cc ('k') | sync/test/engine/mock_connection_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698