| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 611 |
| 612 // Test that the short poll interval is used. | 612 // Test that the short poll interval is used. |
| 613 TEST_F(SyncSchedulerTest, PollNotificationsDisabled) { | 613 TEST_F(SyncSchedulerTest, PollNotificationsDisabled) { |
| 614 SyncShareRecords records; | 614 SyncShareRecords records; |
| 615 TimeDelta poll_interval(TimeDelta::FromMilliseconds(30)); | 615 TimeDelta poll_interval(TimeDelta::FromMilliseconds(30)); |
| 616 EXPECT_CALL(*syncer(), SyncShare(_,_,_)).Times(AtLeast(kMinNumSamples)) | 616 EXPECT_CALL(*syncer(), SyncShare(_,_,_)).Times(AtLeast(kMinNumSamples)) |
| 617 .WillRepeatedly(DoAll(Invoke(sessions::test_util::SimulateSuccess), | 617 .WillRepeatedly(DoAll(Invoke(sessions::test_util::SimulateSuccess), |
| 618 WithArg<0>(RecordSyncShareMultiple(&records, kMinNumSamples)))); | 618 WithArg<0>(RecordSyncShareMultiple(&records, kMinNumSamples)))); |
| 619 | 619 |
| 620 scheduler()->OnReceivedShortPollIntervalUpdate(poll_interval); | 620 scheduler()->OnReceivedShortPollIntervalUpdate(poll_interval); |
| 621 scheduler()->set_notifications_enabled(false); | 621 scheduler()->SetNotificationsEnabled(false); |
| 622 | 622 |
| 623 TimeTicks optimal_start = TimeTicks::Now() + poll_interval; | 623 TimeTicks optimal_start = TimeTicks::Now() + poll_interval; |
| 624 StartSyncScheduler(SyncScheduler::NORMAL_MODE); | 624 StartSyncScheduler(SyncScheduler::NORMAL_MODE); |
| 625 | 625 |
| 626 // Run again to wait for polling. | 626 // Run again to wait for polling. |
| 627 RunLoop(); | 627 RunLoop(); |
| 628 | 628 |
| 629 StopSyncScheduler(); | 629 StopSyncScheduler(); |
| 630 AnalyzePollRun(records, kMinNumSamples, optimal_start, poll_interval); | 630 AnalyzePollRun(records, kMinNumSamples, optimal_start, poll_interval); |
| 631 } | 631 } |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 PumpLoop(); | 1178 PumpLoop(); |
| 1179 // Pump again to run job. | 1179 // Pump again to run job. |
| 1180 PumpLoop(); | 1180 PumpLoop(); |
| 1181 | 1181 |
| 1182 StopSyncScheduler(); | 1182 StopSyncScheduler(); |
| 1183 | 1183 |
| 1184 EXPECT_TRUE(expected == context()->previous_session_routing_info()); | 1184 EXPECT_TRUE(expected == context()->previous_session_routing_info()); |
| 1185 } | 1185 } |
| 1186 | 1186 |
| 1187 } // namespace syncer | 1187 } // namespace syncer |
| OLD | NEW |