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

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

Issue 2630613002: [Sync] USS: Filter out tombstones for initial sync. (Closed)
Patch Set: 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/test_entry_factory.cc
diff --git a/components/sync/engine_impl/test_entry_factory.cc b/components/sync/engine_impl/test_entry_factory.cc
index 0960d869f2ff2105e19fcaa2c9dfb49e60918846..db0f269dae9d85afdd75248e563b6e41b4204b6f 100644
--- a/components/sync/engine_impl/test_entry_factory.cc
+++ b/components/sync/engine_impl/test_entry_factory.cc
@@ -200,6 +200,46 @@ int64_t TestEntryFactory::CreateSyncedItem(
return entry.GetMetahandle();
}
+int64_t TestEntryFactory::CreateTombstone(const std::string& name,
skym 2017/01/13 16:31:23 It seems like there's a lot of duplicated logic be
maxbogue 2017/01/17 22:02:26 Done.
+ ModelType model_type) {
+ WriteTransaction trans(FROM_HERE, UNITTEST, directory_);
+
+ // Use the type root if it exists or the real root otherwise.
+ syncable::Entry root(&trans, syncable::GET_TYPE_ROOT, model_type);
+ syncable::Id parent_id = root.good() ? root.GetId() : TestIdFactory::root();
+ syncable::Id item_id(TestIdFactory::MakeServer(name));
+ int64_t version = GetNextRevision();
+ base::Time now = base::Time::Now();
+
+ MutableEntry entry(&trans, syncable::CREATE, model_type, parent_id, name);
+ if (!entry.good()) {
+ NOTREACHED();
+ return syncable::kInvalidMetaHandle;
+ }
+
+ entry.PutId(item_id);
+ entry.PutCtime(now);
+ entry.PutMtime(now);
+ entry.PutUniqueClientTag(GenerateSyncableHash(model_type, name));
+ entry.PutBaseVersion(version);
+ entry.PutIsUnsynced(false);
+ entry.PutNonUniqueName(name);
+ entry.PutIsDir(false);
+ entry.PutIsDel(true);
+ entry.PutParentId(parent_id);
+
+ entry.PutServerCtime(now);
+ entry.PutServerMtime(now);
+ entry.PutServerVersion(version);
+ entry.PutIsUnappliedUpdate(false);
+ entry.PutServerNonUniqueName(name);
+ entry.PutServerParentId(parent_id);
+ entry.PutServerIsDir(false);
+ entry.PutServerIsDel(true);
+
+ return entry.GetMetahandle();
+}
+
int64_t TestEntryFactory::CreateTypeRootNode(ModelType model_type) {
syncable::ModelNeutralWriteTransaction trans(FROM_HERE, syncable::UNITTEST,
directory_);

Powered by Google App Engine
This is Rietveld 408576698