| 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 "sync/test/engine/test_syncable_utils.h" | 7 #include "sync/test/engine/test_syncable_utils.h" |
| 8 | 8 |
| 9 #include "sync/syncable/directory.h" | 9 #include "sync/syncable/directory.h" |
| 10 #include "sync/syncable/entry.h" | 10 #include "sync/syncable/entry.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 CHECK(1 == CountEntriesWithName(rtrans, parent_id, name)); | 64 CHECK(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 = syncer::ModelTypeToRootTag(type); |
| 72 syncable::MutableEntry node(trans, | 72 syncable::MutableEntry node(trans, |
| 73 syncable::CREATE, | 73 syncable::CREATE, |
| 74 type, |
| 74 TestIdFactory::root(), | 75 TestIdFactory::root(), |
| 75 tag_name); | 76 tag_name); |
| 76 DCHECK(node.good()); | 77 DCHECK(node.good()); |
| 77 node.Put(syncable::UNIQUE_SERVER_TAG, tag_name); | 78 node.Put(syncable::UNIQUE_SERVER_TAG, tag_name); |
| 78 node.Put(syncable::IS_DIR, true); | 79 node.Put(syncable::IS_DIR, true); |
| 79 node.Put(syncable::SERVER_IS_DIR, false); | 80 node.Put(syncable::SERVER_IS_DIR, false); |
| 80 node.Put(syncable::IS_UNSYNCED, false); | 81 node.Put(syncable::IS_UNSYNCED, false); |
| 81 node.Put(syncable::IS_UNAPPLIED_UPDATE, false); | 82 node.Put(syncable::IS_UNAPPLIED_UPDATE, false); |
| 82 node.Put(syncable::SERVER_VERSION, 20); | 83 node.Put(syncable::SERVER_VERSION, 20); |
| 83 node.Put(syncable::BASE_VERSION, 20); | 84 node.Put(syncable::BASE_VERSION, 20); |
| 84 node.Put(syncable::IS_DEL, false); | 85 node.Put(syncable::IS_DEL, false); |
| 85 node.Put(syncable::ID, syncer::TestIdFactory::MakeServer(tag_name)); | 86 node.Put(syncable::ID, syncer::TestIdFactory::MakeServer(tag_name)); |
| 86 sync_pb::EntitySpecifics specifics; | 87 sync_pb::EntitySpecifics specifics; |
| 87 syncer::AddDefaultFieldValue(type, &specifics); | 88 syncer::AddDefaultFieldValue(type, &specifics); |
| 88 node.Put(syncable::SERVER_SPECIFICS, specifics); | 89 node.Put(syncable::SERVER_SPECIFICS, specifics); |
| 89 node.Put(syncable::SPECIFICS, specifics); | 90 node.Put(syncable::SPECIFICS, specifics); |
| 90 } | 91 } |
| 91 | 92 |
| 92 } // namespace syncable | 93 } // namespace syncable |
| 93 } // namespace syncer | 94 } // namespace syncer |
| OLD | NEW |