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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 | 492 |
493 void MockConnectionManager::SetLastUpdatePosition(int64 server_position) { | 493 void MockConnectionManager::SetLastUpdatePosition(int64 server_position) { |
494 GetMutableLastUpdate()->set_position_in_parent(server_position); | 494 GetMutableLastUpdate()->set_position_in_parent(server_position); |
495 } | 495 } |
496 | 496 |
497 void MockConnectionManager::SetNewTimestamp(int ts) { | 497 void MockConnectionManager::SetNewTimestamp(int ts) { |
498 next_token_ = base::StringPrintf("mock connection ts = %d", ts); | 498 next_token_ = base::StringPrintf("mock connection ts = %d", ts); |
499 ApplyToken(); | 499 ApplyToken(); |
500 } | 500 } |
501 | 501 |
| 502 sync_pb::DataTypeProgressMarker* |
| 503 MockConnectionManager::AddUpdateProgressMarker() { |
| 504 return GetUpdateResponse()->add_new_progress_marker(); |
| 505 } |
| 506 |
502 void MockConnectionManager::ApplyToken() { | 507 void MockConnectionManager::ApplyToken() { |
503 if (!update_queue_.empty()) { | 508 if (!update_queue_.empty()) { |
504 GetUpdateResponse()->clear_new_progress_marker(); | 509 GetUpdateResponse()->clear_new_progress_marker(); |
505 sync_pb::DataTypeProgressMarker* new_marker = | 510 sync_pb::DataTypeProgressMarker* new_marker = AddUpdateProgressMarker(); |
506 GetUpdateResponse()->add_new_progress_marker(); | |
507 new_marker->set_data_type_id(-1); // Invalid -- clients shouldn't see. | 511 new_marker->set_data_type_id(-1); // Invalid -- clients shouldn't see. |
508 new_marker->set_token(next_token_); | 512 new_marker->set_token(next_token_); |
509 } | 513 } |
510 } | 514 } |
511 | 515 |
512 void MockConnectionManager::SetChangesRemaining(int64 timestamp) { | 516 void MockConnectionManager::SetChangesRemaining(int64 timestamp) { |
513 GetUpdateResponse()->set_changes_remaining(timestamp); | 517 GetUpdateResponse()->set_changes_remaining(timestamp); |
514 } | 518 } |
515 | 519 |
516 void MockConnectionManager::ProcessGetUpdates( | 520 void MockConnectionManager::ProcessGetUpdates( |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 server_status_ = HttpResponse::SERVER_CONNECTION_OK; | 771 server_status_ = HttpResponse::SERVER_CONNECTION_OK; |
768 } | 772 } |
769 } | 773 } |
770 | 774 |
771 void MockConnectionManager::SetServerStatus( | 775 void MockConnectionManager::SetServerStatus( |
772 HttpResponse::ServerConnectionCode server_status) { | 776 HttpResponse::ServerConnectionCode server_status) { |
773 server_status_ = server_status; | 777 server_status_ = server_status; |
774 } | 778 } |
775 | 779 |
776 } // namespace syncer | 780 } // namespace syncer |
OLD | NEW |