| 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 "components/sync/test/engine/test_syncable_utils.h" | 5 #include "components/sync/test/engine/test_syncable_utils.h" |
| 6 | 6 |
| 7 #include "components/sync/syncable/directory.h" | 7 #include "components/sync/syncable/directory.h" |
| 8 #include "components/sync/syncable/entry.h" | 8 #include "components/sync/syncable/entry.h" |
| 9 #include "components/sync/syncable/mutable_entry.h" | 9 #include "components/sync/syncable/mutable_entry.h" |
| 10 #include "components/sync/syncable/syncable_base_transaction.h" | 10 #include "components/sync/syncable/syncable_base_transaction.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 Id GetOnlyEntryWithName(BaseTransaction* rtrans, | 59 Id GetOnlyEntryWithName(BaseTransaction* rtrans, |
| 60 const syncable::Id& parent_id, | 60 const syncable::Id& parent_id, |
| 61 const string& name) { | 61 const string& name) { |
| 62 CHECK_EQ(1, CountEntriesWithName(rtrans, parent_id, name)); | 62 CHECK_EQ(1, CountEntriesWithName(rtrans, parent_id, name)); |
| 63 return GetFirstEntryWithName(rtrans, parent_id, name); | 63 return GetFirstEntryWithName(rtrans, parent_id, name); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void CreateTypeRoot(WriteTransaction* trans, | 66 void CreateTypeRoot(WriteTransaction* trans, |
| 67 syncable::Directory* dir, | 67 syncable::Directory* dir, |
| 68 ModelType type) { | 68 ModelType type) { |
| 69 // Root node for this type shouldn't exist yet. |
| 70 Entry same_type_root(trans, GET_TYPE_ROOT, type); |
| 71 DCHECK(!same_type_root.good()); |
| 72 |
| 69 std::string tag_name = ModelTypeToRootTag(type); | 73 std::string tag_name = ModelTypeToRootTag(type); |
| 70 syncable::MutableEntry node(trans, syncable::CREATE, type, | 74 syncable::MutableEntry node(trans, syncable::CREATE, type, |
| 71 TestIdFactory::root(), tag_name); | 75 TestIdFactory::root(), tag_name); |
| 72 DCHECK(node.good()); | 76 DCHECK(node.good()); |
| 73 node.PutUniqueServerTag(tag_name); | 77 node.PutUniqueServerTag(tag_name); |
| 74 node.PutIsDir(true); | 78 node.PutIsDir(true); |
| 75 node.PutServerIsDir(false); | 79 node.PutServerIsDir(false); |
| 76 node.PutIsUnsynced(false); | 80 node.PutIsUnsynced(false); |
| 77 node.PutIsUnappliedUpdate(false); | 81 node.PutIsUnappliedUpdate(false); |
| 78 node.PutServerVersion(20); | 82 node.PutServerVersion(20); |
| 79 node.PutBaseVersion(20); | 83 node.PutBaseVersion(20); |
| 80 node.PutIsDel(false); | 84 node.PutIsDel(false); |
| 81 node.PutId(TestIdFactory::MakeServer(tag_name)); | 85 node.PutId(TestIdFactory::MakeServer(tag_name)); |
| 82 sync_pb::EntitySpecifics specifics; | 86 sync_pb::EntitySpecifics specifics; |
| 83 AddDefaultFieldValue(type, &specifics); | 87 AddDefaultFieldValue(type, &specifics); |
| 84 node.PutServerSpecifics(specifics); | 88 node.PutServerSpecifics(specifics); |
| 85 node.PutSpecifics(specifics); | 89 node.PutSpecifics(specifics); |
| 86 } | 90 } |
| 87 | 91 |
| 88 sync_pb::DataTypeProgressMarker BuildProgress(ModelType type) { | 92 sync_pb::DataTypeProgressMarker BuildProgress(ModelType type) { |
| 89 sync_pb::DataTypeProgressMarker progress; | 93 sync_pb::DataTypeProgressMarker progress; |
| 90 progress.set_token("token"); | 94 progress.set_token("token"); |
| 91 progress.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | 95 progress.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); |
| 92 return progress; | 96 return progress; |
| 93 } | 97 } |
| 94 | 98 |
| 95 } // namespace syncable | 99 } // namespace syncable |
| 96 } // namespace syncer | 100 } // namespace syncer |
| OLD | NEW |