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

Side by Side Diff: sync/test/engine/test_syncable_utils.cc

Issue 11636006: WIP: The Bookmark Position Megapatch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Various updates, including switch suffix to unique_client_tag style Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/test/engine/mock_connection_manager.cc ('k') | sync/test/test_directory_backing_store.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/base_transaction.h" 9 #include "sync/syncable/base_transaction.h"
10 #include "sync/syncable/directory.h" 10 #include "sync/syncable/directory.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(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 = ModelTypeToRootTag(type);
72 syncable::Id node_id = TestIdFactory::MakeServer(tag_name);
73
72 syncable::MutableEntry node(trans, 74 syncable::MutableEntry node(trans,
73 syncable::CREATE, 75 syncable::CREATE_NEW_UPDATE_ITEM,
74 TestIdFactory::root(), 76 node_id);
75 tag_name);
76 DCHECK(node.good());
77 node.Put(syncable::UNIQUE_SERVER_TAG, tag_name); 77 node.Put(syncable::UNIQUE_SERVER_TAG, tag_name);
78 node.Put(syncable::IS_DIR, true); 78 node.Put(syncable::IS_DIR, true);
79 node.Put(syncable::SERVER_IS_DIR, false); 79 node.Put(syncable::SERVER_IS_DIR, true);
80 node.Put(syncable::IS_UNSYNCED, false); 80 node.Put(syncable::IS_UNSYNCED, false);
81 node.Put(syncable::IS_UNAPPLIED_UPDATE, false); 81 node.Put(syncable::IS_UNAPPLIED_UPDATE, false);
82 node.Put(syncable::SERVER_VERSION, 20); 82 node.Put(syncable::SERVER_VERSION, 20);
83 node.Put(syncable::BASE_VERSION, 20); 83 node.Put(syncable::BASE_VERSION, 20);
84 node.Put(syncable::SERVER_IS_DEL, false);
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
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);
91
92 // Tag name will make a good enough NON_UNIQUE_NAME.
93 node.Put(syncable::SERVER_NON_UNIQUE_NAME, tag_name);
94 node.Put(syncable::NON_UNIQUE_NAME, tag_name);
90 } 95 }
91 96
92 } // namespace syncable 97 } // namespace syncable
93 } // namespace syncer 98 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/test/engine/mock_connection_manager.cc ('k') | sync/test/test_directory_backing_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698