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
3 // found in the LICENSE file.
5 #include "sync/test/engine/mock_update_handler.h"
7 #include "sync/internal_api/public/base/model_type.h"
11 MockUpdateHandler::MockUpdateHandler(ModelType type
)
12 : apply_updates_count_(0),
13 passive_apply_updates_count_(0) {
14 progress_marker_
.set_data_type_id(GetSpecificsFieldNumberFromModelType(type
));
15 const std::string
& token_str
=
16 std::string("Mock token: ") + std::string(ModelTypeToString(type
));
17 progress_marker_
.set_token(token_str
);
20 MockUpdateHandler::~MockUpdateHandler() {}
22 void MockUpdateHandler::GetDownloadProgress(
23 sync_pb::DataTypeProgressMarker
* progress_marker
) const {
24 progress_marker
->CopyFrom(progress_marker_
);
27 void MockUpdateHandler::GetDataTypeContext(
28 sync_pb::DataTypeContext
* context
) const {
32 SyncerError
MockUpdateHandler::ProcessGetUpdatesResponse(
33 const sync_pb::DataTypeProgressMarker
& progress_marker
,
34 const sync_pb::DataTypeContext
& mutated_context
,
35 const SyncEntityList
& applicable_updates
,
36 sessions::StatusController
* status
) {
37 progress_marker_
.CopyFrom(progress_marker
);
38 return syncer::SYNCER_OK
;
41 void MockUpdateHandler::ApplyUpdates(sessions::StatusController
* status
) {
42 apply_updates_count_
++;
45 void MockUpdateHandler::PassiveApplyUpdates(
46 sessions::StatusController
* status
) {
47 passive_apply_updates_count_
++;
50 int MockUpdateHandler::GetApplyUpdatesCount() {
51 return apply_updates_count_
;
54 int MockUpdateHandler::GetPassiveApplyUpdatesCount() {
55 return passive_apply_updates_count_
;