| 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/tombstone_entity.h" | 5 #include "components/sync/test/fake_server/tombstone_entity.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "sync/internal_api/public/base/model_type.h" | 9 #include "components/sync/base/model_type.h" |
| 10 #include "sync/protocol/sync.pb.h" | 10 #include "components/sync/protocol/sync.pb.h" |
| 11 #include "sync/test/fake_server/fake_server_entity.h" | 11 #include "components/sync/test/fake_server/fake_server_entity.h" |
| 12 | 12 |
| 13 using std::string; | 13 using std::string; |
| 14 | 14 |
| 15 using syncer::ModelType; | 15 using syncer::ModelType; |
| 16 | 16 |
| 17 namespace fake_server { | 17 namespace fake_server { |
| 18 | 18 |
| 19 TombstoneEntity::~TombstoneEntity() { } | 19 TombstoneEntity::~TombstoneEntity() {} |
| 20 | 20 |
| 21 // static | 21 // static |
| 22 std::unique_ptr<FakeServerEntity> TombstoneEntity::Create(const string& id) { | 22 std::unique_ptr<FakeServerEntity> TombstoneEntity::Create(const string& id) { |
| 23 const ModelType model_type = GetModelTypeFromId(id); | 23 const ModelType model_type = GetModelTypeFromId(id); |
| 24 CHECK_NE(model_type, syncer::UNSPECIFIED) << "Invalid ID was given: " << id; | 24 CHECK_NE(model_type, syncer::UNSPECIFIED) << "Invalid ID was given: " << id; |
| 25 return std::unique_ptr<FakeServerEntity>(new TombstoneEntity(id, model_type)); | 25 return std::unique_ptr<FakeServerEntity>(new TombstoneEntity(id, model_type)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 TombstoneEntity::TombstoneEntity(const string& id, | 28 TombstoneEntity::TombstoneEntity(const string& id, const ModelType& model_type) |
| 29 const ModelType& model_type) | |
| 30 : FakeServerEntity(id, model_type, 0, string()) { | 29 : FakeServerEntity(id, model_type, 0, string()) { |
| 31 sync_pb::EntitySpecifics specifics; | 30 sync_pb::EntitySpecifics specifics; |
| 32 AddDefaultFieldValue(model_type, &specifics); | 31 AddDefaultFieldValue(model_type, &specifics); |
| 33 SetSpecifics(specifics); | 32 SetSpecifics(specifics); |
| 34 } | 33 } |
| 35 | 34 |
| 36 bool TombstoneEntity::RequiresParentId() const { | 35 bool TombstoneEntity::RequiresParentId() const { |
| 37 return false; | 36 return false; |
| 38 } | 37 } |
| 39 | 38 |
| 40 string TombstoneEntity::GetParentId() const { | 39 string TombstoneEntity::GetParentId() const { |
| 41 return string(); | 40 return string(); |
| 42 } | 41 } |
| 43 | 42 |
| 44 void TombstoneEntity::SerializeAsProto(sync_pb::SyncEntity* proto) const { | 43 void TombstoneEntity::SerializeAsProto(sync_pb::SyncEntity* proto) const { |
| 45 FakeServerEntity::SerializeBaseProtoFields(proto); | 44 FakeServerEntity::SerializeBaseProtoFields(proto); |
| 46 } | 45 } |
| 47 | 46 |
| 48 bool TombstoneEntity::IsDeleted() const { | 47 bool TombstoneEntity::IsDeleted() const { |
| 49 return true; | 48 return true; |
| 50 } | 49 } |
| 51 | 50 |
| 52 } // namespace fake_server | 51 } // namespace fake_server |
| OLD | NEW |