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

Unified Diff: sync/engine/sync_scheduler_unittest.cc

Issue 10537032: [Sync] Fix sync scheduler/session logic determining successful commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename method Created 8 years, 6 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/sync_scheduler_unittest.cc
diff --git a/sync/engine/sync_scheduler_unittest.cc b/sync/engine/sync_scheduler_unittest.cc
index 8028b436521bbedac72ad6918c8bb802a9022759..522399f1db3972a64b3244fe66228ca6ef67c4f6 100644
--- a/sync/engine/sync_scheduler_unittest.cc
+++ b/sync/engine/sync_scheduler_unittest.cc
@@ -862,7 +862,7 @@ TEST_F(SyncSchedulerTest, BackoffDropsJobs) {
EXPECT_CALL(*syncer(), SyncShare(_,_,_)).Times(1)
.WillRepeatedly(DoAll(Invoke(sessions::test_util::SimulateCommitFailed),
- RecordSyncShareMultiple(&r, 1U)));
+ RecordSyncShareMultiple(&r, 1U)));
EXPECT_CALL(*delay(), GetDelay(_)).
WillRepeatedly(Return(TimeDelta::FromDays(1)));
@@ -881,7 +881,7 @@ TEST_F(SyncSchedulerTest, BackoffDropsJobs) {
EXPECT_CALL(*syncer(), SyncShare(_,_,_)).Times(1)
.WillOnce(DoAll(Invoke(sessions::test_util::SimulateCommitFailed),
- RecordSyncShare(&r)));
+ RecordSyncShare(&r)));
// We schedule a nudge with enough delay (10X poll interval) that at least
// one or two polls would have taken place. The nudge should succeed.
@@ -894,12 +894,16 @@ TEST_F(SyncSchedulerTest, BackoffDropsJobs) {
EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
r.snapshots[1].source().updates_source);
- EXPECT_CALL(*syncer(), SyncShare(_,_,_)).Times(0);
+ // Cleanup is not affected by backoff, but it should not relieve it either.
+ EXPECT_CALL(*syncer(),
+ SyncShare(_, CLEANUP_DISABLED_TYPES, CLEANUP_DISABLED_TYPES))
+ .WillOnce(Invoke(sessions::test_util::SimulateSuccess));
EXPECT_CALL(*delay(), GetDelay(_)).Times(0);
StartSyncScheduler(SyncScheduler::CONFIGURATION_MODE);
RunLoop();
+ scheduler()->ScheduleCleanupDisabledTypes();
scheduler()->ScheduleConfig(
types, GetUpdatesCallerInfo::RECONFIGURATION);
PumpLoop();
@@ -1053,7 +1057,7 @@ TEST_F(SyncSchedulerTest, GetRecommendedDelay) {
TEST_F(SyncSchedulerTest, SyncerSteps) {
// Nudges.
EXPECT_CALL(*syncer(), SyncShare(_, SYNCER_BEGIN, SYNCER_END))
- .Times(1);
+ .WillOnce(Invoke(sessions::test_util::SimulateSuccess));
StartSyncScheduler(SyncScheduler::NORMAL_MODE);
RunLoop();
@@ -1068,7 +1072,7 @@ TEST_F(SyncSchedulerTest, SyncerSteps) {
// ClearUserData.
EXPECT_CALL(*syncer(), SyncShare(_, CLEAR_PRIVATE_DATA, CLEAR_PRIVATE_DATA))
- .Times(1);
+ .WillOnce(Invoke(sessions::test_util::SimulateSuccess));
StartSyncScheduler(SyncScheduler::NORMAL_MODE);
RunLoop();
@@ -1080,7 +1084,8 @@ TEST_F(SyncSchedulerTest, SyncerSteps) {
Mock::VerifyAndClearExpectations(syncer());
// Configuration.
- EXPECT_CALL(*syncer(), SyncShare(_, DOWNLOAD_UPDATES, APPLY_UPDATES));
+ EXPECT_CALL(*syncer(), SyncShare(_, DOWNLOAD_UPDATES, APPLY_UPDATES))
+ .WillOnce(Invoke(sessions::test_util::SimulateSuccess));
StartSyncScheduler(SyncScheduler::CONFIGURATION_MODE);
RunLoop();
@@ -1094,7 +1099,8 @@ TEST_F(SyncSchedulerTest, SyncerSteps) {
// Cleanup disabled types.
EXPECT_CALL(*syncer(),
- SyncShare(_, CLEANUP_DISABLED_TYPES, CLEANUP_DISABLED_TYPES));
+ SyncShare(_, CLEANUP_DISABLED_TYPES, CLEANUP_DISABLED_TYPES))
+ .WillOnce(Invoke(sessions::test_util::SimulateSuccess));
StartSyncScheduler(SyncScheduler::NORMAL_MODE);
RunLoop();
@@ -1109,7 +1115,8 @@ TEST_F(SyncSchedulerTest, SyncerSteps) {
// Poll.
EXPECT_CALL(*syncer(), SyncShare(_, SYNCER_BEGIN, SYNCER_END))
.Times(AtLeast(1))
- .WillRepeatedly(QuitLoopNowAction());
+ .WillRepeatedly(DoAll(Invoke(sessions::test_util::SimulateSuccess),
+ QuitLoopNowAction()));
const TimeDelta poll(TimeDelta::FromMilliseconds(10));
scheduler()->OnReceivedLongPollIntervalUpdate(poll);

Powered by Google App Engine
This is Rietveld 408576698