| Index: sync/engine/sync_scheduler_unittest.cc
|
| diff --git a/sync/engine/sync_scheduler_unittest.cc b/sync/engine/sync_scheduler_unittest.cc
|
| index 560de05beecbc01594b65272334d4081cd49cc14..21e14306df0bbe20e0da607ab6f422a0f1c8207e 100644
|
| --- a/sync/engine/sync_scheduler_unittest.cc
|
| +++ b/sync/engine/sync_scheduler_unittest.cc
|
| @@ -87,6 +87,22 @@ ModelSafeRoutingInfo TypesToRoutingInfo(ModelTypeSet types) {
|
| return routes;
|
| }
|
|
|
| +// Compare a ModelTypeSet to a ModelTypeInvalidationMap, ignoring
|
| +// state values.
|
| +testing::AssertionResult ModelTypeSetMatchesInvalidationMap(
|
| + ModelTypeSet lhs, const ModelTypeInvalidationMap& rhs) {
|
| + ModelTypeSet rhs_set = ModelTypeInvalidationMapToSet(rhs);
|
| +
|
| + if (!rhs_set.Equals(rhs_set)) {
|
| + return testing::AssertionFailure()
|
| + << "ModelTypeSet: " << ModelTypeSetToString(lhs)
|
| + << " does not match ModelTypeInvalidationMap: "
|
| + << ModelTypeSetToString(rhs_set);
|
| + } else {
|
| + return testing::AssertionSuccess();
|
| + }
|
| +}
|
| +
|
| // Convenient to use in tests wishing to analyze SyncShare calls over time.
|
| static const size_t kMinNumSamples = 5;
|
| class SyncSchedulerTest : public testing::Test {
|
| @@ -196,8 +212,7 @@ class SyncSchedulerTest : public testing::Test {
|
| ModelTypeSet nudge_types(BOOKMARKS);
|
| StartSyncScheduler(SyncScheduler::NORMAL_MODE);
|
|
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, nudge_types, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), nudge_types, FROM_HERE);
|
| RunLoop();
|
|
|
| return scheduler()->IsBackingOff();
|
| @@ -208,22 +223,6 @@ class SyncSchedulerTest : public testing::Test {
|
| scheduler_->delay_provider_.reset(delay_);
|
| }
|
|
|
| - // Compare a ModelTypeSet to a ModelTypeInvalidationMap, ignoring
|
| - // state values.
|
| - bool CompareModelTypeSetToModelTypeInvalidationMap(
|
| - ModelTypeSet lhs,
|
| - const ModelTypeInvalidationMap& rhs) {
|
| - size_t count = 0;
|
| - for (ModelTypeInvalidationMap::const_iterator i = rhs.begin();
|
| - i != rhs.end(); ++i, ++count) {
|
| - if (!lhs.Has(i->first))
|
| - return false;
|
| - }
|
| - if (lhs.Size() != count)
|
| - return false;
|
| - return true;
|
| - }
|
| -
|
| SyncSessionContext* context() { return context_.get(); }
|
|
|
| private:
|
| @@ -290,13 +289,13 @@ TEST_F(SyncSchedulerTest, Nudge) {
|
|
|
| StartSyncScheduler(SyncScheduler::NORMAL_MODE);
|
|
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, model_types, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), model_types, FROM_HERE);
|
| RunLoop();
|
|
|
| ASSERT_EQ(1U, records.snapshots.size());
|
| - EXPECT_TRUE(CompareModelTypeSetToModelTypeInvalidationMap(model_types,
|
| - records.snapshots[0].source().types));
|
| + EXPECT_TRUE(ModelTypeSetMatchesInvalidationMap(
|
| + model_types,
|
| + records.snapshots[0].source().types));
|
| EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
|
| records.snapshots[0].source().updates_source);
|
|
|
| @@ -309,13 +308,13 @@ TEST_F(SyncSchedulerTest, Nudge) {
|
| EXPECT_CALL(*syncer(), SyncShare(_,_,_))
|
| .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess),
|
| WithArg<0>(RecordSyncShare(&records2))));
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, model_types, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), model_types, FROM_HERE);
|
| RunLoop();
|
|
|
| ASSERT_EQ(1U, records2.snapshots.size());
|
| - EXPECT_TRUE(CompareModelTypeSetToModelTypeInvalidationMap(model_types,
|
| - records2.snapshots[0].source().types));
|
| + EXPECT_TRUE(ModelTypeSetMatchesInvalidationMap(
|
| + model_types,
|
| + records2.snapshots[0].source().types));
|
| EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
|
| records2.snapshots[0].source().updates_source);
|
| }
|
| @@ -342,8 +341,9 @@ TEST_F(SyncSchedulerTest, Config) {
|
| ASSERT_EQ(1, counter.times_called());
|
|
|
| ASSERT_EQ(1U, records.snapshots.size());
|
| - EXPECT_TRUE(CompareModelTypeSetToModelTypeInvalidationMap(model_types,
|
| - records.snapshots[0].source().types));
|
| + EXPECT_TRUE(ModelTypeSetMatchesInvalidationMap(
|
| + model_types,
|
| + records.snapshots[0].source().types));
|
| EXPECT_EQ(GetUpdatesCallerInfo::RECONFIGURATION,
|
| records.snapshots[0].source().updates_source);
|
| }
|
| @@ -379,8 +379,9 @@ TEST_F(SyncSchedulerTest, ConfigWithBackingOff) {
|
|
|
| ASSERT_EQ(2U, records.snapshots.size());
|
| ASSERT_EQ(1, counter.times_called());
|
| - EXPECT_TRUE(CompareModelTypeSetToModelTypeInvalidationMap(model_types,
|
| - records.snapshots[1].source().types));
|
| + EXPECT_TRUE(ModelTypeSetMatchesInvalidationMap(
|
| + model_types,
|
| + records.snapshots[1].source().types));
|
| EXPECT_EQ(GetUpdatesCallerInfo::RECONFIGURATION,
|
| records.snapshots[1].source().updates_source);
|
| }
|
| @@ -417,8 +418,7 @@ TEST_F(SyncSchedulerTest, NudgeWithConfigWithBackingOff) {
|
| ASSERT_EQ(0, counter.times_called());
|
| ASSERT_EQ(1U, records.snapshots.size());
|
|
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, model_types, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), model_types, FROM_HERE);
|
| RunLoop();
|
| // Note that we're not RunLoop()ing for the NUDGE we just scheduled, but
|
| // for the first retry attempt from the config job (after
|
| @@ -438,13 +438,15 @@ TEST_F(SyncSchedulerTest, NudgeWithConfigWithBackingOff) {
|
|
|
| ASSERT_EQ(4U, records.snapshots.size());
|
|
|
| - EXPECT_TRUE(CompareModelTypeSetToModelTypeInvalidationMap(model_types,
|
| - records.snapshots[2].source().types));
|
| + EXPECT_TRUE(ModelTypeSetMatchesInvalidationMap(
|
| + model_types,
|
| + records.snapshots[2].source().types));
|
| EXPECT_EQ(GetUpdatesCallerInfo::RECONFIGURATION,
|
| records.snapshots[2].source().updates_source);
|
|
|
| - EXPECT_TRUE(CompareModelTypeSetToModelTypeInvalidationMap(model_types,
|
| - records.snapshots[3].source().types));
|
| + EXPECT_TRUE(ModelTypeSetMatchesInvalidationMap(
|
| + model_types,
|
| + records.snapshots[3].source().types));
|
| EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
|
| records.snapshots[3].source().updates_source);
|
|
|
| @@ -461,16 +463,15 @@ TEST_F(SyncSchedulerTest, NudgeCoalescing) {
|
| const ModelTypeSet types1(BOOKMARKS), types2(AUTOFILL), types3(THEMES);
|
| TimeDelta delay = zero();
|
| TimeTicks optimal_time = TimeTicks::Now() + delay;
|
| - scheduler()->ScheduleNudgeAsync(
|
| - delay, NUDGE_SOURCE_UNKNOWN, types1, FROM_HERE);
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, types2, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(delay, types1, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), types2, FROM_HERE);
|
| RunLoop();
|
|
|
| ASSERT_EQ(1U, r.snapshots.size());
|
| EXPECT_GE(r.times[0], optimal_time);
|
| - EXPECT_TRUE(CompareModelTypeSetToModelTypeInvalidationMap(
|
| - Union(types1, types2), r.snapshots[0].source().types));
|
| + EXPECT_TRUE(ModelTypeSetMatchesInvalidationMap(
|
| + Union(types1, types2),
|
| + r.snapshots[0].source().types));
|
| EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
|
| r.snapshots[0].source().updates_source);
|
|
|
| @@ -480,14 +481,14 @@ TEST_F(SyncSchedulerTest, NudgeCoalescing) {
|
| EXPECT_CALL(*syncer(), SyncShare(_,_,_))
|
| .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess),
|
| WithArg<0>(RecordSyncShare(&r2))));
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_NOTIFICATION, types3, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), types3, FROM_HERE);
|
| RunLoop();
|
|
|
| ASSERT_EQ(1U, r2.snapshots.size());
|
| - EXPECT_TRUE(CompareModelTypeSetToModelTypeInvalidationMap(types3,
|
| - r2.snapshots[0].source().types));
|
| - EXPECT_EQ(GetUpdatesCallerInfo::NOTIFICATION,
|
| + EXPECT_TRUE(ModelTypeSetMatchesInvalidationMap(
|
| + types3,
|
| + r2.snapshots[0].source().types));
|
| + EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
|
| r2.snapshots[0].source().updates_source);
|
| }
|
|
|
| @@ -504,11 +505,8 @@ TEST_F(SyncSchedulerTest, NudgeCoalescingWithDifferentTimings) {
|
| // Create a huge time delay.
|
| TimeDelta delay = TimeDelta::FromDays(1);
|
|
|
| - scheduler()->ScheduleNudgeAsync(
|
| - delay, NUDGE_SOURCE_UNKNOWN, types1, FROM_HERE);
|
| -
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_UNKNOWN, types2, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(delay, types1, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), types2, FROM_HERE);
|
|
|
| TimeTicks min_time = TimeTicks::Now();
|
| TimeTicks max_time = TimeTicks::Now() + delay;
|
| @@ -517,8 +515,9 @@ TEST_F(SyncSchedulerTest, NudgeCoalescingWithDifferentTimings) {
|
|
|
| // Make sure the sync has happened.
|
| ASSERT_EQ(1U, r.snapshots.size());
|
| - EXPECT_TRUE(CompareModelTypeSetToModelTypeInvalidationMap(
|
| - Union(types1, types2), r.snapshots[0].source().types));
|
| + EXPECT_TRUE(ModelTypeSetMatchesInvalidationMap(
|
| + Union(types1, types2),
|
| + r.snapshots[0].source().types));
|
|
|
| // Make sure the sync happened at the right time.
|
| EXPECT_GE(r.times[0], min_time);
|
| @@ -538,13 +537,12 @@ TEST_F(SyncSchedulerTest, NudgeWithStates) {
|
| .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess),
|
| WithArg<0>(RecordSyncShare(&records))))
|
| .RetiresOnSaturation();
|
| - scheduler()->ScheduleNudgeWithStatesAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, invalidation_map, FROM_HERE);
|
| + scheduler()->ScheduleInvalidationNudge(zero(), invalidation_map, FROM_HERE);
|
| RunLoop();
|
|
|
| ASSERT_EQ(1U, records.snapshots.size());
|
| EXPECT_THAT(invalidation_map, Eq(records.snapshots[0].source().types));
|
| - EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
|
| + EXPECT_EQ(GetUpdatesCallerInfo::NOTIFICATION,
|
| records.snapshots[0].source().updates_source);
|
|
|
| Mock::VerifyAndClearExpectations(syncer());
|
| @@ -556,59 +554,13 @@ TEST_F(SyncSchedulerTest, NudgeWithStates) {
|
| EXPECT_CALL(*syncer(), SyncShare(_,_,_))
|
| .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess),
|
| WithArg<0>(RecordSyncShare(&records2))));
|
| - scheduler()->ScheduleNudgeWithStatesAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, invalidation_map, FROM_HERE);
|
| + scheduler()->ScheduleInvalidationNudge(zero(), invalidation_map, FROM_HERE);
|
| RunLoop();
|
|
|
| ASSERT_EQ(1U, records2.snapshots.size());
|
| EXPECT_THAT(invalidation_map, Eq(records2.snapshots[0].source().types));
|
| - EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
|
| - records2.snapshots[0].source().updates_source);
|
| -}
|
| -
|
| -// Test that nudges are coalesced.
|
| -TEST_F(SyncSchedulerTest, NudgeWithStatesCoalescing) {
|
| - StartSyncScheduler(SyncScheduler::NORMAL_MODE);
|
| -
|
| - SyncShareRecords r;
|
| - EXPECT_CALL(*syncer(), SyncShare(_,_,_))
|
| - .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess),
|
| - WithArg<0>(RecordSyncShare(&r))));
|
| - ModelTypeInvalidationMap types1, types2, types3;
|
| - types1[BOOKMARKS].payload = "test1";
|
| - types2[AUTOFILL].payload = "test2";
|
| - types3[THEMES].payload = "test3";
|
| - TimeDelta delay = zero();
|
| - TimeTicks optimal_time = TimeTicks::Now() + delay;
|
| - scheduler()->ScheduleNudgeWithStatesAsync(
|
| - delay, NUDGE_SOURCE_UNKNOWN, types1, FROM_HERE);
|
| - scheduler()->ScheduleNudgeWithStatesAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, types2, FROM_HERE);
|
| - RunLoop();
|
| -
|
| - ASSERT_EQ(1U, r.snapshots.size());
|
| - EXPECT_GE(r.times[0], optimal_time);
|
| - ModelTypeInvalidationMap coalesced_types;
|
| - CoalesceStates(types1, &coalesced_types);
|
| - CoalesceStates(types2, &coalesced_types);
|
| - EXPECT_THAT(coalesced_types, Eq(r.snapshots[0].source().types));
|
| - EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
|
| - r.snapshots[0].source().updates_source);
|
| -
|
| - Mock::VerifyAndClearExpectations(syncer());
|
| -
|
| - SyncShareRecords r2;
|
| - EXPECT_CALL(*syncer(), SyncShare(_,_,_))
|
| - .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess),
|
| - WithArg<0>(RecordSyncShare(&r2))));
|
| - scheduler()->ScheduleNudgeWithStatesAsync(
|
| - zero(), NUDGE_SOURCE_NOTIFICATION, types3, FROM_HERE);
|
| - RunLoop();
|
| -
|
| - ASSERT_EQ(1U, r2.snapshots.size());
|
| - EXPECT_THAT(types3, Eq(r2.snapshots[0].source().types));
|
| EXPECT_EQ(GetUpdatesCallerInfo::NOTIFICATION,
|
| - r2.snapshots[0].source().updates_source);
|
| + records2.snapshots[0].source().updates_source);
|
| }
|
|
|
| // Test that polling works as expected.
|
| @@ -699,8 +651,7 @@ TEST_F(SyncSchedulerTest, SessionsCommitDelay) {
|
|
|
| EXPECT_EQ(delay1, scheduler()->GetSessionsCommitDelay());
|
| const ModelTypeSet model_types(BOOKMARKS);
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, model_types, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), model_types, FROM_HERE);
|
| RunLoop();
|
|
|
| EXPECT_EQ(delay2, scheduler()->GetSessionsCommitDelay());
|
| @@ -722,8 +673,8 @@ TEST_F(SyncSchedulerTest, ThrottlingDoesThrottle) {
|
|
|
| StartSyncScheduler(SyncScheduler::NORMAL_MODE);
|
|
|
| - scheduler()->ScheduleNudgeAsync(
|
| - TimeDelta::FromMicroseconds(1), NUDGE_SOURCE_LOCAL, types, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(
|
| + TimeDelta::FromMicroseconds(1), types, FROM_HERE);
|
| PumpLoop();
|
|
|
| StartSyncScheduler(SyncScheduler::CONFIGURATION_MODE);
|
| @@ -782,8 +733,7 @@ TEST_F(SyncSchedulerTest, ThrottlingExpiresFromNudge) {
|
|
|
| const ModelTypeSet types(BOOKMARKS);
|
| StartSyncScheduler(SyncScheduler::NORMAL_MODE);
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, types, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), types, FROM_HERE);
|
|
|
| PumpLoop();
|
| EXPECT_TRUE(scheduler()->IsSyncingCurrentlySilenced());
|
| @@ -841,10 +791,8 @@ TEST_F(SyncSchedulerTest, ConfigurationMode) {
|
| StartSyncScheduler(SyncScheduler::CONFIGURATION_MODE);
|
|
|
| const ModelTypeSet nudge_types(AUTOFILL);
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, nudge_types, FROM_HERE);
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, nudge_types, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), nudge_types, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), nudge_types, FROM_HERE);
|
|
|
| const ModelTypeSet config_types(BOOKMARKS);
|
|
|
| @@ -858,8 +806,9 @@ TEST_F(SyncSchedulerTest, ConfigurationMode) {
|
| ASSERT_EQ(1, counter.times_called());
|
|
|
| ASSERT_EQ(1U, records.snapshots.size());
|
| - EXPECT_TRUE(CompareModelTypeSetToModelTypeInvalidationMap(config_types,
|
| - records.snapshots[0].source().types));
|
| + EXPECT_TRUE(ModelTypeSetMatchesInvalidationMap(
|
| + config_types,
|
| + records.snapshots[0].source().types));
|
|
|
| // Switch to NORMAL_MODE to ensure NUDGES were properly saved and run.
|
| // SyncSchedulerWhiteboxTest also provides coverage for this, but much
|
| @@ -878,8 +827,9 @@ TEST_F(SyncSchedulerTest, ConfigurationMode) {
|
| ASSERT_EQ(1U, records2.snapshots.size());
|
| EXPECT_EQ(GetUpdatesCallerInfo::LOCAL,
|
| records2.snapshots[0].source().updates_source);
|
| - EXPECT_TRUE(CompareModelTypeSetToModelTypeInvalidationMap(nudge_types,
|
| - records2.snapshots[0].source().types));
|
| + EXPECT_TRUE(ModelTypeSetMatchesInvalidationMap(
|
| + nudge_types,
|
| + records2.snapshots[0].source().types));
|
| PumpLoop();
|
| }
|
|
|
| @@ -974,7 +924,7 @@ TEST_F(SyncSchedulerTest, BackoffDropsJobs) {
|
|
|
| // This nudge should fail and put us into backoff. Thanks to our mock
|
| // GetDelay() setup above, this will be a long backoff.
|
| - scheduler()->ScheduleNudgeAsync(zero(), NUDGE_SOURCE_LOCAL, types, FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), types, FROM_HERE);
|
| RunLoop();
|
|
|
| Mock::VerifyAndClearExpectations(syncer());
|
| @@ -986,9 +936,8 @@ TEST_F(SyncSchedulerTest, BackoffDropsJobs) {
|
| PumpLoopFor(poll * 10);
|
|
|
| // Try (and fail) to schedule a nudge.
|
| - scheduler()->ScheduleNudgeAsync(
|
| + scheduler()->ScheduleLocalNudge(
|
| base::TimeDelta::FromMilliseconds(1),
|
| - NUDGE_SOURCE_LOCAL,
|
| types,
|
| FROM_HERE);
|
|
|
| @@ -1040,8 +989,7 @@ TEST_F(SyncSchedulerTest, BackoffElevation) {
|
| StartSyncScheduler(SyncScheduler::NORMAL_MODE);
|
|
|
| // Run again with a nudge.
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(BOOKMARKS), FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), ModelTypeSet(BOOKMARKS), FROM_HERE);
|
| RunLoop();
|
|
|
| ASSERT_EQ(kMinNumSamples, r.snapshots.size());
|
| @@ -1072,8 +1020,7 @@ TEST_F(SyncSchedulerTest, BackoffRelief) {
|
| StartSyncScheduler(SyncScheduler::NORMAL_MODE);
|
|
|
| // Run again to wait for polling.
|
| - scheduler()->ScheduleNudgeAsync(zero(), NUDGE_SOURCE_LOCAL,
|
| - ModelTypeSet(BOOKMARKS), FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), ModelTypeSet(BOOKMARKS), FROM_HERE);
|
| RunLoop();
|
|
|
| StopSyncScheduler();
|
| @@ -1134,8 +1081,7 @@ TEST_F(SyncSchedulerTest, SyncerSteps) {
|
| Return(true)));
|
| StartSyncScheduler(SyncScheduler::NORMAL_MODE);
|
|
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(BOOKMARKS), FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), ModelTypeSet(BOOKMARKS), FROM_HERE);
|
| PumpLoop();
|
| // Pump again to run job.
|
| PumpLoop();
|
| @@ -1193,8 +1139,7 @@ TEST_F(SyncSchedulerTest, StartWhenNotConnected) {
|
| Return(true)));
|
| StartSyncScheduler(SyncScheduler::NORMAL_MODE);
|
|
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(BOOKMARKS), FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), ModelTypeSet(BOOKMARKS), FROM_HERE);
|
| // Should save the nudge for until after the server is reachable.
|
| base::MessageLoop::current()->RunUntilIdle();
|
|
|
| @@ -1219,8 +1164,7 @@ TEST_F(SyncSchedulerTest, ServerConnectionChangeDuringBackoff) {
|
| .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess),
|
| Return(true)));
|
|
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(BOOKMARKS), FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), ModelTypeSet(BOOKMARKS), FROM_HERE);
|
|
|
| PumpLoop(); // Run the nudge, that will fail and schedule a quick retry.
|
| ASSERT_TRUE(scheduler()->IsBackingOff());
|
| @@ -1252,8 +1196,7 @@ TEST_F(SyncSchedulerTest, ConnectionChangeCanaryPreemptedByNudge) {
|
| .WillOnce(DoAll(Invoke(sessions::test_util::SimulateSuccess),
|
| QuitLoopNowAction()));
|
|
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(BOOKMARKS), FROM_HERE);
|
| + scheduler()->ScheduleLocalNudge(zero(), ModelTypeSet(BOOKMARKS), FROM_HERE);
|
|
|
| PumpLoop(); // Run the nudge, that will fail and schedule a quick retry.
|
| ASSERT_TRUE(scheduler()->IsBackingOff());
|
| @@ -1262,9 +1205,8 @@ TEST_F(SyncSchedulerTest, ConnectionChangeCanaryPreemptedByNudge) {
|
| scheduler()->OnConnectionStatusChange();
|
| connection()->SetServerReachable();
|
| connection()->UpdateConnectionStatus();
|
| - scheduler()->ScheduleNudgeAsync(
|
| - zero(), NUDGE_SOURCE_LOCAL, ModelTypeSet(BOOKMARKS), FROM_HERE);
|
| - base::MessageLoop::current()->RunUntilIdle();
|
| + scheduler()->ScheduleLocalNudge(zero(), ModelTypeSet(BOOKMARKS), FROM_HERE);
|
| + MessageLoop::current()->RunUntilIdle();
|
| }
|
|
|
| // Tests that we don't crash trying to run two canaries at once if we receive
|
|
|