Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / sync / test / fake_server / tombstone_entity.cc
blob9305f13dc1d442f41f585fe8b15fcdd2f5fb614f
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.
5 #include "sync/test/fake_server/tombstone_entity.h"
7 #include <string>
9 #include "base/basictypes.h"
10 #include "sync/internal_api/public/base/model_type.h"
11 #include "sync/protocol/sync.pb.h"
12 #include "sync/test/fake_server/fake_server_entity.h"
14 using std::string;
16 using syncer::ModelType;
18 namespace fake_server {
20 TombstoneEntity::~TombstoneEntity() { }
22 // static
23 scoped_ptr<FakeServerEntity> TombstoneEntity::Create(const string& id) {
24 const ModelType model_type = GetModelTypeFromId(id);
25 CHECK_NE(model_type, syncer::UNSPECIFIED) << "Invalid ID was given: " << id;
26 return scoped_ptr<FakeServerEntity>(new TombstoneEntity(id, model_type));
29 TombstoneEntity::TombstoneEntity(const string& id,
30 const ModelType& model_type)
31 : FakeServerEntity(id, model_type, 0, string()) {
32 sync_pb::EntitySpecifics specifics;
33 AddDefaultFieldValue(model_type, &specifics);
34 SetSpecifics(specifics);
37 string TombstoneEntity::GetParentId() const {
38 return string();
41 void TombstoneEntity::SerializeAsProto(sync_pb::SyncEntity* proto) const {
42 FakeServerEntity::SerializeBaseProtoFields(proto);
45 bool TombstoneEntity::IsDeleted() const {
46 return true;
49 } // namespace fake_server