OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_API_MOCK_MODEL_TYPE_STORE_H_ | 5 #ifndef COMPONENTS_SYNC_API_MOCK_MODEL_TYPE_STORE_H_ |
6 #define SYNC_API_MOCK_MODEL_TYPE_STORE_H_ | 6 #define COMPONENTS_SYNC_API_MOCK_MODEL_TYPE_STORE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "sync/api/model_type_store.h" | 11 #include "components/sync/api/model_type_store.h" |
12 | 12 |
13 namespace syncer_v2 { | 13 namespace syncer_v2 { |
14 | 14 |
15 // MockModelTypeStore is implementation of ModelTypeStore that does nothing. | 15 // MockModelTypeStore is implementation of ModelTypeStore that does nothing. |
16 // Use it when testing components that depend on ModelTypeStore. | 16 // Use it when testing components that depend on ModelTypeStore. |
17 // | 17 // |
18 // By default all methods return SUCCESS and empty results. It is possible to | 18 // By default all methods return SUCCESS and empty results. It is possible to |
19 // register custom handlers for certain functions to override behavior. It is | 19 // register custom handlers for certain functions to override behavior. It is |
20 // responsibility of handler to post callback with result. | 20 // responsibility of handler to post callback with result. |
21 // Here is an example: | 21 // Here is an example: |
(...skipping 21 matching lines...) Expand all Loading... |
43 class MockModelTypeStore : public ModelTypeStore { | 43 class MockModelTypeStore : public ModelTypeStore { |
44 public: | 44 public: |
45 // Signatures for all ModelTypeStore virtual functions. | 45 // Signatures for all ModelTypeStore virtual functions. |
46 typedef base::Callback<void(const ReadAllDataCallback&)> ReadAllDataSignature; | 46 typedef base::Callback<void(const ReadAllDataCallback&)> ReadAllDataSignature; |
47 typedef base::Callback<void(const IdList&, const ReadDataCallback&)> | 47 typedef base::Callback<void(const IdList&, const ReadDataCallback&)> |
48 ReadDataSignature; | 48 ReadDataSignature; |
49 typedef base::Callback<void(const ReadMetadataCallback& callback)> | 49 typedef base::Callback<void(const ReadMetadataCallback& callback)> |
50 ReadAllMetadataSignature; | 50 ReadAllMetadataSignature; |
51 typedef base::Callback<void(std::unique_ptr<WriteBatch>, CallbackWithResult)> | 51 typedef base::Callback<void(std::unique_ptr<WriteBatch>, CallbackWithResult)> |
52 CommitWriteBatchSignature; | 52 CommitWriteBatchSignature; |
53 typedef base::Callback<void(WriteBatch*, | 53 typedef base::Callback< |
54 const std::string&, | 54 void(WriteBatch*, const std::string&, const std::string&)> |
55 const std::string&)> WriteRecordSignature; | 55 WriteRecordSignature; |
56 typedef base::Callback<void(WriteBatch*, const std::string&)> | 56 typedef base::Callback<void(WriteBatch*, const std::string&)> |
57 WriteGlobalMetadataSignature; | 57 WriteGlobalMetadataSignature; |
58 typedef base::Callback<void(WriteBatch*, const std::string&)> | 58 typedef base::Callback<void(WriteBatch*, const std::string&)> |
59 DeleteRecordSignature; | 59 DeleteRecordSignature; |
60 typedef base::Callback<void(WriteBatch*)> DeleteGlobalMetadataSignature; | 60 typedef base::Callback<void(WriteBatch*)> DeleteGlobalMetadataSignature; |
61 | 61 |
62 MockModelTypeStore(); | 62 MockModelTypeStore(); |
63 ~MockModelTypeStore() override; | 63 ~MockModelTypeStore() override; |
64 | 64 |
65 // ModelTypeStore implementation. | 65 // ModelTypeStore implementation. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 WriteRecordSignature write_data_handler_; | 107 WriteRecordSignature write_data_handler_; |
108 WriteRecordSignature write_metadata_handler_; | 108 WriteRecordSignature write_metadata_handler_; |
109 WriteGlobalMetadataSignature write_global_metadata_handler_; | 109 WriteGlobalMetadataSignature write_global_metadata_handler_; |
110 DeleteRecordSignature delete_data_handler_; | 110 DeleteRecordSignature delete_data_handler_; |
111 DeleteRecordSignature delete_metadata_handler_; | 111 DeleteRecordSignature delete_metadata_handler_; |
112 DeleteGlobalMetadataSignature delete_global_metadata_handler_; | 112 DeleteGlobalMetadataSignature delete_global_metadata_handler_; |
113 }; | 113 }; |
114 | 114 |
115 } // namespace syncer_v2 | 115 } // namespace syncer_v2 |
116 | 116 |
117 #endif // SYNC_API_MOCK_MODEL_TYPE_STORE_H_ | 117 #endif // COMPONENTS_SYNC_API_MOCK_MODEL_TYPE_STORE_H_ |
OLD | NEW |