| 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_SINGLE_TYPE_MOCK_SERVER_H_ | 5 #ifndef COMPONENTS_SYNC_TEST_ENGINE_SINGLE_TYPE_MOCK_SERVER_H_ |
| 6 #define COMPONENTS_SYNC_TEST_ENGINE_SINGLE_TYPE_MOCK_SERVER_H_ | 6 #define COMPONENTS_SYNC_TEST_ENGINE_SINGLE_TYPE_MOCK_SERVER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "components/sync/base/model_type.h" | 16 #include "components/sync/base/model_type.h" |
| 17 #include "components/sync/core/non_blocking_sync_common.h" | 17 #include "components/sync/core/non_blocking_sync_common.h" |
| 18 | 18 |
| 19 namespace syncer { | 19 namespace syncer { |
| 20 | 20 |
| 21 // A mock server used to test of happy-path update and commit logic. | 21 // A mock server used to test of happy-path update and commit logic. |
| 22 // | 22 // |
| 23 // This object supports only one ModelType, which must be specified at | 23 // This object supports only one ModelType, which must be specified at |
| 24 // initialization time. It does not support GetUpdates messages. It does not | 24 // initialization time. It does not support GetUpdates messages. It does not |
| 25 // support simulated errors. | 25 // support simulated errors. |
| 26 // | 26 // |
| 27 // This class is useful for testing UpdateHandlers and CommitContributors. | 27 // This class is useful for testing UpdateHandlers and CommitContributors. |
| 28 class SingleTypeMockServer { | 28 class SingleTypeMockServer { |
| 29 public: | 29 public: |
| 30 explicit SingleTypeMockServer(syncer::ModelType type); | 30 explicit SingleTypeMockServer(ModelType type); |
| 31 ~SingleTypeMockServer(); | 31 ~SingleTypeMockServer(); |
| 32 | 32 |
| 33 // Generates a SyncEntity representing a server-delivered update containing | 33 // Generates a SyncEntity representing a server-delivered update containing |
| 34 // the root node for this SingleTypeMockServer's type. | 34 // the root node for this SingleTypeMockServer's type. |
| 35 sync_pb::SyncEntity TypeRootUpdate(); | 35 sync_pb::SyncEntity TypeRootUpdate(); |
| 36 | 36 |
| 37 // Generates a SyncEntity representing a server-delivered update. | 37 // Generates a SyncEntity representing a server-delivered update. |
| 38 // | 38 // |
| 39 // The |version_offset| parameter allows the caller to simulate reflected | 39 // The |version_offset| parameter allows the caller to simulate reflected |
| 40 // updates, redeliveries, and genuine updates. | 40 // updates, redeliveries, and genuine updates. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // Map of most recent commits by tag_hash. | 93 // Map of most recent commits by tag_hash. |
| 94 std::map<const std::string, sync_pb::SyncEntity> committed_items_; | 94 std::map<const std::string, sync_pb::SyncEntity> committed_items_; |
| 95 | 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(SingleTypeMockServer); | 96 DISALLOW_COPY_AND_ASSIGN(SingleTypeMockServer); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 } // namespace syncer | 99 } // namespace syncer |
| 100 | 100 |
| 101 #endif // COMPONENTS_SYNC_TEST_ENGINE_SINGLE_TYPE_MOCK_SERVER_H_ | 101 #endif // COMPONENTS_SYNC_TEST_ENGINE_SINGLE_TYPE_MOCK_SERVER_H_ |
| OLD | NEW |