| 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 // Mock ServerConnectionManager class for use in client unit tests. | 5 // Mock ServerConnectionManager class for use in client unit tests. |
| 6 | 6 |
| 7 #ifndef SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ | 7 #ifndef SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ |
| 8 #define SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ | 8 #define SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ |
| 9 | 9 |
| 10 #include <bitset> | 10 #include <bitset> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 virtual ~MidCommitObserver() {} | 33 virtual ~MidCommitObserver() {} |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 MockConnectionManager(syncable::Directory*, | 36 MockConnectionManager(syncable::Directory*, |
| 37 CancelationSignal* signal); | 37 CancelationSignal* signal); |
| 38 ~MockConnectionManager() override; | 38 ~MockConnectionManager() override; |
| 39 | 39 |
| 40 // Overridden ServerConnectionManager functions. | 40 // Overridden ServerConnectionManager functions. |
| 41 bool PostBufferToPath(PostBufferParams*, | 41 bool PostBufferToPath(PostBufferParams*, |
| 42 const std::string& path, | 42 const std::string& path, |
| 43 const std::string& auth_token, | 43 const std::string& auth_token) override; |
| 44 ScopedServerStatusWatcher* watcher) override; | |
| 45 | 44 |
| 46 // Control of commit response. | 45 // Control of commit response. |
| 47 // NOTE: Commit callback is invoked only once then reset. | 46 // NOTE: Commit callback is invoked only once then reset. |
| 48 void SetMidCommitCallback(const base::Closure& callback); | 47 void SetMidCommitCallback(const base::Closure& callback); |
| 49 void SetMidCommitObserver(MidCommitObserver* observer); | 48 void SetMidCommitObserver(MidCommitObserver* observer); |
| 50 | 49 |
| 51 // Set this if you want commit to perform commit time rename. Will request | 50 // Set this if you want commit to perform commit time rename. Will request |
| 52 // that the client renames all commited entries, prepending this string. | 51 // that the client renames all commited entries, prepending this string. |
| 53 void SetCommitTimeRename(const std::string& prepend); | 52 void SetCommitTimeRename(const std::string& prepend); |
| 54 | 53 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 382 |
| 384 // Whether we are faking a server mandating clients to throttle requests. | 383 // Whether we are faking a server mandating clients to throttle requests. |
| 385 // Protected by |response_code_override_lock_|. | 384 // Protected by |response_code_override_lock_|. |
| 386 bool throttling_; | 385 bool throttling_; |
| 387 | 386 |
| 388 // Whether we are faking a server mandating clients to partial throttle | 387 // Whether we are faking a server mandating clients to partial throttle |
| 389 // requests. | 388 // requests. |
| 390 // Protected by |response_code_override_lock_|. | 389 // Protected by |response_code_override_lock_|. |
| 391 bool partialThrottling_; | 390 bool partialThrottling_; |
| 392 | 391 |
| 393 // Whether we are failing all requests by returning | |
| 394 // ClientToServerResponse::AUTH_INVALID. | |
| 395 // Protected by |response_code_override_lock_|. | |
| 396 bool fail_with_auth_invalid_; | |
| 397 | |
| 398 base::Lock response_code_override_lock_; | 392 base::Lock response_code_override_lock_; |
| 399 | 393 |
| 400 // True if we are only accepting GetUpdatesCallerInfo::PERIODIC requests. | 394 // True if we are only accepting GetUpdatesCallerInfo::PERIODIC requests. |
| 401 bool fail_non_periodic_get_updates_; | 395 bool fail_non_periodic_get_updates_; |
| 402 | 396 |
| 403 scoped_ptr<sync_pb::ClientCommand> gu_client_command_; | 397 scoped_ptr<sync_pb::ClientCommand> gu_client_command_; |
| 404 scoped_ptr<sync_pb::ClientCommand> commit_client_command_; | 398 scoped_ptr<sync_pb::ClientCommand> commit_client_command_; |
| 405 | 399 |
| 406 // The next value to use for the position_in_parent property. | 400 // The next value to use for the position_in_parent property. |
| 407 int64 next_position_in_parent_; | 401 int64 next_position_in_parent_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 420 std::string next_token_; | 414 std::string next_token_; |
| 421 | 415 |
| 422 std::vector<sync_pb::ClientToServerMessage> requests_; | 416 std::vector<sync_pb::ClientToServerMessage> requests_; |
| 423 | 417 |
| 424 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); | 418 DISALLOW_COPY_AND_ASSIGN(MockConnectionManager); |
| 425 }; | 419 }; |
| 426 | 420 |
| 427 } // namespace syncer | 421 } // namespace syncer |
| 428 | 422 |
| 429 #endif // SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ | 423 #endif // SYNC_TEST_ENGINE_MOCK_CONNECTION_MANAGER_H_ |
| OLD | NEW |