Commit 9423686e authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Fix ModelNeutralState counters for USS types

The counters must be updated analogously to how
DirectoryCommitContribution::ProcessCommitResponse() does it.

AFAIK, the bug affects tests and debug UIs only.

Bug: 836289
Change-Id: I91b519bda573133305f31524a0ecb328f7748a11
Reviewed-on: https://chromium-review.googlesource.com/1033872
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarPavel Yatsuk <pavely@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554716}
parent 7a059205
......@@ -320,9 +320,10 @@ class ModelTypeWorkerTest : public ::testing::Test {
void TriggerTypeRootUpdateFromServer() {
SyncEntity entity = server()->TypeRootUpdate();
worker()->ProcessGetUpdatesResponse(
server()->GetProgress(), server()->GetContext(), {&entity}, nullptr);
worker()->PassiveApplyUpdates(nullptr);
worker()->ProcessGetUpdatesResponse(server()->GetProgress(),
server()->GetContext(), {&entity},
&status_controller_);
worker()->PassiveApplyUpdates(&status_controller_);
}
void TriggerPartialUpdateFromServer(int64_t version_offset,
......@@ -336,15 +337,16 @@ class ModelTypeWorkerTest : public ::testing::Test {
entity.mutable_specifics());
}
worker()->ProcessGetUpdatesResponse(
server()->GetProgress(), server()->GetContext(), {&entity}, nullptr);
worker()->ProcessGetUpdatesResponse(server()->GetProgress(),
server()->GetContext(), {&entity},
&status_controller_);
}
void TriggerUpdateFromServer(int64_t version_offset,
const std::string& tag,
const std::string& value) {
TriggerPartialUpdateFromServer(version_offset, tag, value);
worker()->ApplyUpdates(nullptr);
worker()->ApplyUpdates(&status_controller_);
}
void TriggerTombstoneFromServer(int64_t version_offset,
......@@ -357,14 +359,15 @@ class ModelTypeWorkerTest : public ::testing::Test {
entity.mutable_specifics());
}
worker()->ProcessGetUpdatesResponse(
server()->GetProgress(), server()->GetContext(), {&entity}, nullptr);
worker()->ApplyUpdates(nullptr);
worker()->ProcessGetUpdatesResponse(server()->GetProgress(),
server()->GetContext(), {&entity},
&status_controller_);
worker()->ApplyUpdates(&status_controller_);
}
// Simulates the end of a GU sync cycle and tells the worker to flush changes
// to the processor.
void ApplyUpdates() { worker()->ApplyUpdates(nullptr); }
void ApplyUpdates() { worker()->ApplyUpdates(&status_controller_); }
// Delivers specified protos as updates.
//
......@@ -373,8 +376,9 @@ class ModelTypeWorkerTest : public ::testing::Test {
// protocol. Try to use the other, higher level methods if possible.
void DeliverRawUpdates(const SyncEntityList& list) {
worker()->ProcessGetUpdatesResponse(server()->GetProgress(),
server()->GetContext(), list, nullptr);
worker()->ApplyUpdates(nullptr);
server()->GetContext(), list,
&status_controller_);
worker()->ApplyUpdates(&status_controller_);
}
// By default, this harness behaves as if all tasks posted to the model
......@@ -419,7 +423,7 @@ class ModelTypeWorkerTest : public ::testing::Test {
sync_pb::ClientToServerResponse response =
server()->DoSuccessfulCommit(message);
contribution->ProcessCommitResponse(response, nullptr);
contribution->ProcessCommitResponse(response, &status_controller_);
contribution->CleanUp();
}
......@@ -487,6 +491,8 @@ class ModelTypeWorkerTest : public ::testing::Test {
base::ObserverList<TypeDebugInfoObserver> type_observers_;
std::unique_ptr<NonBlockingTypeDebugInfoEmitter> emitter_;
StatusController status_controller_;
};
// Requests a commit and verifies the messages sent to the client and server as
......
......@@ -90,6 +90,7 @@ SyncerError NonBlockingTypeCommitContribution::ProcessCommitResponse(
case sync_pb::CommitResponse::CONFLICT:
DVLOG(1) << "Server reports conflict for commit message.";
++conflicting_commits;
status->increment_num_server_conflicts();
break;
case sync_pb::CommitResponse::SUCCESS: {
++successes;
......@@ -101,6 +102,12 @@ SyncerError NonBlockingTypeCommitContribution::ProcessCommitResponse(
response_data.sequence_number = commit_request.sequence_number;
response_data.specifics_hash = commit_request.specifics_hash;
response_list.push_back(response_data);
status->increment_num_successful_commits();
if (commit_request.entity->specifics.has_bookmark()) {
status->increment_num_successful_bookmark_commits();
}
break;
}
case sync_pb::CommitResponse::OVER_QUOTA:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment