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

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

Issue 1469783002: Cleanup: Correctly spell success(ful). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format media Created 5 years 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
« no previous file with comments | « sandbox/win/src/app_container.h ('k') | sync/syncable/directory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 ConfigurationParams params( 712 ConfigurationParams params(
713 GetUpdatesCallerInfo::RECONFIGURATION, 713 GetUpdatesCallerInfo::RECONFIGURATION,
714 types, 714 types,
715 TypesToRoutingInfo(types), 715 TypesToRoutingInfo(types),
716 base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)), 716 base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
717 base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter))); 717 base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
718 scheduler()->ScheduleConfiguration(params); 718 scheduler()->ScheduleConfiguration(params);
719 PumpLoop(); 719 PumpLoop();
720 ASSERT_EQ(0, ready_counter.times_called()); 720 ASSERT_EQ(0, ready_counter.times_called());
721 ASSERT_EQ(1, retry_counter.times_called()); 721 ASSERT_EQ(1, retry_counter.times_called());
722
723 } 722 }
724 723
725 TEST_F(SyncSchedulerTest, ThrottlingExpiresFromPoll) { 724 TEST_F(SyncSchedulerTest, ThrottlingExpiresFromPoll) {
726 SyncShareTimes times; 725 SyncShareTimes times;
727 TimeDelta poll(TimeDelta::FromMilliseconds(15)); 726 TimeDelta poll(TimeDelta::FromMilliseconds(15));
728 TimeDelta throttle1(TimeDelta::FromMilliseconds(150)); 727 TimeDelta throttle1(TimeDelta::FromMilliseconds(150));
729 scheduler()->OnReceivedLongPollIntervalUpdate(poll); 728 scheduler()->OnReceivedLongPollIntervalUpdate(poll);
730 729
731 ::testing::InSequence seq; 730 ::testing::InSequence seq;
732 EXPECT_CALL(*syncer(), PollSyncShare(_,_)) 731 EXPECT_CALL(*syncer(), PollSyncShare(_,_))
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 ConfigurationParams params( 1076 ConfigurationParams params(
1078 GetUpdatesCallerInfo::RECONFIGURATION, 1077 GetUpdatesCallerInfo::RECONFIGURATION,
1079 types, 1078 types,
1080 TypesToRoutingInfo(types), 1079 TypesToRoutingInfo(types),
1081 base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)), 1080 base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
1082 base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter))); 1081 base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
1083 scheduler()->ScheduleConfiguration(params); 1082 scheduler()->ScheduleConfiguration(params);
1084 PumpLoop(); 1083 PumpLoop();
1085 ASSERT_EQ(0, ready_counter.times_called()); 1084 ASSERT_EQ(0, ready_counter.times_called());
1086 ASSERT_EQ(1, retry_counter.times_called()); 1085 ASSERT_EQ(1, retry_counter.times_called());
1087
1088 } 1086 }
1089 1087
1090 // Test that backoff is shaping traffic properly with consecutive errors. 1088 // Test that backoff is shaping traffic properly with consecutive errors.
1091 TEST_F(SyncSchedulerTest, BackoffElevation) { 1089 TEST_F(SyncSchedulerTest, BackoffElevation) {
1092 SyncShareTimes times; 1090 SyncShareTimes times;
1093 UseMockDelayProvider(); 1091 UseMockDelayProvider();
1094 1092
1095 EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)).Times(kMinNumSamples) 1093 EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)).Times(kMinNumSamples)
1096 .WillRepeatedly(DoAll(Invoke(sessions::test_util::SimulateCommitFailed), 1094 .WillRepeatedly(DoAll(Invoke(sessions::test_util::SimulateCommitFailed),
1097 RecordSyncShareMultiple(&times, kMinNumSamples, false))); 1095 RecordSyncShareMultiple(&times, kMinNumSamples, false)));
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 .WillRepeatedly(Return(TimeDelta::FromMilliseconds(0))); 1192 .WillRepeatedly(Return(TimeDelta::FromMilliseconds(0)));
1195 1193
1196 EXPECT_CALL(*syncer(), PollSyncShare(_,_)) 1194 EXPECT_CALL(*syncer(), PollSyncShare(_,_))
1197 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollFailed), 1195 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollFailed),
1198 RecordSyncShare(&times, false))) 1196 RecordSyncShare(&times, false)))
1199 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollSuccess), 1197 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollSuccess),
1200 RecordSyncShare(&times, true))); 1198 RecordSyncShare(&times, true)));
1201 1199
1202 StartSyncScheduler(base::Time()); 1200 StartSyncScheduler(base::Time());
1203 1201
1204 // Run the unsucessful poll. The failed poll should not trigger backoff. 1202 // Run the unsuccessful poll. The failed poll should not trigger backoff.
1205 RunLoop(); 1203 RunLoop();
1206 EXPECT_TRUE(scheduler()->IsBackingOff()); 1204 EXPECT_TRUE(scheduler()->IsBackingOff());
1207 1205
1208 // Run the successful poll. 1206 // Run the successful poll.
1209 RunLoop(); 1207 RunLoop();
1210 EXPECT_FALSE(scheduler()->IsBackingOff()); 1208 EXPECT_FALSE(scheduler()->IsBackingOff());
1211 } 1209 }
1212 1210
1213 // Test that starting the syncer thread without a valid connection doesn't 1211 // Test that starting the syncer thread without a valid connection doesn't
1214 // break things when a connection is detected. 1212 // break things when a connection is detected.
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 ASSERT_TRUE(scheduler()->IsBackingOff()); 1465 ASSERT_TRUE(scheduler()->IsBackingOff());
1468 1466
1469 // Now succeed. 1467 // Now succeed.
1470 connection()->SetServerReachable(); 1468 connection()->SetServerReachable();
1471 PumpLoopFor(2 * delta); 1469 PumpLoopFor(2 * delta);
1472 ASSERT_EQ(1, success_counter.times_called()); 1470 ASSERT_EQ(1, success_counter.times_called());
1473 ASSERT_FALSE(scheduler()->IsBackingOff()); 1471 ASSERT_FALSE(scheduler()->IsBackingOff());
1474 } 1472 }
1475 1473
1476 } // namespace syncer 1474 } // namespace syncer
OLDNEW
« no previous file with comments | « sandbox/win/src/app_container.h ('k') | sync/syncable/directory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698