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 COMPONENTS_SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_WORKER_H_ | 5 #ifndef COMPONENTS_SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_WORKER_H_ |
6 #define COMPONENTS_SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_WORKER_H_ | 6 #define COMPONENTS_SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_WORKER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <deque> | 11 #include <deque> |
12 #include <map> | 12 #include <map> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "components/sync/core/model_type_processor.h" | 17 #include "components/sync/core/model_type_processor.h" |
18 #include "components/sync/core/non_blocking_sync_common.h" | 18 #include "components/sync/core/non_blocking_sync_common.h" |
19 #include "components/sync/engine/commit_queue.h" | 19 #include "components/sync/engine/commit_queue.h" |
20 #include "components/sync/protocol/data_type_state.pb.h" | 20 #include "components/sync/protocol/data_type_state.pb.h" |
21 #include "components/sync/protocol/sync.pb.h" | 21 #include "components/sync/protocol/sync.pb.h" |
22 | 22 |
23 namespace syncer { | 23 namespace syncer_v2 { |
24 | 24 |
25 // Receives and records commit requests sent through the ModelTypeWorker. | 25 // Receives and records commit requests sent through the ModelTypeWorker. |
26 // | 26 // |
27 // This class also includes features intended to help mock out server behavior. | 27 // This class also includes features intended to help mock out server behavior. |
28 // It has some basic functionality to keep track of server state and generate | 28 // It has some basic functionality to keep track of server state and generate |
29 // plausible UpdateResponseData and CommitResponseData messages. | 29 // plausible UpdateResponseData and CommitResponseData messages. |
30 class MockModelTypeWorker : public CommitQueue { | 30 class MockModelTypeWorker : public CommitQueue { |
31 public: | 31 public: |
32 MockModelTypeWorker(const sync_pb::DataTypeState& data_type_state, | 32 MockModelTypeWorker(const sync_pb::DataTypeState& data_type_state, |
33 ModelTypeProcessor* processor); | 33 ModelTypeProcessor* processor); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // A record of past commits requests. | 116 // A record of past commits requests. |
117 std::deque<CommitRequestDataList> pending_commits_; | 117 std::deque<CommitRequestDataList> pending_commits_; |
118 | 118 |
119 // Map of versions by client tag hash. | 119 // Map of versions by client tag hash. |
120 // This is an essential part of the mocked server state. | 120 // This is an essential part of the mocked server state. |
121 std::map<const std::string, int64_t> server_versions_; | 121 std::map<const std::string, int64_t> server_versions_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(MockModelTypeWorker); | 123 DISALLOW_COPY_AND_ASSIGN(MockModelTypeWorker); |
124 }; | 124 }; |
125 | 125 |
126 } // namespace syncer | 126 } // namespace syncer_v2 |
127 | 127 |
128 #endif // COMPONENTS_SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_WORKER_H_ | 128 #endif // COMPONENTS_SYNC_TEST_ENGINE_MOCK_MODEL_TYPE_WORKER_H_ |
OLD | NEW |