| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "sync/test/engine/mock_update_handler.h" | 5 #include "components/sync/test/engine/mock_update_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "sync/internal_api/public/base/model_type.h" | 9 #include "components/sync/base/model_type.h" |
| 10 | 10 |
| 11 namespace syncer { | 11 namespace syncer { |
| 12 | 12 |
| 13 MockUpdateHandler::MockUpdateHandler(ModelType type) | 13 MockUpdateHandler::MockUpdateHandler(ModelType type) |
| 14 : apply_updates_count_(0), | 14 : apply_updates_count_(0), passive_apply_updates_count_(0) { |
| 15 passive_apply_updates_count_(0) { | |
| 16 progress_marker_.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | 15 progress_marker_.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); |
| 17 const std::string& token_str = | 16 const std::string& token_str = |
| 18 std::string("Mock token: ") + std::string(ModelTypeToString(type)); | 17 std::string("Mock token: ") + std::string(ModelTypeToString(type)); |
| 19 progress_marker_.set_token(token_str); | 18 progress_marker_.set_token(token_str); |
| 20 } | 19 } |
| 21 | 20 |
| 22 MockUpdateHandler::~MockUpdateHandler() {} | 21 MockUpdateHandler::~MockUpdateHandler() {} |
| 23 | 22 |
| 24 bool MockUpdateHandler::IsInitialSyncEnded() const { | 23 bool MockUpdateHandler::IsInitialSyncEnded() const { |
| 25 return false; | 24 return false; |
| 26 } | 25 } |
| 27 | 26 |
| 28 void MockUpdateHandler::GetDownloadProgress( | 27 void MockUpdateHandler::GetDownloadProgress( |
| 29 sync_pb::DataTypeProgressMarker* progress_marker) const { | 28 sync_pb::DataTypeProgressMarker* progress_marker) const { |
| 30 progress_marker->CopyFrom(progress_marker_); | 29 progress_marker->CopyFrom(progress_marker_); |
| 31 } | 30 } |
| 32 | 31 |
| 33 void MockUpdateHandler::GetDataTypeContext( | 32 void MockUpdateHandler::GetDataTypeContext( |
| 34 sync_pb::DataTypeContext* context) const { | 33 sync_pb::DataTypeContext* context) const { |
| 35 context->Clear(); | 34 context->Clear(); |
| 36 } | 35 } |
| 37 | 36 |
| 38 SyncerError MockUpdateHandler::ProcessGetUpdatesResponse( | 37 SyncerError MockUpdateHandler::ProcessGetUpdatesResponse( |
| 39 const sync_pb::DataTypeProgressMarker& progress_marker, | 38 const sync_pb::DataTypeProgressMarker& progress_marker, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 55 | 54 |
| 56 int MockUpdateHandler::GetApplyUpdatesCount() { | 55 int MockUpdateHandler::GetApplyUpdatesCount() { |
| 57 return apply_updates_count_; | 56 return apply_updates_count_; |
| 58 } | 57 } |
| 59 | 58 |
| 60 int MockUpdateHandler::GetPassiveApplyUpdatesCount() { | 59 int MockUpdateHandler::GetPassiveApplyUpdatesCount() { |
| 61 return passive_apply_updates_count_; | 60 return passive_apply_updates_count_; |
| 62 } | 61 } |
| 63 | 62 |
| 64 } // namespace syncer | 63 } // namespace syncer |
| OLD | NEW |