summaryrefslogtreecommitdiffstats
path: root/sync/engine/sync_scheduler_whitebox_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sync/engine/sync_scheduler_whitebox_unittest.cc')
-rw-r--r--sync/engine/sync_scheduler_whitebox_unittest.cc55
1 files changed, 25 insertions, 30 deletions
diff --git a/sync/engine/sync_scheduler_whitebox_unittest.cc b/sync/engine/sync_scheduler_whitebox_unittest.cc
index 8cf4a37..383f17d 100644
--- a/sync/engine/sync_scheduler_whitebox_unittest.cc
+++ b/sync/engine/sync_scheduler_whitebox_unittest.cc
@@ -92,7 +92,7 @@ class SyncSchedulerWhiteboxTest : public testing::Test {
}
SyncSchedulerImpl::JobProcessDecision DecideOnJob(
- const SyncSchedulerImpl::SyncSessionJob& job) {
+ const SyncSessionJob& job) {
return scheduler_->DecideOnJob(job);
}
@@ -102,13 +102,10 @@ class SyncSchedulerWhiteboxTest : public testing::Test {
}
SyncSchedulerImpl::JobProcessDecision CreateAndDecideJob(
- SyncSchedulerImpl::SyncSessionJob::SyncSessionJobPurpose purpose) {
- SyncSession* s = scheduler_->CreateSyncSession(SyncSourceInfo());
- SyncSchedulerImpl::SyncSessionJob job(purpose, TimeTicks::Now(),
- make_linked_ptr(s),
- false,
- ConfigurationParams(),
- FROM_HERE);
+ SyncSessionJob::Purpose purpose) {
+ scoped_ptr<SyncSession> s(scheduler_->CreateSyncSession(SyncSourceInfo()));
+ SyncSessionJob job(purpose, TimeTicks::Now(), s.Pass(),
+ ConfigurationParams(), FROM_HERE);
return DecideOnJob(job);
}
@@ -135,7 +132,7 @@ TEST_F(SyncSchedulerWhiteboxTest, SaveNudge) {
SetMode(SyncScheduler::CONFIGURATION_MODE);
SyncSchedulerImpl::JobProcessDecision decision =
- CreateAndDecideJob(SyncSchedulerImpl::SyncSessionJob::NUDGE);
+ CreateAndDecideJob(SyncSessionJob::NUDGE);
EXPECT_EQ(decision, SyncSchedulerImpl::SAVE);
}
@@ -153,17 +150,14 @@ TEST_F(SyncSchedulerWhiteboxTest, SaveNudgeWhileTypeThrottled) {
ModelTypeSetToInvalidationMap(types, std::string());
SyncSourceInfo info(GetUpdatesCallerInfo::LOCAL, invalidation_map);
- SyncSession* s = scheduler_->CreateSyncSession(info);
+ scoped_ptr<SyncSession> s(scheduler_->CreateSyncSession(info));
// Now schedule a nudge with just bookmarks and the change is local.
- SyncSchedulerImpl::SyncSessionJob job(
- SyncSchedulerImpl::SyncSessionJob::NUDGE,
- TimeTicks::Now(),
- make_linked_ptr(s),
- false,
- ConfigurationParams(),
- FROM_HERE);
-
+ SyncSessionJob job(SyncSessionJob::NUDGE,
+ TimeTicks::Now(),
+ s.Pass(),
+ ConfigurationParams(),
+ FROM_HERE);
SyncSchedulerImpl::JobProcessDecision decision = DecideOnJob(job);
EXPECT_EQ(decision, SyncSchedulerImpl::SAVE);
}
@@ -172,7 +166,7 @@ TEST_F(SyncSchedulerWhiteboxTest, ContinueNudge) {
InitializeSyncerOnNormalMode();
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSchedulerImpl::SyncSessionJob::NUDGE);
+ SyncSessionJob::NUDGE);
EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE);
}
@@ -182,7 +176,7 @@ TEST_F(SyncSchedulerWhiteboxTest, DropPoll) {
SetMode(SyncScheduler::CONFIGURATION_MODE);
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSchedulerImpl::SyncSessionJob::POLL);
+ SyncSessionJob::POLL);
EXPECT_EQ(decision, SyncSchedulerImpl::DROP);
}
@@ -191,7 +185,7 @@ TEST_F(SyncSchedulerWhiteboxTest, ContinuePoll) {
InitializeSyncerOnNormalMode();
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSchedulerImpl::SyncSessionJob::POLL);
+ SyncSessionJob::POLL);
EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE);
}
@@ -201,7 +195,7 @@ TEST_F(SyncSchedulerWhiteboxTest, ContinueConfiguration) {
SetMode(SyncScheduler::CONFIGURATION_MODE);
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSchedulerImpl::SyncSessionJob::CONFIGURATION);
+ SyncSessionJob::CONFIGURATION);
EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE);
}
@@ -213,7 +207,7 @@ TEST_F(SyncSchedulerWhiteboxTest, SaveConfigurationWhileThrottled) {
SetWaitIntervalToThrottled();
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSchedulerImpl::SyncSessionJob::CONFIGURATION);
+ SyncSessionJob::CONFIGURATION);
EXPECT_EQ(decision, SyncSchedulerImpl::SAVE);
}
@@ -225,7 +219,7 @@ TEST_F(SyncSchedulerWhiteboxTest, SaveNudgeWhileThrottled) {
SetWaitIntervalToThrottled();
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSchedulerImpl::SyncSessionJob::NUDGE);
+ SyncSessionJob::NUDGE);
EXPECT_EQ(decision, SyncSchedulerImpl::SAVE);
}
@@ -236,7 +230,7 @@ TEST_F(SyncSchedulerWhiteboxTest, ContinueNudgeWhileExponentialBackOff) {
SetWaitIntervalToExponentialBackoff();
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSchedulerImpl::SyncSessionJob::NUDGE);
+ SyncSessionJob::NUDGE);
EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE);
}
@@ -248,7 +242,7 @@ TEST_F(SyncSchedulerWhiteboxTest, DropNudgeWhileExponentialBackOff) {
SetWaitIntervalHadNudge(true);
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSchedulerImpl::SyncSessionJob::NUDGE);
+ SyncSessionJob::NUDGE);
EXPECT_EQ(decision, SyncSchedulerImpl::DROP);
}
@@ -258,10 +252,11 @@ TEST_F(SyncSchedulerWhiteboxTest, ContinueCanaryJobConfig) {
SetMode(SyncScheduler::CONFIGURATION_MODE);
SetWaitIntervalToExponentialBackoff();
- struct SyncSchedulerImpl::SyncSessionJob job;
- job.purpose = SyncSchedulerImpl::SyncSessionJob::CONFIGURATION;
- job.scheduled_start = TimeTicks::Now();
- job.is_canary_job = true;
+ SyncSessionJob job(SyncSessionJob::CONFIGURATION,
+ TimeTicks::Now(), scoped_ptr<SyncSession>(),
+ ConfigurationParams(), FROM_HERE);
+
+ job.GrantCanaryPrivilege();
SyncSchedulerImpl::JobProcessDecision decision = DecideOnJob(job);
EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE);