| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/sync/test/engine/mock_connection_manager.h" | 7 #include "components/sync/test/engine/mock_connection_manager.h" |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 : ServerConnectionManager("unused", 0, false, signal), | 38 : ServerConnectionManager("unused", 0, false, signal), |
| 39 server_reachable_(true), | 39 server_reachable_(true), |
| 40 conflict_all_commits_(false), | 40 conflict_all_commits_(false), |
| 41 conflict_n_commits_(0), | 41 conflict_n_commits_(0), |
| 42 next_new_id_(10000), | 42 next_new_id_(10000), |
| 43 store_birthday_("Store BDay!"), | 43 store_birthday_("Store BDay!"), |
| 44 store_birthday_sent_(false), | 44 store_birthday_sent_(false), |
| 45 client_stuck_(false), | 45 client_stuck_(false), |
| 46 countdown_to_postbuffer_fail_(0), | 46 countdown_to_postbuffer_fail_(0), |
| 47 directory_(directory), | 47 directory_(directory), |
| 48 mid_commit_observer_(NULL), | 48 mid_commit_observer_(nullptr), |
| 49 throttling_(false), | 49 throttling_(false), |
| 50 partialThrottling_(false), | 50 partialThrottling_(false), |
| 51 fail_non_periodic_get_updates_(false), | 51 fail_non_periodic_get_updates_(false), |
| 52 next_position_in_parent_(2), | 52 next_position_in_parent_(2), |
| 53 use_legacy_bookmarks_protocol_(false), | 53 use_legacy_bookmarks_protocol_(false), |
| 54 num_get_updates_requests_(0) { | 54 num_get_updates_requests_(0) { |
| 55 SetNewTimestamp(0); | 55 SetNewTimestamp(0); |
| 56 SetAuthToken(kValidAuthToken); | 56 SetAuthToken(kValidAuthToken); |
| 57 } | 57 } |
| 58 | 58 |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 MockConnectionManager::GetProgressMarkerForType( | 732 MockConnectionManager::GetProgressMarkerForType( |
| 733 const google::protobuf::RepeatedPtrField<sync_pb::DataTypeProgressMarker>& | 733 const google::protobuf::RepeatedPtrField<sync_pb::DataTypeProgressMarker>& |
| 734 filter, | 734 filter, |
| 735 ModelType value) { | 735 ModelType value) { |
| 736 int data_type_id = GetSpecificsFieldNumberFromModelType(value); | 736 int data_type_id = GetSpecificsFieldNumberFromModelType(value); |
| 737 for (int i = 0; i < filter.size(); ++i) { | 737 for (int i = 0; i < filter.size(); ++i) { |
| 738 if (filter.Get(i).data_type_id() == data_type_id) { | 738 if (filter.Get(i).data_type_id() == data_type_id) { |
| 739 return &(filter.Get(i)); | 739 return &(filter.Get(i)); |
| 740 } | 740 } |
| 741 } | 741 } |
| 742 return NULL; | 742 return nullptr; |
| 743 } | 743 } |
| 744 | 744 |
| 745 void MockConnectionManager::SetServerReachable() { | 745 void MockConnectionManager::SetServerReachable() { |
| 746 server_reachable_ = true; | 746 server_reachable_ = true; |
| 747 } | 747 } |
| 748 | 748 |
| 749 void MockConnectionManager::SetServerNotReachable() { | 749 void MockConnectionManager::SetServerNotReachable() { |
| 750 server_reachable_ = false; | 750 server_reachable_ = false; |
| 751 } | 751 } |
| 752 | 752 |
| 753 void MockConnectionManager::UpdateConnectionStatus() { | 753 void MockConnectionManager::UpdateConnectionStatus() { |
| 754 if (!server_reachable_) { | 754 if (!server_reachable_) { |
| 755 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; | 755 server_status_ = HttpResponse::CONNECTION_UNAVAILABLE; |
| 756 } else { | 756 } else { |
| 757 server_status_ = HttpResponse::SERVER_CONNECTION_OK; | 757 server_status_ = HttpResponse::SERVER_CONNECTION_OK; |
| 758 } | 758 } |
| 759 } | 759 } |
| 760 | 760 |
| 761 void MockConnectionManager::SetServerStatus( | 761 void MockConnectionManager::SetServerStatus( |
| 762 HttpResponse::ServerConnectionCode server_status) { | 762 HttpResponse::ServerConnectionCode server_status) { |
| 763 server_status_ = server_status; | 763 server_status_ = server_status; |
| 764 } | 764 } |
| 765 | 765 |
| 766 } // namespace syncer | 766 } // namespace syncer |
| OLD | NEW |