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

Side by Side Diff: sync/internal_api/test/test_entry_factory.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
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 #include "sync/internal_api/public/test/test_entry_factory.h" 5 #include "sync/internal_api/public/test/test_entry_factory.h"
6 6
7 #include "sync/syncable/directory.h" 7 #include "sync/syncable/directory.h"
8 #include "sync/syncable/entry.h" 8 #include "sync/syncable/entry.h"
9 #include "sync/syncable/mutable_entry.h" 9 #include "sync/syncable/mutable_entry.h"
10 #include "sync/syncable/read_transaction.h" 10 #include "sync/syncable/read_transaction.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 entry.Put(syncable::SERVER_NON_UNIQUE_NAME, "X"); 157 entry.Put(syncable::SERVER_NON_UNIQUE_NAME, "X");
158 entry.Put(syncable::SERVER_PARENT_ID, TestIdFactory::MakeServer("Y")); 158 entry.Put(syncable::SERVER_PARENT_ID, TestIdFactory::MakeServer("Y"));
159 entry.Put(syncable::SERVER_IS_DIR, is_folder); 159 entry.Put(syncable::SERVER_IS_DIR, is_folder);
160 entry.Put(syncable::SERVER_IS_DEL, false); 160 entry.Put(syncable::SERVER_IS_DEL, false);
161 entry.Put(syncable::SERVER_SPECIFICS, default_specifics); 161 entry.Put(syncable::SERVER_SPECIFICS, default_specifics);
162 entry.Put(syncable::SERVER_PARENT_ID, parent_id); 162 entry.Put(syncable::SERVER_PARENT_ID, parent_id);
163 163
164 return entry.Get(syncable::META_HANDLE); 164 return entry.Get(syncable::META_HANDLE);
165 } 165 }
166 166
167 int64 TestEntryFactory::CreateUnappliedRootNode(
168 ModelType model_type) {
169 syncable::WriteTransaction trans(FROM_HERE, syncable::UNITTEST, directory_);
170 sync_pb::EntitySpecifics specifics;
171 AddDefaultFieldValue(model_type, &specifics);
172 syncable::Id node_id = TestIdFactory::MakeServer("xyz");
173 syncable::MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM,
174 node_id);
175 DCHECK(entry.good());
176 // Make it look like sort of like a pending creation from the server.
177 // The SERVER_PARENT_ID and UNIQUE_CLIENT_TAG aren't quite right, but
178 // it's good enough for our purposes.
179 entry.Put(syncable::SERVER_VERSION, 1);
180 entry.Put(syncable::IS_UNAPPLIED_UPDATE, true);
181 entry.Put(syncable::SERVER_IS_DIR, false);
182 entry.Put(syncable::SERVER_PARENT_ID, TestIdFactory::root());
183 entry.Put(syncable::SERVER_SPECIFICS, specifics);
184 entry.Put(syncable::NON_UNIQUE_NAME, "xyz");
185
186 return entry.Get(syncable::META_HANDLE);
187 }
188
167 bool TestEntryFactory::SetServerSpecificsForItem( 189 bool TestEntryFactory::SetServerSpecificsForItem(
168 int64 meta_handle, 190 int64 meta_handle,
169 const sync_pb::EntitySpecifics specifics) { 191 const sync_pb::EntitySpecifics specifics) {
170 WriteTransaction trans(FROM_HERE, UNITTEST, directory_); 192 WriteTransaction trans(FROM_HERE, UNITTEST, directory_);
171 MutableEntry entry(&trans, syncable::GET_BY_HANDLE, meta_handle); 193 MutableEntry entry(&trans, syncable::GET_BY_HANDLE, meta_handle);
172 if (!entry.good()) { 194 if (!entry.good()) {
173 return false; 195 return false;
174 } 196 }
175 entry.Put(syncable::SERVER_SPECIFICS, specifics); 197 entry.Put(syncable::SERVER_SPECIFICS, specifics);
176 entry.Put(syncable::IS_UNAPPLIED_UPDATE, true); 198 entry.Put(syncable::IS_UNAPPLIED_UPDATE, true);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return false; 246 return false;
225 } 247 }
226 return entry.Get(syncable::IS_UNAPPLIED_UPDATE); 248 return entry.Get(syncable::IS_UNAPPLIED_UPDATE);
227 } 249 }
228 250
229 int64 TestEntryFactory::GetNextRevision() { 251 int64 TestEntryFactory::GetNextRevision() {
230 return next_revision_++; 252 return next_revision_++;
231 } 253 }
232 254
233 } // namespace syncer 255 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/sync_manager_impl_unittest.cc ('k') | sync/internal_api/test/test_user_share.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698