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