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

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: 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
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 const std::string& effective_id =
pval...(no longer on Chromium) 2014/07/23 23:54:15 Looking back at this, perhaps I was assuming that
rlarocque 2014/07/24 00:18:39 Could be. It's also possible that you implemented
340 UniqueClientEntity::EffectiveIdForClientTaggedEntity(client_entity);
341 if (entities_.find(effective_id) != entities_.end()) {
340 entity = UniqueClientEntity::CreateUpdatedVersion( 342 entity = UniqueClientEntity::CreateUpdatedVersion(
341 client_entity, 343 client_entity, entities_[effective_id]);
342 entities_[client_entity.id_string()]);
343 } else { 344 } else {
344 entity = UniqueClientEntity::CreateNew(client_entity); 345 entity = UniqueClientEntity::CreateNew(client_entity);
345 } 346 }
346 } else { 347 } else {
347 // TODO(pvalenzuela): Validate entity's parent ID. 348 // TODO(pvalenzuela): Validate entity's parent ID.
348 if (entities_.find(client_entity.id_string()) != entities_.end()) { 349 if (entities_.find(client_entity.id_string()) != entities_.end()) {
349 entity = BookmarkEntity::CreateUpdatedVersion( 350 entity = BookmarkEntity::CreateUpdatedVersion(
350 client_entity, 351 client_entity,
351 entities_[client_entity.id_string()], 352 entities_[client_entity.id_string()],
352 parent_id); 353 parent_id);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 521
521 void FakeServer::AddObserver(Observer* observer) { 522 void FakeServer::AddObserver(Observer* observer) {
522 observers_.AddObserver(observer); 523 observers_.AddObserver(observer);
523 } 524 }
524 525
525 void FakeServer::RemoveObserver(Observer* observer) { 526 void FakeServer::RemoveObserver(Observer* observer) {
526 observers_.RemoveObserver(observer); 527 observers_.RemoveObserver(observer);
527 } 528 }
528 529
529 } // namespace fake_server 530 } // namespace fake_server
OLDNEW
« no previous file with comments | « no previous file | sync/test/fake_server/unique_client_entity.h » ('j') | sync/test/fake_server/unique_client_entity.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698