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

Unified Diff: sync/engine/sync_scheduler_whitebox_unittest.cc

Issue 12538015: sync: Handle POLL jobs in separate a code path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Amend comments Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/engine/sync_scheduler_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/sync_scheduler_whitebox_unittest.cc
diff --git a/sync/engine/sync_scheduler_whitebox_unittest.cc b/sync/engine/sync_scheduler_whitebox_unittest.cc
index 01adb85ee79235a2e179980e6fef2fdf583cd63f..77bb11dd40bc6e85395b392981fdb2a282d9a911 100644
--- a/sync/engine/sync_scheduler_whitebox_unittest.cc
+++ b/sync/engine/sync_scheduler_whitebox_unittest.cc
@@ -111,6 +111,10 @@ class SyncSchedulerWhiteboxTest : public testing::Test {
return DecideOnJob(job, SyncSchedulerImpl::NORMAL_PRIORITY);
}
+ bool ShouldPoll() {
+ return scheduler_->ShouldPoll();
+ }
+
SyncSessionContext* context() { return context_.get(); }
private:
@@ -174,23 +178,27 @@ TEST_F(SyncSchedulerWhiteboxTest, ContinueNudge) {
EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE);
}
-TEST_F(SyncSchedulerWhiteboxTest, DropPoll) {
+TEST_F(SyncSchedulerWhiteboxTest, ContinuePoll) {
InitializeSyncerOnNormalMode();
- SetMode(SyncScheduler::CONFIGURATION_MODE);
-
- SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSessionJob::POLL);
-
- EXPECT_EQ(decision, SyncSchedulerImpl::DROP);
+ EXPECT_TRUE(ShouldPoll());
}
-TEST_F(SyncSchedulerWhiteboxTest, ContinuePoll) {
+TEST_F(SyncSchedulerWhiteboxTest, DropPollInConfigureMode) {
InitializeSyncerOnNormalMode();
+ SetMode(SyncScheduler::CONFIGURATION_MODE);
+ EXPECT_FALSE(ShouldPoll());
+}
- SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSessionJob::POLL);
+TEST_F(SyncSchedulerWhiteboxTest, DropPollWhenThrottled) {
+ InitializeSyncerOnNormalMode();
+ SetWaitIntervalToThrottled();
+ EXPECT_FALSE(ShouldPoll());
+}
- EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE);
+TEST_F(SyncSchedulerWhiteboxTest, DropPollInBackoff) {
+ InitializeSyncerOnNormalMode();
+ SetWaitIntervalToExponentialBackoff();
+ EXPECT_FALSE(ShouldPoll());
}
TEST_F(SyncSchedulerWhiteboxTest, ContinueConfiguration) {
« no previous file with comments | « sync/engine/sync_scheduler_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698