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 "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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 } | 526 } |
527 } | 527 } |
528 | 528 |
529 response->mutable_get_updates()->CopyFrom(*updates); | 529 response->mutable_get_updates()->CopyFrom(*updates); |
530 | 530 |
531 // Set appropriate progress markers, overriding the value squirreled | 531 // Set appropriate progress markers, overriding the value squirreled |
532 // away by ApplyToken(). | 532 // away by ApplyToken(). |
533 std::string token = response->get_updates().new_progress_marker(0).token(); | 533 std::string token = response->get_updates().new_progress_marker(0).token(); |
534 response->mutable_get_updates()->clear_new_progress_marker(); | 534 response->mutable_get_updates()->clear_new_progress_marker(); |
535 for (int i = 0; i < gu.from_progress_marker_size(); ++i) { | 535 for (int i = 0; i < gu.from_progress_marker_size(); ++i) { |
536 if (gu.from_progress_marker(i).token() != token) { | 536 sync_pb::DataTypeProgressMarker* new_marker = |
537 sync_pb::DataTypeProgressMarker* new_marker = | 537 response->mutable_get_updates()->add_new_progress_marker(); |
538 response->mutable_get_updates()->add_new_progress_marker(); | 538 new_marker->set_data_type_id(gu.from_progress_marker(i).data_type_id()); |
539 new_marker->set_data_type_id(gu.from_progress_marker(i).data_type_id()); | 539 new_marker->set_token(token); |
540 new_marker->set_token(token); | |
541 } | |
542 } | 540 } |
543 | 541 |
544 // Fill the keystore key if requested. | 542 // Fill the keystore key if requested. |
545 if (gu.need_encryption_key()) | 543 if (gu.need_encryption_key()) |
546 response->mutable_get_updates()->add_encryption_keys(keystore_key_); | 544 response->mutable_get_updates()->add_encryption_keys(keystore_key_); |
547 | 545 |
548 update_queue_.pop_front(); | 546 update_queue_.pop_front(); |
549 | 547 |
550 if (gu_client_command_) { | 548 if (gu_client_command_) { |
551 response->mutable_client_command()->CopyFrom(*gu_client_command_.get()); | 549 response->mutable_client_command()->CopyFrom(*gu_client_command_.get()); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 server_status_ = HttpResponse::SERVER_CONNECTION_OK; | 728 server_status_ = HttpResponse::SERVER_CONNECTION_OK; |
731 } | 729 } |
732 } | 730 } |
733 | 731 |
734 void MockConnectionManager::SetServerStatus( | 732 void MockConnectionManager::SetServerStatus( |
735 HttpResponse::ServerConnectionCode server_status) { | 733 HttpResponse::ServerConnectionCode server_status) { |
736 server_status_ = server_status; | 734 server_status_ = server_status; |
737 } | 735 } |
738 | 736 |
739 } // namespace syncer | 737 } // namespace syncer |
OLD | NEW |