| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CONNECTION_MANAGER_H_ | 5 #ifndef COMPONENTS_SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ |
| 6 #define COMPONENTS_SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ | 6 #define COMPONENTS_SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <bitset> | 10 #include <bitset> |
| 11 #include <list> | 11 #include <list> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/callback.h" | 16 #include "base/callback.h" |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/scoped_vector.h" | |
| 20 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
| 21 #include "components/sync/base/model_type.h" | 20 #include "components/sync/base/model_type.h" |
| 22 #include "components/sync/base/unique_position.h" | 21 #include "components/sync/base/unique_position.h" |
| 23 #include "components/sync/engine_impl/net/server_connection_manager.h" | 22 #include "components/sync/engine_impl/net/server_connection_manager.h" |
| 24 #include "components/sync/protocol/sync.pb.h" | 23 #include "components/sync/protocol/sync.pb.h" |
| 25 | 24 |
| 26 namespace syncer { | 25 namespace syncer { |
| 27 | 26 |
| 28 namespace syncable { | 27 namespace syncable { |
| 29 class Directory; | 28 class Directory; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 179 |
| 181 // warning: These take ownership of their input. | 180 // warning: These take ownership of their input. |
| 182 void SetGUClientCommand(sync_pb::ClientCommand* command); | 181 void SetGUClientCommand(sync_pb::ClientCommand* command); |
| 183 void SetCommitClientCommand(sync_pb::ClientCommand* command); | 182 void SetCommitClientCommand(sync_pb::ClientCommand* command); |
| 184 | 183 |
| 185 void SetTransientErrorId(syncable::Id); | 184 void SetTransientErrorId(syncable::Id); |
| 186 | 185 |
| 187 const std::vector<syncable::Id>& committed_ids() const { | 186 const std::vector<syncable::Id>& committed_ids() const { |
| 188 return committed_ids_; | 187 return committed_ids_; |
| 189 } | 188 } |
| 190 const std::vector<sync_pb::CommitMessage*>& commit_messages() const { | 189 const std::vector<std::unique_ptr<sync_pb::CommitMessage>>& commit_messages() |
| 191 return commit_messages_.get(); | 190 const { |
| 191 return commit_messages_; |
| 192 } | 192 } |
| 193 const std::vector<sync_pb::CommitResponse*>& commit_responses() const { | 193 const std::vector<std::unique_ptr<sync_pb::CommitResponse>>& |
| 194 return commit_responses_.get(); | 194 commit_responses() const { |
| 195 return commit_responses_; |
| 195 } | 196 } |
| 196 // Retrieve the last sent commit message. | 197 // Retrieve the last sent commit message. |
| 197 const sync_pb::CommitMessage& last_sent_commit() const; | 198 const sync_pb::CommitMessage& last_sent_commit() const; |
| 198 | 199 |
| 199 // Retrieve the last returned commit response. | 200 // Retrieve the last returned commit response. |
| 200 const sync_pb::CommitResponse& last_commit_response() const; | 201 const sync_pb::CommitResponse& last_commit_response() const; |
| 201 | 202 |
| 202 // Retrieve the last request submitted to the server (regardless of type). | 203 // Retrieve the last request submitted to the server (regardless of type). |
| 203 const sync_pb::ClientToServerMessage& last_request() const; | 204 const sync_pb::ClientToServerMessage& last_request() const; |
| 204 | 205 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 std::vector<syncable::Id> committed_ids_; | 340 std::vector<syncable::Id> committed_ids_; |
| 340 | 341 |
| 341 // List of IDs which should return a transient error. | 342 // List of IDs which should return a transient error. |
| 342 std::vector<syncable::Id> transient_error_ids_; | 343 std::vector<syncable::Id> transient_error_ids_; |
| 343 | 344 |
| 344 // Control of when/if we return conflicts. | 345 // Control of when/if we return conflicts. |
| 345 bool conflict_all_commits_; | 346 bool conflict_all_commits_; |
| 346 int conflict_n_commits_; | 347 int conflict_n_commits_; |
| 347 | 348 |
| 348 // Commit messages we've sent, and responses we've returned. | 349 // Commit messages we've sent, and responses we've returned. |
| 349 ScopedVector<sync_pb::CommitMessage> commit_messages_; | 350 std::vector<std::unique_ptr<sync_pb::CommitMessage>> commit_messages_; |
| 350 ScopedVector<sync_pb::CommitResponse> commit_responses_; | 351 std::vector<std::unique_ptr<sync_pb::CommitResponse>> commit_responses_; |
| 351 | 352 |
| 352 // The next id the mock will return to a commit. | 353 // The next id the mock will return to a commit. |
| 353 int next_new_id_; | 354 int next_new_id_; |
| 354 | 355 |
| 355 // The store birthday we send to the client. | 356 // The store birthday we send to the client. |
| 356 std::string store_birthday_; | 357 std::string store_birthday_; |
| 357 base::Lock store_birthday_lock_; | 358 base::Lock store_birthday_lock_; |
| 358 bool store_birthday_sent_; | 359 bool store_birthday_sent_; |
| 359 bool client_stuck_; | 360 bool client_stuck_; |
| 360 std::string commit_time_rename_prepended_string_; | 361 std::string commit_time_rename_prepended_string_; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 std::string next_token_; | 416 std::string next_token_; |
| 416 | 417 |
| 417 std::vector<sync_pb::ClientToServerMessage> requests_; | 418 std::vector<sync_pb::ClientToServerMessage> requests_; |
| 418 | 419 |
| 419 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); | 420 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); |
| 420 }; | 421 }; |
| 421 | 422 |
| 422 } // namespace syncer | 423 } // namespace syncer |
| 423 | 424 |
| 424 #endif // COMPONENTS_SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ | 425 #endif // COMPONENTS_SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ |
| OLD | NEW |