[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / sync / test / fake_server / permanent_entity.h
blob391b70b979846dbda21b6753e226287dbe425af5
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_
8 #include <string>
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 {
19 public:
20 virtual ~PermanentEntity();
22 // Factory function for PermanentEntity. |server_tag| should be a globally
23 // unique identifier.
24 static FakeServerEntity* Create(const syncer::ModelType& model_type,
25 const std::string& server_tag,
26 const std::string& name,
27 const std::string& parent_server_tag);
29 // Factory function for a top level PermanentEntity. Top level means that the
30 // entity's parent is the root entity (no PermanentEntity exists for root).
31 static FakeServerEntity* CreateTopLevel(const syncer::ModelType& model_type);
33 // Factory function for creating an updated version of a PermanentEntity.
34 // This function should only be called for the Nigori entity.
35 static FakeServerEntity* CreateUpdatedNigoriEntity(
36 const sync_pb::SyncEntity& client_entity,
37 FakeServerEntity* current_server_entity);
39 // FakeServerEntity implementation.
40 virtual std::string GetParentId() const OVERRIDE;
41 virtual sync_pb::SyncEntity* SerializeAsProto() OVERRIDE;
42 virtual bool IsDeleted() const OVERRIDE;
43 virtual bool IsFolder() const OVERRIDE;
45 private:
46 PermanentEntity(const std::string& id,
47 const syncer::ModelType& model_type,
48 const std::string& name,
49 const std::string& parent_id,
50 const std::string& server_defined_unique_tag,
51 const sync_pb::EntitySpecifics& entity_specifics);
53 // All member values have equivalent fields in SyncEntity.
54 std::string server_defined_unique_tag_;
55 std::string parent_id_;
56 sync_pb::EntitySpecifics specifics_;
59 } // namespace fake_server
61 #endif // SYNC_TEST_FAKE_SERVER_PERMANENT_ENTITY_H_