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

Unified Diff: sync/engine/process_commit_response_command_unittest.cc

Issue 10916174: Implement a bag of chips for sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: sync/engine/process_commit_response_command_unittest.cc
diff --git a/sync/engine/process_commit_response_command_unittest.cc b/sync/engine/process_commit_response_command_unittest.cc
index 482036d7b1815e9fc6b866b2dc2a9457f6879481..07cf107bc9026826442d389af8115d809867da37 100644
--- a/sync/engine/process_commit_response_command_unittest.cc
+++ b/sync/engine/process_commit_response_command_unittest.cc
@@ -378,6 +378,28 @@ TEST_F(ProcessCommitResponseCommandTest, NewFolderCommitKeepsChildOrder) {
<< "Too few or too many children in parent folder after commit.";
}
+TEST_F(ProcessCommitResponseCommandTest, BagOfChipsPersistence) {
+ sessions::OrderedCommitSet commit_set(session()->routing_info());
+ sync_pb::ClientToServerMessage request;
+ sync_pb::ClientToServerResponse& response =
Nicolas Zea 2012/09/07 18:38:43 nit: make pointer (references should always be con
qsr 2012/09/10 08:12:37 Done.
+ const_cast<sync_pb::ClientToServerResponse&>(
+ session()->status_controller().updates_response());
Nicolas Zea 2012/09/07 18:38:43 use mutable_updates_response() instead of const_ca
qsr 2012/09/10 08:12:37 Problem is that status_controller is a const metho
+
+ sync_pb::ClientToServerResponse random_message;
+ random_message.set_error_message("hello");
+ random_message.set_store_birthday("world");
+ std::string serialized_message;
+ random_message.SerializeToString(&serialized_message);
+ // Bag Of Chips must be allowed to be extended by the server without the
+ // client noticing. Using a random message for it is a way to check that it is
+ // possible.
+ response.mutable_new_bag_of_chips()->ParseFromString(serialized_message);
+
+ ProcessCommitResponseCommand command(commit_set, request, response);
+ command.ExecuteImpl(session());
+ EXPECT_EQ(serialized_message, directory()->bag_of_chips());
+}
+
// This test fixture runs across a Cartesian product of per-type fail/success
// possibilities.
enum {

Powered by Google App Engine
This is Rietveld 408576698