Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Unified Diff: sync/test/engine/mock_connection_manager.cc

Issue 10909160: sync: Process client commands on commit response (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Inline client command processing Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/test/engine/mock_connection_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/test/engine/mock_connection_manager.cc
diff --git a/sync/test/engine/mock_connection_manager.cc b/sync/test/engine/mock_connection_manager.cc
index 0d4041b26f148b3392941d9069998ae8b17ce866..8d03a10edb9c23a0d2dc7f608baafc9956e230d7 100644
--- a/sync/test/engine/mock_connection_manager.cc
+++ b/sync/test/engine/mock_connection_manager.cc
@@ -48,7 +48,8 @@ MockConnectionManager::MockConnectionManager(syncable::Directory* directory)
throttling_(false),
fail_with_auth_invalid_(false),
fail_non_periodic_get_updates_(false),
- client_command_(NULL),
+ gu_client_command_(NULL),
+ commit_client_command_(NULL),
next_position_in_parent_(2),
use_legacy_bookmarks_protocol_(false),
num_get_updates_requests_(0) {
@@ -143,9 +144,6 @@ bool MockConnectionManager::PostBufferToPath(PostBufferParams* params,
EXPECT_TRUE(false) << "Unknown/unsupported ClientToServerMessage";
return false;
}
- if (client_command_.get()) {
- response.mutable_client_command()->CopyFrom(*client_command_.get());
- }
{
base::AutoLock lock(response_code_override_lock_);
@@ -210,10 +208,14 @@ sync_pb::SyncEntity* MockConnectionManager::AddUpdateDirectory(
sync_ts);
}
-sync_pb::ClientCommand* MockConnectionManager::GetNextClientCommand() {
- if (!client_command_.get())
- client_command_.reset(new sync_pb::ClientCommand());
- return client_command_.get();
+void MockConnectionManager::SetGUClientCommand(
+ sync_pb::ClientCommand* command) {
+ gu_client_command_.reset(command);
+}
+
+void MockConnectionManager::SetCommitClientCommand(
+ sync_pb::ClientCommand* command) {
+ commit_client_command_.reset(command);
}
sync_pb::SyncEntity* MockConnectionManager::AddUpdateBookmark(
@@ -453,6 +455,10 @@ void MockConnectionManager::ProcessGetUpdates(
response->mutable_get_updates()->set_encryption_key(keystore_key_);
update_queue_.pop_front();
+
+ if (gu_client_command_.get()) {
+ response->mutable_client_command()->CopyFrom(*gu_client_command_.get());
+ }
}
void MockConnectionManager::SetKeystoreKey(const std::string& key) {
@@ -524,6 +530,11 @@ void MockConnectionManager::ProcessCommit(
}
}
commit_responses_.push_back(new CommitResponse(*commit_response));
+
+ if (commit_client_command_.get()) {
+ response_buffer->mutable_client_command()->CopyFrom(
+ *commit_client_command_.get());
+ }
}
sync_pb::SyncEntity* MockConnectionManager::AddUpdateDirectory(
« no previous file with comments | « sync/test/engine/mock_connection_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698