summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-25 02:00:25 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-25 02:00:25 +0000
commitf49ac0f68d45d6f57e9dc89fb9fa91b8f3855580 (patch)
tree5a220cf40061531ef42a6001587bcdb21d30720b /sync
parentc204bd92a639d9422246a6ded9d342f019007046 (diff)
downloadchromium_src-f49ac0f68d45d6f57e9dc89fb9fa91b8f3855580.zip
chromium_src-f49ac0f68d45d6f57e9dc89fb9fa91b8f3855580.tar.gz
chromium_src-f49ac0f68d45d6f57e9dc89fb9fa91b8f3855580.tar.bz2
sync: Filter types to apply in configure cycle
Modifies update application so that updates are not applied to unrelated types during a configure cycle. This is implemented by limiting the update application step so that it only affects enabled types. This also has the side effect of disabling update application for types while they're throttled, which should have no effect, since a throttled type is not expected to have any updates to apply. This change will allow the non-blocking types to remain enabled while a configure cycle is in progress. BUG=351005 Review URL: https://codereview.chromium.org/208263006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/engine/get_updates_delegate.cc17
-rw-r--r--sync/engine/get_updates_delegate.h6
-rw-r--r--sync/engine/get_updates_processor.cc6
-rw-r--r--sync/engine/get_updates_processor.h4
-rw-r--r--sync/engine/get_updates_processor_unittest.cc144
-rw-r--r--sync/engine/sync_scheduler_impl.cc2
-rw-r--r--sync/engine/syncer.cc3
-rw-r--r--sync/test/engine/mock_update_handler.cc20
-rw-r--r--sync/test/engine/mock_update_handler.h9
9 files changed, 176 insertions, 35 deletions
diff --git a/sync/engine/get_updates_delegate.cc b/sync/engine/get_updates_delegate.cc
index fe53841..ac66eef 100644
--- a/sync/engine/get_updates_delegate.cc
+++ b/sync/engine/get_updates_delegate.cc
@@ -15,20 +15,24 @@ namespace syncer {
namespace {
void NonPassiveApplyUpdates(
+ ModelTypeSet gu_types,
sessions::StatusController* status_controller,
UpdateHandlerMap* update_handler_map) {
for (UpdateHandlerMap::iterator it = update_handler_map->begin();
it != update_handler_map->end(); ++it) {
- it->second->ApplyUpdates(status_controller);
+ if (gu_types.Has(it->first))
+ it->second->ApplyUpdates(status_controller);
}
}
void PassiveApplyUpdates(
+ ModelTypeSet gu_types,
sessions::StatusController* status_controller,
UpdateHandlerMap* update_handler_map) {
for (UpdateHandlerMap::iterator it = update_handler_map->begin();
it != update_handler_map->end(); ++it) {
- it->second->PassiveApplyUpdates(status_controller);
+ if (gu_types.Has(it->first))
+ it->second->PassiveApplyUpdates(status_controller);
}
}
@@ -78,9 +82,10 @@ void NormalGetUpdatesDelegate::HelpPopulateGuMessage(
}
void NormalGetUpdatesDelegate::ApplyUpdates(
+ ModelTypeSet gu_types,
sessions::StatusController* status_controller,
UpdateHandlerMap* update_handler_map) const {
- NonPassiveApplyUpdates(status_controller, update_handler_map);
+ NonPassiveApplyUpdates(gu_types, status_controller, update_handler_map);
}
scoped_ptr<ProtocolEvent> NormalGetUpdatesDelegate::GetNetworkRequestEvent(
@@ -102,9 +107,10 @@ void ConfigureGetUpdatesDelegate::HelpPopulateGuMessage(
}
void ConfigureGetUpdatesDelegate::ApplyUpdates(
+ ModelTypeSet gu_types,
sessions::StatusController* status_controller,
UpdateHandlerMap* update_handler_map) const {
- PassiveApplyUpdates(status_controller, update_handler_map);
+ PassiveApplyUpdates(gu_types, status_controller, update_handler_map);
}
scoped_ptr<ProtocolEvent> ConfigureGetUpdatesDelegate::GetNetworkRequestEvent(
@@ -151,9 +157,10 @@ void PollGetUpdatesDelegate::HelpPopulateGuMessage(
}
void PollGetUpdatesDelegate::ApplyUpdates(
+ ModelTypeSet gu_types,
sessions::StatusController* status_controller,
UpdateHandlerMap* update_handler_map) const {
- NonPassiveApplyUpdates(status_controller, update_handler_map);
+ NonPassiveApplyUpdates(gu_types, status_controller, update_handler_map);
}
scoped_ptr<ProtocolEvent> PollGetUpdatesDelegate::GetNetworkRequestEvent(
diff --git a/sync/engine/get_updates_delegate.h b/sync/engine/get_updates_delegate.h
index d897edf..d61f39a 100644
--- a/sync/engine/get_updates_delegate.h
+++ b/sync/engine/get_updates_delegate.h
@@ -30,7 +30,8 @@ class SYNC_EXPORT_PRIVATE GetUpdatesDelegate {
// Applies pending updates to non-control types.
virtual void ApplyUpdates(
- sessions::StatusController* session,
+ ModelTypeSet gu_types,
+ sessions::StatusController* status,
UpdateHandlerMap* update_handler_map) const = 0;
virtual scoped_ptr<ProtocolEvent> GetNetworkRequestEvent(
@@ -50,6 +51,7 @@ class SYNC_EXPORT_PRIVATE NormalGetUpdatesDelegate : public GetUpdatesDelegate {
// Applies pending updates on the appropriate data type threads.
virtual void ApplyUpdates(
+ ModelTypeSet gu_types,
sessions::StatusController* status,
UpdateHandlerMap* update_handler_map) const OVERRIDE;
@@ -79,6 +81,7 @@ class SYNC_EXPORT_PRIVATE ConfigureGetUpdatesDelegate
// This is safe only if the ChangeProcessor is not listening to changes at
// this time.
virtual void ApplyUpdates(
+ ModelTypeSet gu_types,
sessions::StatusController* status,
UpdateHandlerMap* update_handler_map) const OVERRIDE;
@@ -106,6 +109,7 @@ class SYNC_EXPORT_PRIVATE PollGetUpdatesDelegate : public GetUpdatesDelegate {
// Applies updates on the appropriate data type thread.
virtual void ApplyUpdates(
+ ModelTypeSet gu_types,
sessions::StatusController* status,
UpdateHandlerMap* update_handler_map) const OVERRIDE;
diff --git a/sync/engine/get_updates_processor.cc b/sync/engine/get_updates_processor.cc
index a5ab59b..eb1d7be 100644
--- a/sync/engine/get_updates_processor.cc
+++ b/sync/engine/get_updates_processor.cc
@@ -172,7 +172,8 @@ void GetUpdatesProcessor::PrepareGetUpdates(
for (ModelTypeSet::Iterator it = gu_types.First(); it.Good(); it.Inc()) {
UpdateHandlerMap::iterator handler_it = update_handler_map_->find(it.Get());
- DCHECK(handler_it != update_handler_map_->end());
+ DCHECK(handler_it != update_handler_map_->end())
+ << "Failed to look up handler for " << ModelTypeToString(it.Get());
sync_pb::DataTypeProgressMarker* progress_marker =
get_updates->add_from_progress_marker();
handler_it->second->GetDownloadProgress(progress_marker);
@@ -317,8 +318,9 @@ bool GetUpdatesProcessor::ProcessGetUpdatesResponse(
}
void GetUpdatesProcessor::ApplyUpdates(
+ ModelTypeSet gu_types,
sessions::StatusController* status_controller) {
- delegate_.ApplyUpdates(status_controller, update_handler_map_);
+ delegate_.ApplyUpdates(gu_types, status_controller, update_handler_map_);
}
void GetUpdatesProcessor::CopyClientDebugInfo(
diff --git a/sync/engine/get_updates_processor.h b/sync/engine/get_updates_processor.h
index 787f267..40a5c3a 100644
--- a/sync/engine/get_updates_processor.h
+++ b/sync/engine/get_updates_processor.h
@@ -59,7 +59,9 @@ class SYNC_EXPORT_PRIVATE GetUpdatesProcessor {
bool create_mobile_bookmarks_folder);
// Applies any downloaded and processed updates.
- void ApplyUpdates(sessions::StatusController* status_controller);
+ void ApplyUpdates(
+ ModelTypeSet gu_types,
+ sessions::StatusController* status_controller);
private:
// Populates a GetUpdates request message with per-type information.
diff --git a/sync/engine/get_updates_processor_unittest.cc b/sync/engine/get_updates_processor_unittest.cc
index c494289..b8ea889 100644
--- a/sync/engine/get_updates_processor_unittest.cc
+++ b/sync/engine/get_updates_processor_unittest.cc
@@ -35,8 +35,8 @@ class GetUpdatesProcessorTest : public ::testing::Test {
AddUpdateHandler(PREFERENCES);
}
- ModelTypeSet request_types() {
- return request_types_;
+ ModelTypeSet enabled_types() {
+ return enabled_types_;
}
scoped_ptr<GetUpdatesProcessor> BuildGetUpdatesProcessor(
@@ -46,7 +46,7 @@ class GetUpdatesProcessorTest : public ::testing::Test {
}
void InitFakeUpdateResponse(sync_pb::GetUpdatesResponse* response) {
- ModelTypeSet types = request_types();
+ ModelTypeSet types = enabled_types();
for (ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) {
sync_pb::DataTypeProgressMarker* marker =
@@ -58,17 +58,27 @@ class GetUpdatesProcessorTest : public ::testing::Test {
response->set_changes_remaining(0);
}
+ const UpdateHandler* GetHandler(ModelType type) {
+ UpdateHandlerMap::iterator it = update_handler_map_.find(type);
+ if (it == update_handler_map_.end())
+ return NULL;
+ return it->second;
+ }
+
const base::TimeTicks kTestStartTime;
- private:
- void AddUpdateHandler(ModelType type) {
- request_types_.Put(type);
+ protected:
+ MockUpdateHandler* AddUpdateHandler(ModelType type) {
+ enabled_types_.Put(type);
- UpdateHandler* handler = new MockUpdateHandler(type);
+ MockUpdateHandler* handler = new MockUpdateHandler(type);
update_handler_map_.insert(std::make_pair(type, handler));
+
+ return handler;
}
- ModelTypeSet request_types_;
+ private:
+ ModelTypeSet enabled_types_;
UpdateHandlerMap update_handler_map_;
STLValueDeleter<UpdateHandlerMap> update_handler_deleter_;
scoped_ptr<GetUpdatesProcessor> get_updates_processor_;
@@ -85,7 +95,7 @@ TEST_F(GetUpdatesProcessorTest, BookmarkNudge) {
NormalGetUpdatesDelegate normal_delegate(nudge_tracker);
scoped_ptr<GetUpdatesProcessor> processor(
BuildGetUpdatesProcessor(normal_delegate));
- processor->PrepareGetUpdates(request_types(), &message);
+ processor->PrepareGetUpdates(enabled_types(), &message);
const sync_pb::GetUpdatesMessage& gu_msg = message.get_updates();
EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::LOCAL,
@@ -133,7 +143,7 @@ TEST_F(GetUpdatesProcessorTest, NotifyMany) {
NormalGetUpdatesDelegate normal_delegate(nudge_tracker);
scoped_ptr<GetUpdatesProcessor> processor(
BuildGetUpdatesProcessor(normal_delegate));
- processor->PrepareGetUpdates(request_types(), &message);
+ processor->PrepareGetUpdates(enabled_types(), &message);
const sync_pb::GetUpdatesMessage& gu_msg = message.get_updates();
EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::NOTIFICATION,
@@ -167,7 +177,7 @@ TEST_F(GetUpdatesProcessorTest, ConfigureTest) {
sync_pb::GetUpdatesCallerInfo::RECONFIGURATION);
scoped_ptr<GetUpdatesProcessor> processor(
BuildGetUpdatesProcessor(configure_delegate));
- processor->PrepareGetUpdates(request_types(), &message);
+ processor->PrepareGetUpdates(enabled_types(), &message);
const sync_pb::GetUpdatesMessage& gu_msg = message.get_updates();
EXPECT_EQ(sync_pb::SyncEnums::RECONFIGURATION, gu_msg.get_updates_origin());
@@ -180,7 +190,7 @@ TEST_F(GetUpdatesProcessorTest, ConfigureTest) {
gu_msg.from_progress_marker(i).data_type_id());
progress_types.Put(type);
}
- EXPECT_TRUE(request_types().Equals(progress_types));
+ EXPECT_TRUE(enabled_types().Equals(progress_types));
}
TEST_F(GetUpdatesProcessorTest, PollTest) {
@@ -188,7 +198,7 @@ TEST_F(GetUpdatesProcessorTest, PollTest) {
PollGetUpdatesDelegate poll_delegate;
scoped_ptr<GetUpdatesProcessor> processor(
BuildGetUpdatesProcessor(poll_delegate));
- processor->PrepareGetUpdates(request_types(), &message);
+ processor->PrepareGetUpdates(enabled_types(), &message);
const sync_pb::GetUpdatesMessage& gu_msg = message.get_updates();
EXPECT_EQ(sync_pb::SyncEnums::PERIODIC, gu_msg.get_updates_origin());
@@ -201,7 +211,7 @@ TEST_F(GetUpdatesProcessorTest, PollTest) {
gu_msg.from_progress_marker(i).data_type_id());
progress_types.Put(type);
}
- EXPECT_TRUE(request_types().Equals(progress_types));
+ EXPECT_TRUE(enabled_types().Equals(progress_types));
}
TEST_F(GetUpdatesProcessorTest, RetryTest) {
@@ -218,7 +228,7 @@ TEST_F(GetUpdatesProcessorTest, RetryTest) {
NormalGetUpdatesDelegate normal_delegate(nudge_tracker);
scoped_ptr<GetUpdatesProcessor> processor(
BuildGetUpdatesProcessor(normal_delegate));
- processor->PrepareGetUpdates(request_types(), &message);
+ processor->PrepareGetUpdates(enabled_types(), &message);
const sync_pb::GetUpdatesMessage& gu_msg = message.get_updates();
EXPECT_EQ(sync_pb::SyncEnums::RETRY, gu_msg.get_updates_origin());
@@ -232,7 +242,7 @@ TEST_F(GetUpdatesProcessorTest, RetryTest) {
gu_msg.from_progress_marker(i).data_type_id());
progress_types.Put(type);
}
- EXPECT_TRUE(request_types().Equals(progress_types));
+ EXPECT_TRUE(enabled_types().Equals(progress_types));
}
TEST_F(GetUpdatesProcessorTest, NudgeWithRetryTest) {
@@ -252,7 +262,7 @@ TEST_F(GetUpdatesProcessorTest, NudgeWithRetryTest) {
NormalGetUpdatesDelegate normal_delegate(nudge_tracker);
scoped_ptr<GetUpdatesProcessor> processor(
BuildGetUpdatesProcessor(normal_delegate));
- processor->PrepareGetUpdates(request_types(), &message);
+ processor->PrepareGetUpdates(enabled_types(), &message);
const sync_pb::GetUpdatesMessage& gu_msg = message.get_updates();
EXPECT_NE(sync_pb::SyncEnums::RETRY, gu_msg.get_updates_origin());
@@ -277,7 +287,7 @@ TEST_F(GetUpdatesProcessorTest, InvalidResponse) {
scoped_ptr<GetUpdatesProcessor> processor(
BuildGetUpdatesProcessor(normal_delegate));
SyncerError error = processor->ProcessResponse(gu_response,
- request_types(),
+ enabled_types(),
&status);
EXPECT_EQ(error, SERVER_RESPONSE_VALIDATION_FAILED);
}
@@ -294,7 +304,7 @@ TEST_F(GetUpdatesProcessorTest, MoreToDownloadResponse) {
scoped_ptr<GetUpdatesProcessor> processor(
BuildGetUpdatesProcessor(normal_delegate));
SyncerError error = processor->ProcessResponse(gu_response,
- request_types(),
+ enabled_types(),
&status);
EXPECT_EQ(error, SERVER_MORE_TO_DOWNLOAD);
}
@@ -311,11 +321,104 @@ TEST_F(GetUpdatesProcessorTest, NormalResponseTest) {
scoped_ptr<GetUpdatesProcessor> processor(
BuildGetUpdatesProcessor(normal_delegate));
SyncerError error = processor->ProcessResponse(gu_response,
- request_types(),
+ enabled_types(),
&status);
EXPECT_EQ(error, SYNCER_OK);
}
+// Variant of GetUpdatesProcessor test designed to test update application.
+//
+// Maintains two enabled types, but requests that updates be applied for only
+// one of them.
+class GetUpdatesProcessorApplyUpdatesTest : public GetUpdatesProcessorTest {
+ public:
+ GetUpdatesProcessorApplyUpdatesTest() {}
+ virtual ~GetUpdatesProcessorApplyUpdatesTest() {}
+
+ virtual void SetUp() OVERRIDE {
+ bookmarks_handler_ = AddUpdateHandler(BOOKMARKS);
+ autofill_handler_ = AddUpdateHandler(AUTOFILL);
+ }
+
+ ModelTypeSet GetGuTypes() {
+ return ModelTypeSet(AUTOFILL);
+ }
+
+ MockUpdateHandler* GetNonAppliedHandler() {
+ return bookmarks_handler_;
+ }
+
+ MockUpdateHandler* GetAppliedHandler() {
+ return autofill_handler_;
+ }
+
+ private:
+ MockUpdateHandler* bookmarks_handler_;
+ MockUpdateHandler* autofill_handler_;
+};
+
+// Verify that a normal cycle applies updates non-passively to the specified
+// types.
+TEST_F(GetUpdatesProcessorApplyUpdatesTest, Normal) {
+ sessions::NudgeTracker nudge_tracker;
+ NormalGetUpdatesDelegate normal_delegate(nudge_tracker);
+ scoped_ptr<GetUpdatesProcessor> processor(
+ BuildGetUpdatesProcessor(normal_delegate));
+
+ EXPECT_EQ(0, GetNonAppliedHandler()->GetApplyUpdatesCount());
+ EXPECT_EQ(0, GetAppliedHandler()->GetApplyUpdatesCount());
+
+ sessions::StatusController status;
+ processor->ApplyUpdates(GetGuTypes(), &status);
+
+ EXPECT_EQ(0, GetNonAppliedHandler()->GetApplyUpdatesCount());
+ EXPECT_EQ(1, GetAppliedHandler()->GetApplyUpdatesCount());
+
+ EXPECT_EQ(0, GetNonAppliedHandler()->GetPassiveApplyUpdatesCount());
+ EXPECT_EQ(0, GetAppliedHandler()->GetPassiveApplyUpdatesCount());
+}
+
+// Verify that a configure cycle applies updates passively to the specified
+// types.
+TEST_F(GetUpdatesProcessorApplyUpdatesTest, Configure) {
+ ConfigureGetUpdatesDelegate configure_delegate(
+ sync_pb::GetUpdatesCallerInfo::RECONFIGURATION);
+ scoped_ptr<GetUpdatesProcessor> processor(
+ BuildGetUpdatesProcessor(configure_delegate));
+
+ EXPECT_EQ(0, GetNonAppliedHandler()->GetPassiveApplyUpdatesCount());
+ EXPECT_EQ(0, GetAppliedHandler()->GetPassiveApplyUpdatesCount());
+
+ sessions::StatusController status;
+ processor->ApplyUpdates(GetGuTypes(), &status);
+
+ EXPECT_EQ(0, GetNonAppliedHandler()->GetPassiveApplyUpdatesCount());
+ EXPECT_EQ(1, GetAppliedHandler()->GetPassiveApplyUpdatesCount());
+
+ EXPECT_EQ(0, GetNonAppliedHandler()->GetApplyUpdatesCount());
+ EXPECT_EQ(0, GetAppliedHandler()->GetApplyUpdatesCount());
+}
+
+// Verify that a poll cycle applies updates non-passively to the specified
+// types.
+TEST_F(GetUpdatesProcessorApplyUpdatesTest, Poll) {
+ PollGetUpdatesDelegate poll_delegate;
+ scoped_ptr<GetUpdatesProcessor> processor(
+ BuildGetUpdatesProcessor(poll_delegate));
+
+ EXPECT_EQ(0, GetNonAppliedHandler()->GetApplyUpdatesCount());
+ EXPECT_EQ(0, GetAppliedHandler()->GetApplyUpdatesCount());
+
+ sessions::StatusController status;
+ processor->ApplyUpdates(GetGuTypes(), &status);
+
+ EXPECT_EQ(0, GetNonAppliedHandler()->GetApplyUpdatesCount());
+ EXPECT_EQ(1, GetAppliedHandler()->GetApplyUpdatesCount());
+
+ EXPECT_EQ(0, GetNonAppliedHandler()->GetPassiveApplyUpdatesCount());
+ EXPECT_EQ(0, GetAppliedHandler()->GetPassiveApplyUpdatesCount());
+}
+
class DownloadUpdatesDebugInfoTest : public ::testing::Test {
public:
DownloadUpdatesDebugInfoTest() {}
@@ -338,7 +441,6 @@ class DownloadUpdatesDebugInfoTest : public ::testing::Test {
MockDebugInfoGetter debug_info_getter_;
};
-
// Verify CopyClientDebugInfo when there are no events to upload.
TEST_F(DownloadUpdatesDebugInfoTest, VerifyCopyClientDebugInfo_Empty) {
sync_pb::DebugInfo debug_info;
diff --git a/sync/engine/sync_scheduler_impl.cc b/sync/engine/sync_scheduler_impl.cc
index 2240cd6..b2774e7 100644
--- a/sync/engine/sync_scheduler_impl.cc
+++ b/sync/engine/sync_scheduler_impl.cc
@@ -504,7 +504,7 @@ void SyncSchedulerImpl::DoConfigurationSyncSessionJob(JobPriority priority) {
<< ModelTypeSetToString(session_context_->GetEnabledTypes());
scoped_ptr<SyncSession> session(SyncSession::Build(session_context_, this));
bool premature_exit = !syncer_->ConfigureSyncShare(
- session_context_->GetEnabledTypes(),
+ pending_configure_params_->types_to_download,
pending_configure_params_->source,
session.get());
AdjustPolling(FORCE_RESET);
diff --git a/sync/engine/syncer.cc b/sync/engine/syncer.cc
index 508a2d9..a9f1ece 100644
--- a/sync/engine/syncer.cc
+++ b/sync/engine/syncer.cc
@@ -146,7 +146,8 @@ bool Syncer::DownloadAndApplyUpdates(
// Apply upates to the other types. May or may not involve cross-thread
// traffic, depending on the underlying update handlers and the GU type's
// delegate.
- get_updates_processor->ApplyUpdates(session->mutable_status_controller());
+ get_updates_processor->ApplyUpdates(request_types,
+ session->mutable_status_controller());
session->context()->set_hierarchy_conflict_detected(
session->status_controller().num_hierarchy_conflicts() > 0);
diff --git a/sync/test/engine/mock_update_handler.cc b/sync/test/engine/mock_update_handler.cc
index 41c6d29..098086e 100644
--- a/sync/test/engine/mock_update_handler.cc
+++ b/sync/test/engine/mock_update_handler.cc
@@ -8,7 +8,9 @@
namespace syncer {
-MockUpdateHandler::MockUpdateHandler(ModelType type) {
+MockUpdateHandler::MockUpdateHandler(ModelType type)
+ : apply_updates_count_(0),
+ passive_apply_updates_count_(0) {
progress_marker_.set_data_type_id(GetSpecificsFieldNumberFromModelType(type));
const std::string& token_str =
std::string("Mock token: ") + std::string(ModelTypeToString(type));
@@ -29,9 +31,21 @@ void MockUpdateHandler::ProcessGetUpdatesResponse(
progress_marker_.CopyFrom(progress_marker);
}
-void MockUpdateHandler::ApplyUpdates(sessions::StatusController* status) {}
+void MockUpdateHandler::ApplyUpdates(sessions::StatusController* status) {
+ apply_updates_count_++;
+}
void MockUpdateHandler::PassiveApplyUpdates(
- sessions::StatusController* status) {}
+ sessions::StatusController* status) {
+ passive_apply_updates_count_++;
+}
+
+int MockUpdateHandler::GetApplyUpdatesCount() {
+ return apply_updates_count_;
+}
+
+int MockUpdateHandler::GetPassiveApplyUpdatesCount() {
+ return passive_apply_updates_count_;
+}
} // namespace syncer
diff --git a/sync/test/engine/mock_update_handler.h b/sync/test/engine/mock_update_handler.h
index 7ee0c37..8d11f96 100644
--- a/sync/test/engine/mock_update_handler.h
+++ b/sync/test/engine/mock_update_handler.h
@@ -27,8 +27,17 @@ class MockUpdateHandler : public UpdateHandler {
virtual void ApplyUpdates(sessions::StatusController* status) OVERRIDE;
virtual void PassiveApplyUpdates(sessions::StatusController* status) OVERRIDE;
+ // Returns the number of times ApplyUpdates() was invoked.
+ int GetApplyUpdatesCount();
+
+ // Returns the number of times PassiveApplyUpdates() was invoked.
+ int GetPassiveApplyUpdatesCount();
+
private:
sync_pb::DataTypeProgressMarker progress_marker_;
+
+ int apply_updates_count_;
+ int passive_apply_updates_count_;
};
} // namespace syncer