| 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 "components/sync/test/fake_server/unique_client_entity.h" | 5 #include "components/sync/test/fake_server/unique_client_entity.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "components/sync/base/hash_util.h" | 8 #include "components/sync/base/hash_util.h" |
| 9 #include "components/sync/protocol/sync.pb.h" | 9 #include "components/sync/protocol/sync.pb.h" |
| 10 #include "components/sync/test/fake_server/permanent_entity.h" | 10 #include "components/sync/test/fake_server/permanent_entity.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 creation_time_(creation_time), | 44 creation_time_(creation_time), |
| 45 last_modified_time_(last_modified_time) { | 45 last_modified_time_(last_modified_time) { |
| 46 SetSpecifics(specifics); | 46 SetSpecifics(specifics); |
| 47 } | 47 } |
| 48 | 48 |
| 49 UniqueClientEntity::~UniqueClientEntity() {} | 49 UniqueClientEntity::~UniqueClientEntity() {} |
| 50 | 50 |
| 51 // static | 51 // static |
| 52 std::unique_ptr<FakeServerEntity> UniqueClientEntity::Create( | 52 std::unique_ptr<FakeServerEntity> UniqueClientEntity::Create( |
| 53 const sync_pb::SyncEntity& client_entity) { | 53 const sync_pb::SyncEntity& client_entity) { |
| 54 CHECK(client_entity.has_client_defined_unique_tag()) | 54 // A UniqueClientEntity must have a client-defined unique tag. |
| 55 << "A UniqueClientEntity must have a client-defined unique tag."; | 55 CHECK(client_entity.has_client_defined_unique_tag()); |
| 56 ModelType model_type = | 56 ModelType model_type = |
| 57 syncer::GetModelTypeFromSpecifics(client_entity.specifics()); | 57 syncer::GetModelTypeFromSpecifics(client_entity.specifics()); |
| 58 string id = EffectiveIdForClientTaggedEntity(client_entity); | 58 string id = EffectiveIdForClientTaggedEntity(client_entity); |
| 59 return std::unique_ptr<FakeServerEntity>(new UniqueClientEntity( | 59 return std::unique_ptr<FakeServerEntity>(new UniqueClientEntity( |
| 60 id, client_entity.client_defined_unique_tag(), model_type, | 60 id, client_entity.client_defined_unique_tag(), model_type, |
| 61 client_entity.version(), client_entity.name(), client_entity.specifics(), | 61 client_entity.version(), client_entity.name(), client_entity.specifics(), |
| 62 client_entity.ctime(), client_entity.mtime())); | 62 client_entity.ctime(), client_entity.mtime())); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // static | 65 // static |
| (...skipping 27 matching lines...) Expand all Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 void UniqueClientEntity::SerializeAsProto(sync_pb::SyncEntity* proto) const { | 95 void UniqueClientEntity::SerializeAsProto(sync_pb::SyncEntity* proto) const { |
| 96 FakeServerEntity::SerializeBaseProtoFields(proto); | 96 FakeServerEntity::SerializeBaseProtoFields(proto); |
| 97 | 97 |
| 98 proto->set_ctime(creation_time_); | 98 proto->set_ctime(creation_time_); |
| 99 proto->set_mtime(last_modified_time_); | 99 proto->set_mtime(last_modified_time_); |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace fake_server | 102 } // namespace fake_server |
| OLD | NEW |