OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |