| 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/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 connection_.reset(new MockConnectionManager(directory(), | 134 connection_.reset(new MockConnectionManager(directory(), |
| 135 &cancelation_signal_)); | 135 &cancelation_signal_)); |
| 136 connection_->SetServerReachable(); | 136 connection_->SetServerReachable(); |
| 137 context_.reset(new SyncSessionContext( | 137 context_.reset(new SyncSessionContext( |
| 138 connection_.get(), directory(), workers, | 138 connection_.get(), directory(), workers, |
| 139 extensions_activity_.get(), | 139 extensions_activity_.get(), |
| 140 std::vector<SyncEngineEventListener*>(), NULL, NULL, | 140 std::vector<SyncEngineEventListener*>(), NULL, NULL, |
| 141 true, // enable keystore encryption | 141 true, // enable keystore encryption |
| 142 false, // force enable pre-commit GU avoidance | 142 false, // force enable pre-commit GU avoidance |
| 143 "fake_invalidator_client_id")); | 143 "fake_invalidator_client_id")); |
| 144 context_->set_routing_info(routing_info_); | 144 context_->SetRoutingInfo(routing_info_); |
| 145 context_->set_notifications_enabled(true); | 145 context_->set_notifications_enabled(true); |
| 146 context_->set_account_name("Test"); | 146 context_->set_account_name("Test"); |
| 147 scheduler_.reset( | 147 scheduler_.reset( |
| 148 new SyncSchedulerImpl("TestSyncScheduler", | 148 new SyncSchedulerImpl("TestSyncScheduler", |
| 149 BackoffDelayProvider::FromDefaults(), | 149 BackoffDelayProvider::FromDefaults(), |
| 150 context(), | 150 context(), |
| 151 syncer_)); | 151 syncer_)); |
| 152 } | 152 } |
| 153 | 153 |
| 154 SyncSchedulerImpl* scheduler() { return scheduler_.get(); } | 154 SyncSchedulerImpl* scheduler() { return scheduler_.get(); } |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 | 883 |
| 884 // Switch to NORMAL_MODE to ensure NUDGES were properly saved and run. | 884 // Switch to NORMAL_MODE to ensure NUDGES were properly saved and run. |
| 885 scheduler()->OnReceivedLongPollIntervalUpdate(TimeDelta::FromDays(1)); | 885 scheduler()->OnReceivedLongPollIntervalUpdate(TimeDelta::FromDays(1)); |
| 886 SyncShareTimes times2; | 886 SyncShareTimes times2; |
| 887 EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) | 887 EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) |
| 888 .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), | 888 .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), |
| 889 RecordSyncShare(×2))); | 889 RecordSyncShare(×2))); |
| 890 | 890 |
| 891 // TODO(tim): Figure out how to remove this dangerous need to reset | 891 // TODO(tim): Figure out how to remove this dangerous need to reset |
| 892 // routing info between mode switches. | 892 // routing info between mode switches. |
| 893 context()->set_routing_info(routing_info()); | 893 context()->SetRoutingInfo(routing_info()); |
| 894 StartSyncScheduler(SyncScheduler::NORMAL_MODE); | 894 StartSyncScheduler(SyncScheduler::NORMAL_MODE); |
| 895 | 895 |
| 896 RunLoop(); | 896 RunLoop(); |
| 897 Mock::VerifyAndClearExpectations(syncer()); | 897 Mock::VerifyAndClearExpectations(syncer()); |
| 898 } | 898 } |
| 899 | 899 |
| 900 class BackoffTriggersSyncSchedulerTest : public SyncSchedulerTest { | 900 class BackoffTriggersSyncSchedulerTest : public SyncSchedulerTest { |
| 901 virtual void SetUp() { | 901 virtual void SetUp() { |
| 902 SyncSchedulerTest::SetUp(); | 902 SyncSchedulerTest::SetUp(); |
| 903 UseMockDelayProvider(); | 903 UseMockDelayProvider(); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 EXPECT_CALL(*syncer(), PollSyncShare(_,_)) | 1290 EXPECT_CALL(*syncer(), PollSyncShare(_,_)) |
| 1291 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollSuccess), | 1291 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollSuccess), |
| 1292 RecordSyncShare(×))); | 1292 RecordSyncShare(×))); |
| 1293 scheduler()->OnCredentialsUpdated(); | 1293 scheduler()->OnCredentialsUpdated(); |
| 1294 connection()->SetServerStatus(HttpResponse::SERVER_CONNECTION_OK); | 1294 connection()->SetServerStatus(HttpResponse::SERVER_CONNECTION_OK); |
| 1295 RunLoop(); | 1295 RunLoop(); |
| 1296 StopSyncScheduler(); | 1296 StopSyncScheduler(); |
| 1297 } | 1297 } |
| 1298 | 1298 |
| 1299 } // namespace syncer | 1299 } // namespace syncer |
| OLD | NEW |