| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 if (fail_with_auth_invalid_) | 164 if (fail_with_auth_invalid_) |
| 165 response.set_error_code(SyncEnums::AUTH_INVALID); | 165 response.set_error_code(SyncEnums::AUTH_INVALID); |
| 166 } | 166 } |
| 167 | 167 |
| 168 response.SerializeToString(¶ms->buffer_out); | 168 response.SerializeToString(¶ms->buffer_out); |
| 169 if (post.message_contents() == ClientToServerMessage::COMMIT && | 169 if (post.message_contents() == ClientToServerMessage::COMMIT && |
| 170 !mid_commit_callback_.is_null()) { | 170 !mid_commit_callback_.is_null()) { |
| 171 mid_commit_callback_.Run(); | 171 mid_commit_callback_.Run(); |
| 172 mid_commit_callback_.Reset(); |
| 172 } | 173 } |
| 173 if (mid_commit_observer_) { | 174 if (mid_commit_observer_) { |
| 174 mid_commit_observer_->Observe(); | 175 mid_commit_observer_->Observe(); |
| 175 } | 176 } |
| 176 | 177 |
| 177 return result; | 178 return result; |
| 178 } | 179 } |
| 179 | 180 |
| 180 sync_pb::GetUpdatesResponse* MockConnectionManager::GetUpdateResponse() { | 181 sync_pb::GetUpdatesResponse* MockConnectionManager::GetUpdateResponse() { |
| 181 if (update_queue_.empty()) { | 182 if (update_queue_.empty()) { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 server_reachable_ = false; | 601 server_reachable_ = false; |
| 601 } | 602 } |
| 602 | 603 |
| 603 void MockConnectionManager::UpdateConnectionStatus() { | 604 void MockConnectionManager::UpdateConnectionStatus() { |
| 604 if (!server_reachable_) { | 605 if (!server_reachable_) { |
| 605 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; | 606 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; |
| 606 } else { | 607 } else { |
| 607 server_status_ = HttpResponse::SERVER_CONNECTION_OK; | 608 server_status_ = HttpResponse::SERVER_CONNECTION_OK; |
| 608 } | 609 } |
| 609 } | 610 } |
| OLD | NEW |