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

Side by Side Diff: sync/engine/sync_scheduler_unittest.cc

Issue 792343004: Standardize usage of virtual/override/final specifiers in sync/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 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 unified diff | Download patch
OLDNEW
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 class MockDelayProvider : public BackoffDelayProvider { 113 class MockDelayProvider : public BackoffDelayProvider {
114 public: 114 public:
115 MockDelayProvider() : BackoffDelayProvider( 115 MockDelayProvider() : BackoffDelayProvider(
116 TimeDelta::FromSeconds(kInitialBackoffRetrySeconds), 116 TimeDelta::FromSeconds(kInitialBackoffRetrySeconds),
117 TimeDelta::FromSeconds(kInitialBackoffImmediateRetrySeconds)) { 117 TimeDelta::FromSeconds(kInitialBackoffImmediateRetrySeconds)) {
118 } 118 }
119 119
120 MOCK_METHOD1(GetDelay, TimeDelta(const TimeDelta&)); 120 MOCK_METHOD1(GetDelay, TimeDelta(const TimeDelta&));
121 }; 121 };
122 122
123 virtual void SetUp() { 123 void SetUp() override {
124 dir_maker_.SetUp(); 124 dir_maker_.SetUp();
125 syncer_ = new testing::StrictMock<MockSyncer>(); 125 syncer_ = new testing::StrictMock<MockSyncer>();
126 delay_ = NULL; 126 delay_ = NULL;
127 extensions_activity_ = new ExtensionsActivity(); 127 extensions_activity_ = new ExtensionsActivity();
128 128
129 routing_info_[THEMES] = GROUP_UI; 129 routing_info_[THEMES] = GROUP_UI;
130 routing_info_[TYPED_URLS] = GROUP_DB; 130 routing_info_[TYPED_URLS] = GROUP_DB;
131 routing_info_[THEMES] = GROUP_UI; 131 routing_info_[THEMES] = GROUP_UI;
132 routing_info_[NIGORI] = GROUP_PASSIVE; 132 routing_info_[NIGORI] = GROUP_PASSIVE;
133 133
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 SyncSchedulerImpl* scheduler() { return scheduler_.get(); } 165 SyncSchedulerImpl* scheduler() { return scheduler_.get(); }
166 const ModelSafeRoutingInfo& routing_info() { return routing_info_; } 166 const ModelSafeRoutingInfo& routing_info() { return routing_info_; }
167 MockSyncer* syncer() { return syncer_; } 167 MockSyncer* syncer() { return syncer_; }
168 MockDelayProvider* delay() { return delay_; } 168 MockDelayProvider* delay() { return delay_; }
169 MockConnectionManager* connection() { return connection_.get(); } 169 MockConnectionManager* connection() { return connection_.get(); }
170 TimeDelta default_delay() { return TimeDelta::FromSeconds(0); } 170 TimeDelta default_delay() { return TimeDelta::FromSeconds(0); }
171 TimeDelta timeout() { 171 TimeDelta timeout() {
172 return TestTimeouts::action_timeout(); 172 return TestTimeouts::action_timeout();
173 } 173 }
174 174
175 virtual void TearDown() { 175 void TearDown() override {
176 PumpLoop(); 176 PumpLoop();
177 scheduler_.reset(); 177 scheduler_.reset();
178 PumpLoop(); 178 PumpLoop();
179 dir_maker_.TearDown(); 179 dir_maker_.TearDown();
180 } 180 }
181 181
182 void AnalyzePollRun(const SyncShareTimes& times, size_t min_num_samples, 182 void AnalyzePollRun(const SyncShareTimes& times, size_t min_num_samples,
183 const TimeTicks& optimal_start, const TimeDelta& poll_interval) { 183 const TimeTicks& optimal_start, const TimeDelta& poll_interval) {
184 EXPECT_GE(times.size(), min_num_samples); 184 EXPECT_GE(times.size(), min_num_samples);
185 for (size_t i = 0; i < times.size(); i++) { 185 for (size_t i = 0; i < times.size(); i++) {
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 // TODO(tim): Figure out how to remove this dangerous need to reset 888 // TODO(tim): Figure out how to remove this dangerous need to reset
889 // routing info between mode switches. 889 // routing info between mode switches.
890 context()->SetRoutingInfo(routing_info()); 890 context()->SetRoutingInfo(routing_info());
891 StartSyncScheduler(SyncScheduler::NORMAL_MODE); 891 StartSyncScheduler(SyncScheduler::NORMAL_MODE);
892 892
893 RunLoop(); 893 RunLoop();
894 Mock::VerifyAndClearExpectations(syncer()); 894 Mock::VerifyAndClearExpectations(syncer());
895 } 895 }
896 896
897 class BackoffTriggersSyncSchedulerTest : public SyncSchedulerTest { 897 class BackoffTriggersSyncSchedulerTest : public SyncSchedulerTest {
898 virtual void SetUp() { 898 void SetUp() override {
899 SyncSchedulerTest::SetUp(); 899 SyncSchedulerTest::SetUp();
900 UseMockDelayProvider(); 900 UseMockDelayProvider();
901 EXPECT_CALL(*delay(), GetDelay(_)) 901 EXPECT_CALL(*delay(), GetDelay(_))
902 .WillRepeatedly(Return(TimeDelta::FromMilliseconds(10))); 902 .WillRepeatedly(Return(TimeDelta::FromMilliseconds(10)));
903 } 903 }
904 904
905 virtual void TearDown() { 905 void TearDown() override {
906 StopSyncScheduler(); 906 StopSyncScheduler();
907 SyncSchedulerTest::TearDown(); 907 SyncSchedulerTest::TearDown();
908 } 908 }
909 }; 909 };
910 910
911 // Have the sycner fail during commit. Expect that the scheduler enters 911 // Have the sycner fail during commit. Expect that the scheduler enters
912 // backoff. 912 // backoff.
913 TEST_F(BackoffTriggersSyncSchedulerTest, FailCommitOnce) { 913 TEST_F(BackoffTriggersSyncSchedulerTest, FailCommitOnce) {
914 EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) 914 EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_))
915 .WillOnce(DoAll(Invoke(sessions::test_util::SimulateCommitFailed), 915 .WillOnce(DoAll(Invoke(sessions::test_util::SimulateCommitFailed),
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess), 1369 .WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess),
1370 RecordSyncShare(&times))); 1370 RecordSyncShare(&times)));
1371 1371
1372 // Run to wait for retrying. 1372 // Run to wait for retrying.
1373 RunLoop(); 1373 RunLoop();
1374 1374
1375 StopSyncScheduler(); 1375 StopSyncScheduler();
1376 } 1376 }
1377 1377
1378 } // namespace syncer 1378 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/model_type_sync_worker_impl_unittest.cc ('k') | sync/engine/syncer_proto_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698