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

Unified Diff: components/sync/engine_impl/sync_scheduler_impl_unittest.cc

Issue 2641523004: [Sync] Make directory types registration explicit in ModelTypeRegistry (Closed)
Patch Set: Address comments Created 3 years, 11 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 | « components/sync/engine_impl/sync_scheduler_impl.cc ('k') | components/sync/engine_impl/syncer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/engine_impl/sync_scheduler_impl_unittest.cc
diff --git a/components/sync/engine_impl/sync_scheduler_impl_unittest.cc b/components/sync/engine_impl/sync_scheduler_impl_unittest.cc
index d4d673470f9c93ad338f8a420b33aa0642f15a2d..93d8a00bf9ef7e695e4d725d859a5b142bb3cb13 100644
--- a/components/sync/engine_impl/sync_scheduler_impl_unittest.cc
+++ b/components/sync/engine_impl/sync_scheduler_impl_unittest.cc
@@ -89,14 +89,6 @@ void PumpLoopFor(base::TimeDelta time) {
RunLoop();
}
-ModelSafeRoutingInfo TypesToRoutingInfo(ModelTypeSet types) {
- ModelSafeRoutingInfo routes;
- for (ModelTypeSet::Iterator iter = types.First(); iter.Good(); iter.Inc()) {
- routes[iter.Get()] = GROUP_PASSIVE;
- }
- return routes;
-}
-
static const size_t kMinNumSamples = 5;
// Test harness for the SyncScheduler. Test the delays and backoff timers used
@@ -129,11 +121,6 @@ class SyncSchedulerImplTest : public testing::Test {
delay_ = nullptr;
extensions_activity_ = new ExtensionsActivity();
- routing_info_[THEMES] = GROUP_UI;
- routing_info_[TYPED_URLS] = GROUP_DB;
- routing_info_[THEMES] = GROUP_UI;
- routing_info_[NIGORI] = GROUP_PASSIVE;
-
workers_.clear();
workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_UI)));
workers_.push_back(make_scoped_refptr(new FakeModelWorker(GROUP_DB)));
@@ -146,6 +133,9 @@ class SyncSchedulerImplTest : public testing::Test {
model_type_registry_ = base::MakeUnique<ModelTypeRegistry>(
workers_, test_user_share_.user_share(), &mock_nudge_handler_,
UssMigrator());
+ model_type_registry_->RegisterDirectoryType(NIGORI, GROUP_PASSIVE);
+ model_type_registry_->RegisterDirectoryType(THEMES, GROUP_UI);
+ model_type_registry_->RegisterDirectoryType(TYPED_URLS, GROUP_DB);
context_ = base::MakeUnique<SyncCycleContext>(
connection_.get(), directory(), extensions_activity_.get(),
@@ -154,7 +144,6 @@ class SyncSchedulerImplTest : public testing::Test {
true, // enable keystore encryption
false, // force enable pre-commit GU avoidance
"fake_invalidator_client_id");
- context_->SetRoutingInfo(routing_info_);
context_->set_notifications_enabled(true);
context_->set_account_name("Test");
scheduler_ = base::MakeUnique<SyncSchedulerImpl>(
@@ -164,7 +153,6 @@ class SyncSchedulerImplTest : public testing::Test {
}
SyncSchedulerImpl* scheduler() { return scheduler_.get(); }
- const ModelSafeRoutingInfo& routing_info() { return routing_info_; }
MockSyncer* syncer() { return syncer_; }
MockDelayProvider* delay() { return delay_; }
MockConnectionManager* connection() { return connection_.get(); }
@@ -309,7 +297,6 @@ class SyncSchedulerImplTest : public testing::Test {
MockDelayProvider* delay_;
std::vector<scoped_refptr<ModelSafeWorker>> workers_;
scoped_refptr<ExtensionsActivity> extensions_activity_;
- ModelSafeRoutingInfo routing_info_;
base::WeakPtrFactory<SyncSchedulerImplTest> weak_ptr_factory_;
};
@@ -393,7 +380,6 @@ TEST_F(SyncSchedulerImplTest, Config) {
CallbackCounter retry_counter;
ConfigurationParams params(
GetUpdatesCallerInfo::RECONFIGURATION, model_types,
- TypesToRoutingInfo(model_types),
base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
scheduler()->ScheduleConfiguration(params);
@@ -422,7 +408,6 @@ TEST_F(SyncSchedulerImplTest, ConfigWithBackingOff) {
CallbackCounter retry_counter;
ConfigurationParams params(
GetUpdatesCallerInfo::RECONFIGURATION, model_types,
- TypesToRoutingInfo(model_types),
base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
scheduler()->ScheduleConfiguration(params);
@@ -468,7 +453,6 @@ TEST_F(SyncSchedulerImplTest, ConfigWithStop) {
CallbackCounter retry_counter;
ConfigurationParams params(
GetUpdatesCallerInfo::RECONFIGURATION, model_types,
- TypesToRoutingInfo(model_types),
base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
scheduler()->ScheduleConfiguration(params);
@@ -490,7 +474,6 @@ TEST_F(SyncSchedulerImplTest, ConfigNoAuthToken) {
CallbackCounter retry_counter;
ConfigurationParams params(
GetUpdatesCallerInfo::RECONFIGURATION, model_types,
- TypesToRoutingInfo(model_types),
base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
scheduler()->ScheduleConfiguration(params);
@@ -518,7 +501,6 @@ TEST_F(SyncSchedulerImplTest, ConfigNoAuthTokenLocalSync) {
CallbackCounter retry_counter;
ConfigurationParams params(
GetUpdatesCallerInfo::RECONFIGURATION, model_types,
- TypesToRoutingInfo(model_types),
base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
scheduler()->ScheduleConfiguration(params);
@@ -546,7 +528,6 @@ TEST_F(SyncSchedulerImplTest, NudgeWithConfigWithBackingOff) {
CallbackCounter retry_counter;
ConfigurationParams params(
GetUpdatesCallerInfo::RECONFIGURATION, model_types,
- TypesToRoutingInfo(model_types),
base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
scheduler()->ScheduleConfiguration(params);
@@ -807,7 +788,7 @@ TEST_F(SyncSchedulerImplTest, ThrottlingDoesThrottle) {
CallbackCounter ready_counter;
CallbackCounter retry_counter;
ConfigurationParams params(
- GetUpdatesCallerInfo::RECONFIGURATION, types, TypesToRoutingInfo(types),
+ GetUpdatesCallerInfo::RECONFIGURATION, types,
base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
scheduler()->ScheduleConfiguration(params);
@@ -891,7 +872,7 @@ TEST_F(SyncSchedulerImplTest, ThrottlingExpiresFromConfigure) {
CallbackCounter ready_counter;
CallbackCounter retry_counter;
ConfigurationParams params(
- GetUpdatesCallerInfo::RECONFIGURATION, types, TypesToRoutingInfo(types),
+ GetUpdatesCallerInfo::RECONFIGURATION, types,
base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
scheduler()->ScheduleConfiguration(params);
@@ -1212,7 +1193,6 @@ TEST_F(SyncSchedulerImplTest, ConfigurationMode) {
CallbackCounter retry_counter;
ConfigurationParams params(
GetUpdatesCallerInfo::RECONFIGURATION, config_types,
- TypesToRoutingInfo(config_types),
base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
scheduler()->ScheduleConfiguration(params);
@@ -1229,9 +1209,6 @@ TEST_F(SyncSchedulerImplTest, ConfigurationMode) {
.WillOnce(DoAll(Invoke(test_util::SimulateNormalSuccess),
RecordSyncShare(&times2, true)));
- // TODO(tim): Figure out how to remove this dangerous need to reset
- // routing info between mode switches.
- context()->SetRoutingInfo(routing_info());
StartSyncScheduler(base::Time());
RunLoop();
@@ -1307,7 +1284,7 @@ TEST_F(BackoffTriggersSyncSchedulerImplTest, FailGetEncryptionKey) {
CallbackCounter ready_counter;
CallbackCounter retry_counter;
ConfigurationParams params(
- GetUpdatesCallerInfo::RECONFIGURATION, types, TypesToRoutingInfo(types),
+ GetUpdatesCallerInfo::RECONFIGURATION, types,
base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
scheduler()->ScheduleConfiguration(params);
@@ -1356,7 +1333,7 @@ TEST_F(SyncSchedulerImplTest, BackoffDropsJobs) {
CallbackCounter ready_counter;
CallbackCounter retry_counter;
ConfigurationParams params(
- GetUpdatesCallerInfo::RECONFIGURATION, types, TypesToRoutingInfo(types),
+ GetUpdatesCallerInfo::RECONFIGURATION, types,
base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
scheduler()->ScheduleConfiguration(params);
@@ -1589,7 +1566,6 @@ TEST_F(SyncSchedulerImplTest, DoubleCanaryInConfigure) {
CallbackCounter retry_counter;
ConfigurationParams params(
GetUpdatesCallerInfo::RECONFIGURATION, model_types,
- TypesToRoutingInfo(model_types),
base::Bind(&CallbackCounter::Callback, base::Unretained(&ready_counter)),
base::Bind(&CallbackCounter::Callback, base::Unretained(&retry_counter)));
scheduler()->ScheduleConfiguration(params);
« no previous file with comments | « components/sync/engine_impl/sync_scheduler_impl.cc ('k') | components/sync/engine_impl/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698