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 "sync/test/engine/mock_update_handler.h" |
6 | 6 |
7 #include "sync/internal_api/public/base/model_type.h" | 7 #include "sync/internal_api/public/base/model_type.h" |
8 | 8 |
9 namespace syncer { | 9 namespace syncer { |
10 | 10 |
11 MockUpdateHandler::MockUpdateHandler(ModelType type) | 11 MockUpdateHandler::MockUpdateHandler(ModelType type) |
12 : apply_updates_count_(0), | 12 : apply_updates_count_(0), |
13 passive_apply_updates_count_(0) { | 13 passive_apply_updates_count_(0) { |
14 progress_marker_.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); | 14 progress_marker_.set_data_type_id(GetSpecificsFieldNumberFromModelType(type)); |
15 const std::string& token_str = | 15 const std::string& token_str = |
16 std::string("Mock token: ") + std::string(ModelTypeToString(type)); | 16 std::string("Mock token: ") + std::string(ModelTypeToString(type)); |
17 progress_marker_.set_token(token_str); | 17 progress_marker_.set_token(token_str); |
18 } | 18 } |
19 | 19 |
20 MockUpdateHandler::~MockUpdateHandler() {} | 20 MockUpdateHandler::~MockUpdateHandler() {} |
21 | 21 |
22 void MockUpdateHandler::GetDownloadProgress( | 22 void MockUpdateHandler::GetDownloadProgress( |
23 sync_pb::DataTypeProgressMarker* progress_marker) const { | 23 sync_pb::DataTypeProgressMarker* progress_marker) const { |
24 progress_marker->CopyFrom(progress_marker_); | 24 progress_marker->CopyFrom(progress_marker_); |
25 } | 25 } |
26 | 26 |
| 27 void MockUpdateHandler::GetDataTypeContext( |
| 28 sync_pb::DataTypeContext* context) const { |
| 29 context->Clear(); |
| 30 } |
| 31 |
27 void MockUpdateHandler::ProcessGetUpdatesResponse( | 32 void MockUpdateHandler::ProcessGetUpdatesResponse( |
28 const sync_pb::DataTypeProgressMarker& progress_marker, | 33 const sync_pb::DataTypeProgressMarker& progress_marker, |
29 const SyncEntityList& applicable_updates, | 34 const SyncEntityList& applicable_updates, |
30 sessions::StatusController* status) { | 35 sessions::StatusController* status) { |
31 progress_marker_.CopyFrom(progress_marker); | 36 progress_marker_.CopyFrom(progress_marker); |
32 } | 37 } |
33 | 38 |
| 39 void MockUpdateHandler::ProcessDataTypeContextMutation( |
| 40 const sync_pb::DataTypeContext& mutated_context) { |
| 41 } |
| 42 |
34 void MockUpdateHandler::ApplyUpdates(sessions::StatusController* status) { | 43 void MockUpdateHandler::ApplyUpdates(sessions::StatusController* status) { |
35 apply_updates_count_++; | 44 apply_updates_count_++; |
36 } | 45 } |
37 | 46 |
38 void MockUpdateHandler::PassiveApplyUpdates( | 47 void MockUpdateHandler::PassiveApplyUpdates( |
39 sessions::StatusController* status) { | 48 sessions::StatusController* status) { |
40 passive_apply_updates_count_++; | 49 passive_apply_updates_count_++; |
41 } | 50 } |
42 | 51 |
43 int MockUpdateHandler::GetApplyUpdatesCount() { | 52 int MockUpdateHandler::GetApplyUpdatesCount() { |
44 return apply_updates_count_; | 53 return apply_updates_count_; |
45 } | 54 } |
46 | 55 |
47 int MockUpdateHandler::GetPassiveApplyUpdatesCount() { | 56 int MockUpdateHandler::GetPassiveApplyUpdatesCount() { |
48 return passive_apply_updates_count_; | 57 return passive_apply_updates_count_; |
49 } | 58 } |
50 | 59 |
51 } // namespace syncer | 60 } // namespace syncer |
OLD | NEW |