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

Side by Side Diff: sync/test/fake_server/fake_server.cc

Issue 414953002: Make client tag IDs consistent in sync fake server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment Created 6 years, 5 months 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 | « no previous file | sync/test/fake_server/fake_server_entity.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/test/fake_server/fake_server.h" 5 #include "sync/test/fake_server/fake_server.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 if (!DeleteChildren(client_entity.id_string())) { 329 if (!DeleteChildren(client_entity.id_string())) {
330 return string(); 330 return string();
331 } 331 }
332 } else if (GetModelType(client_entity) == syncer::NIGORI) { 332 } else if (GetModelType(client_entity) == syncer::NIGORI) {
333 // NIGORI is the only permanent item type that should be updated by the 333 // NIGORI is the only permanent item type that should be updated by the
334 // client. 334 // client.
335 entity = PermanentEntity::CreateUpdatedNigoriEntity( 335 entity = PermanentEntity::CreateUpdatedNigoriEntity(
336 client_entity, 336 client_entity,
337 entities_[client_entity.id_string()]); 337 entities_[client_entity.id_string()]);
338 } else if (client_entity.has_client_defined_unique_tag()) { 338 } else if (client_entity.has_client_defined_unique_tag()) {
339 if (entities_.find(client_entity.id_string()) != entities_.end()) { 339 entity = UniqueClientEntity::Create(client_entity);
340 entity = UniqueClientEntity::CreateUpdatedVersion(
341 client_entity,
342 entities_[client_entity.id_string()]);
343 } else {
344 entity = UniqueClientEntity::CreateNew(client_entity);
345 }
346 } else { 340 } else {
347 // TODO(pvalenzuela): Validate entity's parent ID. 341 // TODO(pvalenzuela): Validate entity's parent ID.
348 if (entities_.find(client_entity.id_string()) != entities_.end()) { 342 if (entities_.find(client_entity.id_string()) != entities_.end()) {
349 entity = BookmarkEntity::CreateUpdatedVersion( 343 entity = BookmarkEntity::CreateUpdatedVersion(
350 client_entity, 344 client_entity,
351 entities_[client_entity.id_string()], 345 entities_[client_entity.id_string()],
352 parent_id); 346 parent_id);
353 } else { 347 } else {
354 entity = BookmarkEntity::CreateNew(client_entity, parent_id, client_guid); 348 entity = BookmarkEntity::CreateNew(client_entity, parent_id, client_guid);
355 } 349 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 514
521 void FakeServer::AddObserver(Observer* observer) { 515 void FakeServer::AddObserver(Observer* observer) {
522 observers_.AddObserver(observer); 516 observers_.AddObserver(observer);
523 } 517 }
524 518
525 void FakeServer::RemoveObserver(Observer* observer) { 519 void FakeServer::RemoveObserver(Observer* observer) {
526 observers_.RemoveObserver(observer); 520 observers_.RemoveObserver(observer);
527 } 521 }
528 522
529 } // namespace fake_server 523 } // namespace fake_server
OLDNEW
« no previous file with comments | « no previous file | sync/test/fake_server/fake_server_entity.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698