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

Unified Diff: sync/engine/sync_scheduler_unittest.cc

Issue 10541079: [Sync] Remove CleanupDisabledTypes command and move purge logic into SyncManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 8 years, 5 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/sync_scheduler_impl.cc ('k') | sync/engine/syncer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/sync_scheduler_unittest.cc
diff --git a/sync/engine/sync_scheduler_unittest.cc b/sync/engine/sync_scheduler_unittest.cc
index ff4787bd57727dd40fb4868462fcbd9a9567f84d..8072566787373947b620fd52c1936ca9315b965f 100644
--- a/sync/engine/sync_scheduler_unittest.cc
+++ b/sync/engine/sync_scheduler_unittest.cc
@@ -300,9 +300,7 @@ TEST_F(SyncSchedulerTest, Config) {
SyncShareRecords records;
const ModelTypeSet model_types(BOOKMARKS);
- EXPECT_CALL(*syncer(),
- SyncShare(_,_,_))
- .WillOnce(Invoke(sessions::test_util::SimulateSuccess))
+ EXPECT_CALL(*syncer(), SyncShare(_,_,_))
.WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess),
WithArg<0>(RecordSyncShare(&records))));
@@ -333,9 +331,7 @@ TEST_F(SyncSchedulerTest, ConfigWithBackingOff) {
SyncShareRecords records;
const ModelTypeSet model_types(BOOKMARKS);
- EXPECT_CALL(*syncer(),
- SyncShare(_,_,_))
- .WillOnce(Invoke(sessions::test_util::SimulateSuccess))
+ EXPECT_CALL(*syncer(), SyncShare(_,_,_))
.WillOnce(DoAll(Invoke(sessions::test_util::SimulateCommitFailed),
WithArg<0>(RecordSyncShare(&records))))
.WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess),
@@ -709,19 +705,14 @@ TEST_F(SyncSchedulerTest, HasMoreToSyncThenFails) {
EXPECT_TRUE(RunAndGetBackoff());
}
-// Test that no syncing occurs when throttled (although CleanupDisabledTypes
-// is allowed).
+// Test that no syncing occurs when throttled.
TEST_F(SyncSchedulerTest, ThrottlingDoesThrottle) {
const ModelTypeSet types(BOOKMARKS);
TimeDelta poll(TimeDelta::FromMilliseconds(5));
TimeDelta throttle(TimeDelta::FromMinutes(10));
scheduler()->OnReceivedLongPollIntervalUpdate(poll);
- EXPECT_CALL(*syncer(),
- SyncShare(_, CLEANUP_DISABLED_TYPES, CLEANUP_DISABLED_TYPES))
- .WillOnce(Invoke(sessions::test_util::SimulateSuccess));
- EXPECT_CALL(*syncer(), SyncShare(_,Not(CLEANUP_DISABLED_TYPES),
- Not(CLEANUP_DISABLED_TYPES)))
+ EXPECT_CALL(*syncer(), SyncShare(_,_,_))
.WillOnce(WithArg<0>(sessions::test_util::SimulateThrottled(throttle)))
.WillRepeatedly(AddFailureAndQuitLoopNow());
@@ -774,7 +765,6 @@ TEST_F(SyncSchedulerTest, ConfigurationMode) {
SyncShareRecords records;
scheduler()->OnReceivedLongPollIntervalUpdate(poll);
EXPECT_CALL(*syncer(), SyncShare(_,_,_))
- .WillOnce(Invoke(sessions::test_util::SimulateSuccess))
.WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess),
WithArg<0>(RecordSyncShare(&records))));
@@ -899,10 +889,6 @@ TEST_F(SyncSchedulerTest, BackoffDropsJobs) {
EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
r.snapshots[1].source().updates_source);
- // 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);
@@ -1076,10 +1062,7 @@ TEST_F(SyncSchedulerTest, SyncerSteps) {
StopSyncScheduler();
Mock::VerifyAndClearExpectations(syncer());
- // Configuration (always includes a cleanup disabled types).
- EXPECT_CALL(*syncer(),
- SyncShare(_, CLEANUP_DISABLED_TYPES, CLEANUP_DISABLED_TYPES))
- .WillOnce(Invoke(sessions::test_util::SimulateSuccess));
+ // Configuration.
EXPECT_CALL(*syncer(), SyncShare(_, DOWNLOAD_UPDATES, APPLY_UPDATES))
.WillOnce(Invoke(sessions::test_util::SimulateSuccess));
StartSyncScheduler(SyncScheduler::CONFIGURATION_MODE);
@@ -1098,25 +1081,6 @@ TEST_F(SyncSchedulerTest, SyncerSteps) {
StopSyncScheduler();
Mock::VerifyAndClearExpectations(syncer());
- // Cleanup disabled types. Because no types are being configured, we just
- // perform the cleanup.
- EXPECT_CALL(*syncer(),
- SyncShare(_, CLEANUP_DISABLED_TYPES, CLEANUP_DISABLED_TYPES)).
- WillOnce(Invoke(sessions::test_util::SimulateSuccess));
- StartSyncScheduler(SyncScheduler::CONFIGURATION_MODE);
-
- CallbackCounter counter2;
- ConfigurationParams params2(
- GetUpdatesCallerInfo::RECONFIGURATION,
- ModelTypeSet(),
- ModelSafeRoutingInfo(),
- ConfigurationParams::KEYSTORE_KEY_UNNECESSARY,
- base::Bind(&CallbackCounter::Callback, base::Unretained(&counter2)));
- ASSERT_TRUE(scheduler()->ScheduleConfiguration(params2));
- ASSERT_EQ(1, counter2.times_called());
- StopSyncScheduler();
- Mock::VerifyAndClearExpectations(syncer());
-
StartSyncScheduler(SyncScheduler::NORMAL_MODE);
// Poll.
@@ -1162,24 +1126,4 @@ TEST_F(SyncSchedulerTest, StartWhenNotConnected) {
MessageLoop::current()->RunAllPending();
}
-TEST_F(SyncSchedulerTest, SetsPreviousRoutingInfo) {
- ModelSafeRoutingInfo info;
- EXPECT_TRUE(info == context()->previous_session_routing_info());
- ModelSafeRoutingInfo expected(context()->routing_info());
- ASSERT_FALSE(expected.empty());
- EXPECT_CALL(*syncer(), SyncShare(_,_,_)).Times(1);
-
- StartSyncScheduler(SyncScheduler::NORMAL_MODE);
-
- scheduler()->ScheduleNudgeAsync(
- zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(), FROM_HERE);
- PumpLoop();
- // Pump again to run job.
- PumpLoop();
-
- StopSyncScheduler();
-
- EXPECT_TRUE(expected == context()->previous_session_routing_info());
-}
-
} // namespace syncer
« no previous file with comments | « sync/engine/sync_scheduler_impl.cc ('k') | sync/engine/syncer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698