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 #ifndef SYNC_TEST_FAKE_SERVER_PERMANENT_ENTITY_H_
6 #define SYNC_TEST_FAKE_SERVER_PERMANENT_ENTITY_H_
10 #include "base/basictypes.h"
11 #include "sync/internal_api/public/base/model_type.h"
12 #include "sync/protocol/sync.pb.h"
13 #include "sync/test/fake_server/fake_server_entity.h"
15 namespace fake_server
{
17 // A server-created, permanent entity.
18 class PermanentEntity
: public FakeServerEntity
{
20 ~PermanentEntity() override
;
22 // Factory function for PermanentEntity. |server_tag| should be a globally
24 static scoped_ptr
<FakeServerEntity
> Create(
25 const syncer::ModelType
& model_type
,
26 const std::string
& server_tag
,
27 const std::string
& name
,
28 const std::string
& parent_server_tag
);
30 // Factory function for a top level PermanentEntity. Top level means that the
31 // entity's parent is the root entity (no PermanentEntity exists for root).
32 static scoped_ptr
<FakeServerEntity
> CreateTopLevel(
33 const syncer::ModelType
& model_type
);
35 // Factory function for creating an updated version of a PermanentEntity.
36 // This function should only be called for the Nigori entity.
37 static scoped_ptr
<FakeServerEntity
> CreateUpdatedNigoriEntity(
38 const sync_pb::SyncEntity
& client_entity
,
39 const FakeServerEntity
& current_server_entity
);
41 // FakeServerEntity implementation.
42 std::string
GetParentId() const override
;
43 void SerializeAsProto(sync_pb::SyncEntity
* proto
) const override
;
44 bool IsFolder() const override
;
45 bool IsPermanent() const override
;
48 PermanentEntity(const std::string
& id
,
49 const syncer::ModelType
& model_type
,
50 const std::string
& name
,
51 const std::string
& parent_id
,
52 const std::string
& server_defined_unique_tag
,
53 const sync_pb::EntitySpecifics
& entity_specifics
);
55 // All member values have equivalent fields in SyncEntity.
56 std::string server_defined_unique_tag_
;
57 std::string parent_id_
;
60 } // namespace fake_server
62 #endif // SYNC_TEST_FAKE_SERVER_PERMANENT_ENTITY_H_