Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: sync/test/engine/mock_connection_manager.cc

Issue 1393633003: Sync: fix for the code that checks whether the initial download has completed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sync/test/engine/mock_connection_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « sync/test/engine/mock_connection_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698