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

Side by Side Diff: chrome/browser/sync/test/engine/mock_connection_manager.cc

Issue 8917031: [Sync] Add nigori node conflict resolution. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + pass trans/cryptographer directly through Created 9 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 | « chrome/browser/sync/test/engine/mock_connection_manager.h ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Mock ServerConnectionManager class for use in client regression tests. 5 // Mock ServerConnectionManager class for use in client regression tests.
6 6
7 #include "chrome/browser/sync/test/engine/mock_connection_manager.h" 7 #include "chrome/browser/sync/test/engine/mock_connection_manager.h"
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 SyncEntity* MockConnectionManager::AddUpdateBookmark(int id, int parent_id, 223 SyncEntity* MockConnectionManager::AddUpdateBookmark(int id, int parent_id,
224 string name, int64 version, 224 string name, int64 version,
225 int64 sync_ts) { 225 int64 sync_ts) {
226 return AddUpdateBookmark(TestIdFactory::FromNumber(id), 226 return AddUpdateBookmark(TestIdFactory::FromNumber(id),
227 TestIdFactory::FromNumber(parent_id), 227 TestIdFactory::FromNumber(parent_id),
228 name, 228 name,
229 version, 229 version,
230 sync_ts); 230 sync_ts);
231 } 231 }
232 232
233 SyncEntity* MockConnectionManager::AddUpdateSpecifics(
234 int id, int parent_id, string name, int64 version, int64 sync_ts,
235 bool is_dir, int64 position, const sync_pb::EntitySpecifics& specifics) {
236 SyncEntity* ent = AddUpdateMeta(
237 TestIdFactory::FromNumber(id).GetServerId(),
238 TestIdFactory::FromNumber(parent_id).GetServerId(),
239 name, version, sync_ts);
240 ent->set_position_in_parent(position);
241 ent->mutable_specifics()->CopyFrom(specifics);
242 ent->set_folder(is_dir);
243 return ent;
244 }
245
246 sync_pb::SyncEntity* MockConnectionManager::SetNigori(
247 int id, int64 version,int64 sync_ts,
248 const sync_pb::EntitySpecifics& specifics) {
249 SyncEntity* ent = GetUpdateResponse()->add_entries();
250 ent->set_id_string(TestIdFactory::FromNumber(id).GetServerId());
251 ent->set_parent_id_string(TestIdFactory::FromNumber(0).GetServerId());
252 ent->set_server_defined_unique_tag(syncable::ModelTypeToRootTag(
253 syncable::NIGORI));
254 ent->set_name("Nigori");
255 ent->set_non_unique_name("Nigori");
256 ent->set_version(version);
257 ent->set_sync_timestamp(sync_ts);
258 ent->set_mtime(sync_ts);
259 ent->set_ctime(1);
260 ent->set_position_in_parent(0);
261 ent->set_folder(false);
262 ent->mutable_specifics()->CopyFrom(specifics);
263 return ent;
264 }
265
233 SyncEntity* MockConnectionManager::AddUpdateFull(string id, string parent_id, 266 SyncEntity* MockConnectionManager::AddUpdateFull(string id, string parent_id,
234 string name, int64 version, 267 string name, int64 version,
235 int64 sync_ts, bool is_dir) { 268 int64 sync_ts, bool is_dir) {
269 SyncEntity* ent = AddUpdateMeta(id, parent_id, name, version, sync_ts);
270 AddDefaultBookmarkData(ent, is_dir);
271 return ent;
272 }
273
274 SyncEntity* MockConnectionManager::AddUpdateMeta(string id, string parent_id,
275 string name, int64 version,
276 int64 sync_ts) {
236 SyncEntity* ent = GetUpdateResponse()->add_entries(); 277 SyncEntity* ent = GetUpdateResponse()->add_entries();
237 ent->set_id_string(id); 278 ent->set_id_string(id);
238 ent->set_parent_id_string(parent_id); 279 ent->set_parent_id_string(parent_id);
239 ent->set_non_unique_name(name); 280 ent->set_non_unique_name(name);
240 ent->set_name(name); 281 ent->set_name(name);
241 ent->set_version(version); 282 ent->set_version(version);
242 ent->set_sync_timestamp(sync_ts); 283 ent->set_sync_timestamp(sync_ts);
243 ent->set_mtime(sync_ts); 284 ent->set_mtime(sync_ts);
244 ent->set_ctime(1); 285 ent->set_ctime(1);
245 ent->set_position_in_parent(GeneratePositionInParent()); 286 ent->set_position_in_parent(GeneratePositionInParent());
246 AddDefaultBookmarkData(ent, is_dir);
247
248 return ent; 287 return ent;
249 } 288 }
250 289
251 SyncEntity* MockConnectionManager::AddUpdateDirectory(string id, 290 SyncEntity* MockConnectionManager::AddUpdateDirectory(string id,
252 string parent_id, 291 string parent_id,
253 string name, 292 string name,
254 int64 version, 293 int64 version,
255 int64 sync_ts) { 294 int64 sync_ts) {
256 return AddUpdateFull(id, parent_id, name, version, sync_ts, true); 295 return AddUpdateFull(id, parent_id, name, version, sync_ts, true);
257 } 296 }
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 } 654 }
616 655
617 void MockConnectionManager::SetServerNotReachable() { 656 void MockConnectionManager::SetServerNotReachable() {
618 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; 657 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE;
619 server_reachable_ = false; 658 server_reachable_ = false;
620 659
621 FOR_EACH_OBSERVER(ServerConnectionEventListener, listeners_, 660 FOR_EACH_OBSERVER(ServerConnectionEventListener, listeners_,
622 OnServerConnectionEvent( 661 OnServerConnectionEvent(
623 ServerConnectionEvent(server_status_, server_reachable_))); 662 ServerConnectionEvent(server_status_, server_reachable_)));
624 } 663 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/engine/mock_connection_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698