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 "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"
13
14using std::string;
15
16using syncer::ModelType;
17
18namespace fake_server {
19
20TombstoneEntity::~TombstoneEntity() { }
21
22// static
23FakeServerEntity* TombstoneEntity::Create(const string& id) {
24  return new TombstoneEntity(id, GetModelTypeFromId(id));
25}
26
27TombstoneEntity::TombstoneEntity(const string& id,
28                                 const ModelType& model_type)
29    : FakeServerEntity(id, model_type, 0, string()) { }
30
31string TombstoneEntity::GetParentId() const {
32  return string();
33}
34
35sync_pb::SyncEntity* TombstoneEntity::SerializeAsProto() {
36  sync_pb::SyncEntity* sync_entity = new sync_pb::SyncEntity();
37  FakeServerEntity::SerializeBaseProtoFields(sync_entity);
38
39  sync_pb::EntitySpecifics* specifics = sync_entity->mutable_specifics();
40  AddDefaultFieldValue(FakeServerEntity::GetModelType(), specifics);
41
42  return sync_entity;
43}
44
45bool TombstoneEntity::IsDeleted() const {
46  return true;
47}
48
49bool TombstoneEntity::IsFolder() const {
50  return false;
51}
52
53}  // namespace fake_server
54