| 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 "chrome/browser/sync/test/engine/mock_connection_manager.h" | 7 #include "chrome/browser/sync/test/engine/mock_connection_manager.h" |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 !mid_commit_callback_.is_null()) { | 163 !mid_commit_callback_.is_null()) { |
| 164 mid_commit_callback_.Run(); | 164 mid_commit_callback_.Run(); |
| 165 } | 165 } |
| 166 if (mid_commit_observer_) { | 166 if (mid_commit_observer_) { |
| 167 mid_commit_observer_->Observe(); | 167 mid_commit_observer_->Observe(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 return result; | 170 return result; |
| 171 } | 171 } |
| 172 | 172 |
| 173 bool MockConnectionManager::IsServerReachable() { | |
| 174 return true; | |
| 175 } | |
| 176 | |
| 177 bool MockConnectionManager::IsUserAuthenticated() { | |
| 178 return true; | |
| 179 } | |
| 180 | |
| 181 sync_pb::GetUpdatesResponse* MockConnectionManager::GetUpdateResponse() { | 173 sync_pb::GetUpdatesResponse* MockConnectionManager::GetUpdateResponse() { |
| 182 if (update_queue_.empty()) { | 174 if (update_queue_.empty()) { |
| 183 NextUpdateBatch(); | 175 NextUpdateBatch(); |
| 184 } | 176 } |
| 185 return &update_queue_.back(); | 177 return &update_queue_.back(); |
| 186 } | 178 } |
| 187 | 179 |
| 188 void MockConnectionManager::AddDefaultBookmarkData(sync_pb::SyncEntity* entity, | 180 void MockConnectionManager::AddDefaultBookmarkData(sync_pb::SyncEntity* entity, |
| 189 bool is_folder) { | 181 bool is_folder) { |
| 190 if (use_legacy_bookmarks_protocol_) { | 182 if (use_legacy_bookmarks_protocol_) { |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 } | 648 } |
| 657 | 649 |
| 658 void MockConnectionManager::SetServerNotReachable() { | 650 void MockConnectionManager::SetServerNotReachable() { |
| 659 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; | 651 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; |
| 660 server_reachable_ = false; | 652 server_reachable_ = false; |
| 661 | 653 |
| 662 FOR_EACH_OBSERVER(ServerConnectionEventListener, listeners_, | 654 FOR_EACH_OBSERVER(ServerConnectionEventListener, listeners_, |
| 663 OnServerConnectionEvent( | 655 OnServerConnectionEvent( |
| 664 ServerConnectionEvent(server_status_, server_reachable_))); | 656 ServerConnectionEvent(server_status_, server_reachable_))); |
| 665 } | 657 } |
| OLD | NEW |