OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sync/internal_api/public/test/test_entry_factory.h" | 5 #include "sync/internal_api/public/test/test_entry_factory.h" |
6 | 6 |
7 #include "sync/syncable/directory.h" | 7 #include "sync/syncable/directory.h" |
8 #include "sync/syncable/entry.h" | 8 #include "sync/syncable/entry.h" |
9 #include "sync/syncable/mutable_entry.h" | 9 #include "sync/syncable/mutable_entry.h" |
10 #include "sync/syncable/syncable_id.h" | 10 #include "sync/syncable/syncable_id.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 const string& item_id, | 69 const string& item_id, |
70 const sync_pb::EntitySpecifics& specifics, | 70 const sync_pb::EntitySpecifics& specifics, |
71 bool is_unique) { | 71 bool is_unique) { |
72 WriteTransaction trans(FROM_HERE, UNITTEST, directory_); | 72 WriteTransaction trans(FROM_HERE, UNITTEST, directory_); |
73 MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, | 73 MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, |
74 Id::CreateFromServerId(item_id)); | 74 Id::CreateFromServerId(item_id)); |
75 DCHECK(entry.good()); | 75 DCHECK(entry.good()); |
76 entry.PutServerVersion(GetNextRevision()); | 76 entry.PutServerVersion(GetNextRevision()); |
77 entry.PutIsUnappliedUpdate(true); | 77 entry.PutIsUnappliedUpdate(true); |
78 entry.PutServerNonUniqueName(item_id); | 78 entry.PutServerNonUniqueName(item_id); |
79 entry.PutServerParentId(syncable::GetNullId()); | 79 entry.PutServerParentId(syncable::Id::GetRoot()); |
80 entry.PutServerIsDir(is_unique); | 80 entry.PutServerIsDir(is_unique); |
81 entry.PutServerSpecifics(specifics); | 81 entry.PutServerSpecifics(specifics); |
82 if (is_unique) { // For top-level nodes. | 82 if (is_unique) { // For top-level nodes. |
83 entry.PutUniqueServerTag( | 83 entry.PutUniqueServerTag( |
84 ModelTypeToRootTag(GetModelTypeFromSpecifics(specifics))); | 84 ModelTypeToRootTag(GetModelTypeFromSpecifics(specifics))); |
85 } | 85 } |
86 return entry.GetMetahandle(); | 86 return entry.GetMetahandle(); |
87 } | 87 } |
88 | 88 |
89 void TestEntryFactory::CreateUnsyncedItem( | 89 void TestEntryFactory::CreateUnsyncedItem( |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 return false; | 300 return false; |
301 } | 301 } |
302 return entry.GetIsUnappliedUpdate(); | 302 return entry.GetIsUnappliedUpdate(); |
303 } | 303 } |
304 | 304 |
305 int64 TestEntryFactory::GetNextRevision() { | 305 int64 TestEntryFactory::GetNextRevision() { |
306 return next_revision_++; | 306 return next_revision_++; |
307 } | 307 } |
308 | 308 |
309 } // namespace syncer | 309 } // namespace syncer |
OLD | NEW |