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