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

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

Issue 11474036: Remove initial_sync_ended bits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another rebase 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/test_syncable_utils.h ('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"
11 #include "sync/syncable/entry.h" 11 #include "sync/syncable/entry.h"
12 #include "sync/syncable/mutable_entry.h"
13 #include "sync/syncable/write_transaction.h"
14 #include "sync/test/engine/test_id_factory.h"
12 15
13 using std::string; 16 using std::string;
14 17
15 namespace syncer { 18 namespace syncer {
16 namespace syncable { 19 namespace syncable {
17 20
18 int CountEntriesWithName(BaseTransaction* rtrans, 21 int CountEntriesWithName(BaseTransaction* rtrans,
19 const syncable::Id& parent_id, 22 const syncable::Id& parent_id,
20 const string& name) { 23 const string& name) {
21 Directory::ChildHandles child_handles; 24 Directory::ChildHandles child_handles;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return Id(); 58 return Id();
56 } 59 }
57 60
58 Id GetOnlyEntryWithName(BaseTransaction* rtrans, 61 Id GetOnlyEntryWithName(BaseTransaction* rtrans,
59 const syncable::Id& parent_id, 62 const syncable::Id& parent_id,
60 const string& name) { 63 const string& name) {
61 CHECK(1 == CountEntriesWithName(rtrans, parent_id, name)); 64 CHECK(1 == CountEntriesWithName(rtrans, parent_id, name));
62 return GetFirstEntryWithName(rtrans, parent_id, name); 65 return GetFirstEntryWithName(rtrans, parent_id, name);
63 } 66 }
64 67
68 void CreateTypeRoot(WriteTransaction* trans,
69 syncable::Directory *dir,
70 ModelType type) {
71 std::string tag_name = syncer::ModelTypeToRootTag(type);
72 syncable::MutableEntry node(trans,
73 syncable::CREATE,
74 TestIdFactory::root(),
75 tag_name);
76 DCHECK(node.good());
77 node.Put(syncable::UNIQUE_SERVER_TAG, tag_name);
78 node.Put(syncable::IS_DIR, true);
79 node.Put(syncable::SERVER_IS_DIR, false);
80 node.Put(syncable::IS_UNSYNCED, false);
81 node.Put(syncable::IS_UNAPPLIED_UPDATE, false);
82 node.Put(syncable::SERVER_VERSION, 20);
83 node.Put(syncable::BASE_VERSION, 20);
84 node.Put(syncable::IS_DEL, false);
85 node.Put(syncable::ID, syncer::TestIdFactory::MakeServer(tag_name));
86 sync_pb::EntitySpecifics specifics;
87 syncer::AddDefaultFieldValue(type, &specifics);
88 node.Put(syncable::SERVER_SPECIFICS, specifics);
89 node.Put(syncable::SPECIFICS, specifics);
90 }
91
65 } // namespace syncable 92 } // namespace syncable
66 } // namespace syncer 93 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/test/engine/test_syncable_utils.h ('k') | sync/test/test_directory_backing_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698