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

Unified Diff: sync/engine/sync_scheduler_whitebox_unittest.cc

Issue 11342008: Revert 164565 - sync: make scheduling logic and job ownership more obvious. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1311/src/
Patch Set: Created 8 years, 2 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_unittest.cc ('k') | sync/engine/sync_session_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/sync_scheduler_whitebox_unittest.cc
===================================================================
--- sync/engine/sync_scheduler_whitebox_unittest.cc (revision 164641)
+++ sync/engine/sync_scheduler_whitebox_unittest.cc (working copy)
@@ -92,7 +92,7 @@
}
SyncSchedulerImpl::JobProcessDecision DecideOnJob(
- const SyncSessionJob& job) {
+ const SyncSchedulerImpl::SyncSessionJob& job) {
return scheduler_->DecideOnJob(job);
}
@@ -102,10 +102,13 @@
}
SyncSchedulerImpl::JobProcessDecision CreateAndDecideJob(
- SyncSessionJob::Purpose purpose) {
- scoped_ptr<SyncSession> s(scheduler_->CreateSyncSession(SyncSourceInfo()));
- SyncSessionJob job(purpose, TimeTicks::Now(), s.Pass(),
- ConfigurationParams(), FROM_HERE);
+ SyncSchedulerImpl::SyncSessionJob::SyncSessionJobPurpose purpose) {
+ SyncSession* s = scheduler_->CreateSyncSession(SyncSourceInfo());
+ SyncSchedulerImpl::SyncSessionJob job(purpose, TimeTicks::Now(),
+ make_linked_ptr(s),
+ false,
+ ConfigurationParams(),
+ FROM_HERE);
return DecideOnJob(job);
}
@@ -132,7 +135,7 @@
SetMode(SyncScheduler::CONFIGURATION_MODE);
SyncSchedulerImpl::JobProcessDecision decision =
- CreateAndDecideJob(SyncSessionJob::NUDGE);
+ CreateAndDecideJob(SyncSchedulerImpl::SyncSessionJob::NUDGE);
EXPECT_EQ(decision, SyncSchedulerImpl::SAVE);
}
@@ -150,14 +153,17 @@
ModelTypeSetToInvalidationMap(types, std::string());
SyncSourceInfo info(GetUpdatesCallerInfo::LOCAL, invalidation_map);
- scoped_ptr<SyncSession> s(scheduler_->CreateSyncSession(info));
+ SyncSession* s = scheduler_->CreateSyncSession(info);
// Now schedule a nudge with just bookmarks and the change is local.
- SyncSessionJob job(SyncSessionJob::NUDGE,
- TimeTicks::Now(),
- s.Pass(),
- ConfigurationParams(),
- FROM_HERE);
+ SyncSchedulerImpl::SyncSessionJob job(
+ SyncSchedulerImpl::SyncSessionJob::NUDGE,
+ TimeTicks::Now(),
+ make_linked_ptr(s),
+ false,
+ ConfigurationParams(),
+ FROM_HERE);
+
SyncSchedulerImpl::JobProcessDecision decision = DecideOnJob(job);
EXPECT_EQ(decision, SyncSchedulerImpl::SAVE);
}
@@ -166,7 +172,7 @@
InitializeSyncerOnNormalMode();
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSessionJob::NUDGE);
+ SyncSchedulerImpl::SyncSessionJob::NUDGE);
EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE);
}
@@ -176,7 +182,7 @@
SetMode(SyncScheduler::CONFIGURATION_MODE);
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSessionJob::POLL);
+ SyncSchedulerImpl::SyncSessionJob::POLL);
EXPECT_EQ(decision, SyncSchedulerImpl::DROP);
}
@@ -185,7 +191,7 @@
InitializeSyncerOnNormalMode();
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSessionJob::POLL);
+ SyncSchedulerImpl::SyncSessionJob::POLL);
EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE);
}
@@ -195,7 +201,7 @@
SetMode(SyncScheduler::CONFIGURATION_MODE);
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSessionJob::CONFIGURATION);
+ SyncSchedulerImpl::SyncSessionJob::CONFIGURATION);
EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE);
}
@@ -207,7 +213,7 @@
SetWaitIntervalToThrottled();
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSessionJob::CONFIGURATION);
+ SyncSchedulerImpl::SyncSessionJob::CONFIGURATION);
EXPECT_EQ(decision, SyncSchedulerImpl::SAVE);
}
@@ -219,7 +225,7 @@
SetWaitIntervalToThrottled();
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSessionJob::NUDGE);
+ SyncSchedulerImpl::SyncSessionJob::NUDGE);
EXPECT_EQ(decision, SyncSchedulerImpl::SAVE);
}
@@ -230,7 +236,7 @@
SetWaitIntervalToExponentialBackoff();
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSessionJob::NUDGE);
+ SyncSchedulerImpl::SyncSessionJob::NUDGE);
EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE);
}
@@ -242,7 +248,7 @@
SetWaitIntervalHadNudge(true);
SyncSchedulerImpl::JobProcessDecision decision = CreateAndDecideJob(
- SyncSessionJob::NUDGE);
+ SyncSchedulerImpl::SyncSessionJob::NUDGE);
EXPECT_EQ(decision, SyncSchedulerImpl::DROP);
}
@@ -252,11 +258,10 @@
SetMode(SyncScheduler::CONFIGURATION_MODE);
SetWaitIntervalToExponentialBackoff();
- SyncSessionJob job(SyncSessionJob::CONFIGURATION,
- TimeTicks::Now(), scoped_ptr<SyncSession>(),
- ConfigurationParams(), FROM_HERE);
-
- job.GrantCanaryPrivilege();
+ struct SyncSchedulerImpl::SyncSessionJob job;
+ job.purpose = SyncSchedulerImpl::SyncSessionJob::CONFIGURATION;
+ job.scheduled_start = TimeTicks::Now();
+ job.is_canary_job = true;
SyncSchedulerImpl::JobProcessDecision decision = DecideOnJob(job);
EXPECT_EQ(decision, SyncSchedulerImpl::CONTINUE);
« no previous file with comments | « sync/engine/sync_scheduler_unittest.cc ('k') | sync/engine/sync_session_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698