| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 | 162 |
| 163 if (fail_with_auth_invalid_) | 163 if (fail_with_auth_invalid_) |
| 164 response.set_error_code(SyncEnums::AUTH_INVALID); | 164 response.set_error_code(SyncEnums::AUTH_INVALID); |
| 165 } | 165 } |
| 166 | 166 |
| 167 response.SerializeToString(¶ms->buffer_out); | 167 response.SerializeToString(¶ms->buffer_out); |
| 168 if (post.message_contents() == ClientToServerMessage::COMMIT && | 168 if (post.message_contents() == ClientToServerMessage::COMMIT && |
| 169 !mid_commit_callback_.is_null()) { | 169 !mid_commit_callback_.is_null()) { |
| 170 mid_commit_callback_.Run(); | 170 mid_commit_callback_.Run(); |
| 171 mid_commit_callback_.Reset(); |
| 171 } | 172 } |
| 172 if (mid_commit_observer_) { | 173 if (mid_commit_observer_) { |
| 173 mid_commit_observer_->Observe(); | 174 mid_commit_observer_->Observe(); |
| 174 } | 175 } |
| 175 | 176 |
| 176 return result; | 177 return result; |
| 177 } | 178 } |
| 178 | 179 |
| 179 sync_pb::GetUpdatesResponse* MockConnectionManager::GetUpdateResponse() { | 180 sync_pb::GetUpdatesResponse* MockConnectionManager::GetUpdateResponse() { |
| 180 if (update_queue_.empty()) { | 181 if (update_queue_.empty()) { |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 server_reachable_ = false; | 624 server_reachable_ = false; |
| 624 } | 625 } |
| 625 | 626 |
| 626 void MockConnectionManager::UpdateConnectionStatus() { | 627 void MockConnectionManager::UpdateConnectionStatus() { |
| 627 if (!server_reachable_) { | 628 if (!server_reachable_) { |
| 628 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; | 629 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; |
| 629 } else { | 630 } else { |
| 630 server_status_ = HttpResponse::SERVER_CONNECTION_OK; | 631 server_status_ = HttpResponse::SERVER_CONNECTION_OK; |
| 631 } | 632 } |
| 632 } | 633 } |
| OLD | NEW |