| 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 regression tests. | 5 // Mock ServerConnectionManager class for use in client regression tests. |
| 6 | 6 |
| 7 #include "sync/test/engine/mock_connection_manager.h" | 7 #include "sync/test/engine/mock_connection_manager.h" |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 mid_commit_observer_ = observer; | 75 mid_commit_observer_ = observer; |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool MockConnectionManager::PostBufferToPath(PostBufferParams* params, | 78 bool MockConnectionManager::PostBufferToPath(PostBufferParams* params, |
| 79 const string& path, | 79 const string& path, |
| 80 const string& auth_token, | 80 const string& auth_token, |
| 81 ScopedServerStatusWatcher* watcher) { | 81 ScopedServerStatusWatcher* watcher) { |
| 82 ClientToServerMessage post; | 82 ClientToServerMessage post; |
| 83 CHECK(post.ParseFromString(params->buffer_in)); | 83 CHECK(post.ParseFromString(params->buffer_in)); |
| 84 CHECK(post.has_protocol_version()); | 84 CHECK(post.has_protocol_version()); |
| 85 CHECK(post.has_api_key()); |
| 86 CHECK(post.has_bag_of_chips()); |
| 85 last_request_.CopyFrom(post); | 87 last_request_.CopyFrom(post); |
| 86 client_stuck_ = post.sync_problem_detected(); | 88 client_stuck_ = post.sync_problem_detected(); |
| 87 sync_pb::ClientToServerResponse response; | 89 sync_pb::ClientToServerResponse response; |
| 88 response.Clear(); | 90 response.Clear(); |
| 89 | 91 |
| 90 if (directory_) { | 92 if (directory_) { |
| 91 // If the Directory's locked when we do this, it's a problem as in normal | 93 // If the Directory's locked when we do this, it's a problem as in normal |
| 92 // use this function could take a while to return because it accesses the | 94 // use this function could take a while to return because it accesses the |
| 93 // network. As we can't test this we do the next best thing and hang here | 95 // network. As we can't test this we do the next best thing and hang here |
| 94 // when there's an issue. | 96 // when there's an issue. |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 | 612 |
| 611 void MockConnectionManager::UpdateConnectionStatus() { | 613 void MockConnectionManager::UpdateConnectionStatus() { |
| 612 if (!server_reachable_) { | 614 if (!server_reachable_) { |
| 613 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; | 615 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; |
| 614 } else { | 616 } else { |
| 615 server_status_ = HttpResponse::SERVER_CONNECTION_OK; | 617 server_status_ = HttpResponse::SERVER_CONNECTION_OK; |
| 616 } | 618 } |
| 617 } | 619 } |
| 618 | 620 |
| 619 } // namespace syncer | 621 } // namespace syncer |
| OLD | NEW |