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

Unified Diff: sync/engine/syncer_unittest.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/engine/syncer_proto_util.cc ('k') | sync/test/engine/mock_connection_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/syncer_unittest.cc
diff --git a/sync/engine/syncer_unittest.cc b/sync/engine/syncer_unittest.cc
index 34ed1fd12fb6975e9e92d0ca11bfe78bc0937af7..60e5a27b96cfbee7558c8c144fc2d44ca9c84eb5 100644
--- a/sync/engine/syncer_unittest.cc
+++ b/sync/engine/syncer_unittest.cc
@@ -3341,14 +3341,15 @@ TEST_F(SyncerTest, DirectoryCommitTest) {
}
}
-TEST_F(SyncerTest, TestClientCommand) {
+TEST_F(SyncerTest, TestClientCommandDuringUpdate) {
using sync_pb::ClientCommand;
- ClientCommand* command = mock_server_->GetNextClientCommand();
+ ClientCommand* command = new ClientCommand();
command->set_set_sync_poll_interval(8);
command->set_set_sync_long_poll_interval(800);
command->set_sessions_commit_delay_seconds(3141);
mock_server_->AddUpdateDirectory(1, 0, "in_root", 1, 1);
+ mock_server_->SetGUClientCommand(command);
SyncShareNudge();
EXPECT_TRUE(TimeDelta::FromSeconds(8) ==
@@ -3358,11 +3359,46 @@ TEST_F(SyncerTest, TestClientCommand) {
EXPECT_TRUE(TimeDelta::FromSeconds(3141) ==
last_sessions_commit_delay_seconds_);
- command = mock_server_->GetNextClientCommand();
+ command = new ClientCommand();
command->set_set_sync_poll_interval(180);
command->set_set_sync_long_poll_interval(190);
command->set_sessions_commit_delay_seconds(2718);
mock_server_->AddUpdateDirectory(1, 0, "in_root", 1, 1);
+ mock_server_->SetGUClientCommand(command);
+ SyncShareNudge();
+
+ EXPECT_TRUE(TimeDelta::FromSeconds(180) ==
+ last_short_poll_interval_received_);
+ EXPECT_TRUE(TimeDelta::FromSeconds(190) ==
+ last_long_poll_interval_received_);
+ EXPECT_TRUE(TimeDelta::FromSeconds(2718) ==
+ last_sessions_commit_delay_seconds_);
+}
+
+TEST_F(SyncerTest, TestClientCommandDuringCommit) {
+ using sync_pb::ClientCommand;
+
+ ClientCommand* command = new ClientCommand();
+ command->set_set_sync_poll_interval(8);
+ command->set_set_sync_long_poll_interval(800);
+ command->set_sessions_commit_delay_seconds(3141);
+ CreateUnsyncedDirectory("X", "id_X");
+ mock_server_->SetCommitClientCommand(command);
+ SyncShareNudge();
+
+ EXPECT_TRUE(TimeDelta::FromSeconds(8) ==
+ last_short_poll_interval_received_);
+ EXPECT_TRUE(TimeDelta::FromSeconds(800) ==
+ last_long_poll_interval_received_);
+ EXPECT_TRUE(TimeDelta::FromSeconds(3141) ==
+ last_sessions_commit_delay_seconds_);
+
+ command = new ClientCommand();
+ command->set_set_sync_poll_interval(180);
+ command->set_set_sync_long_poll_interval(190);
+ command->set_sessions_commit_delay_seconds(2718);
+ CreateUnsyncedDirectory("Y", "id_Y");
+ mock_server_->SetCommitClientCommand(command);
SyncShareNudge();
EXPECT_TRUE(TimeDelta::FromSeconds(180) ==
« no previous file with comments | « sync/engine/syncer_proto_util.cc ('k') | sync/test/engine/mock_connection_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698