OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SYNC_TEST_FAKE_SERVER_FAKE_SERVER_ENTITY_H_ | 5 #ifndef SYNC_TEST_FAKE_SERVER_FAKE_SERVER_ENTITY_H_ |
6 #define SYNC_TEST_FAKE_SERVER_FAKE_SERVER_ENTITY_H_ | 6 #define SYNC_TEST_FAKE_SERVER_FAKE_SERVER_ENTITY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 virtual ~FakeServerEntity(); | 32 virtual ~FakeServerEntity(); |
33 const std::string& GetId() const; | 33 const std::string& GetId() const; |
34 syncer::ModelType GetModelType() const; | 34 syncer::ModelType GetModelType() const; |
35 int64 GetVersion() const; | 35 int64 GetVersion() const; |
36 void SetVersion(int64 version); | 36 void SetVersion(int64 version); |
37 const std::string& GetName() const; | 37 const std::string& GetName() const; |
38 | 38 |
39 // Common data items needed by server | 39 // Common data items needed by server |
40 virtual std::string GetParentId() const = 0; | 40 virtual std::string GetParentId() const = 0; |
41 virtual sync_pb::SyncEntity* SerializeAsProto() = 0; | 41 virtual void SerializeAsProto(sync_pb::SyncEntity* proto) = 0; |
42 virtual bool IsDeleted() const = 0; | 42 virtual bool IsDeleted() const = 0; |
43 virtual bool IsFolder() const = 0; | 43 virtual bool IsFolder() const = 0; |
44 | 44 |
45 protected: | 45 protected: |
46 // Extracts the ModelType from |id|. If |id| is malformed or does not contain | 46 // Extracts the ModelType from |id|. If |id| is malformed or does not contain |
47 // a valid ModelType, UNSPECIFIED is returned. | 47 // a valid ModelType, UNSPECIFIED is returned. |
48 static syncer::ModelType GetModelTypeFromId(const std::string& id); | 48 static syncer::ModelType GetModelTypeFromId(const std::string& id); |
49 | 49 |
50 FakeServerEntity(const std::string& id, | 50 FakeServerEntity(const std::string& id, |
51 const syncer::ModelType& model_type, | 51 const syncer::ModelType& model_type, |
(...skipping 12 matching lines...) Expand all Loading... |
64 // The version of this entity. | 64 // The version of this entity. |
65 int64 version_; | 65 int64 version_; |
66 | 66 |
67 // The name of the entity. | 67 // The name of the entity. |
68 std::string name_; | 68 std::string name_; |
69 }; | 69 }; |
70 | 70 |
71 } // namespace fake_server | 71 } // namespace fake_server |
72 | 72 |
73 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_ENTITY_H_ | 73 #endif // SYNC_TEST_FAKE_SERVER_FAKE_SERVER_ENTITY_H_ |
OLD | NEW |