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

Unified Diff: sync/sessions/model_type_registry_unittest.cc

Issue 1368683003: USS SyncContextProxy / data type activation refactoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
Index: sync/sessions/model_type_registry_unittest.cc
diff --git a/sync/sessions/model_type_registry_unittest.cc b/sync/sessions/model_type_registry_unittest.cc
index 9ab1d29774ba355d7f46fe25cfcbe8fa6949d9a5..c21969ab084c2b74d659c392b5662017a6936293 100644
--- a/sync/sessions/model_type_registry_unittest.cc
+++ b/sync/sessions/model_type_registry_unittest.cc
@@ -32,6 +32,19 @@ class ModelTypeRegistryTest : public ::testing::Test {
return state;
}
+ static scoped_ptr<syncer_v2::ActivationContext> MakeActivationContext(
+ const syncer_v2::DataTypeState& data_type_state,
+ const syncer_v2::UpdateResponseDataList& saved_pending_updates,
+ const scoped_refptr<base::SequencedTaskRunner>& type_task_runner,
+ const base::WeakPtr<syncer_v2::ModelTypeProcessor>& type_processor) {
+ syncer_v2::ActivationContext* context = new syncer_v2::ActivationContext;
pavely 2015/09/25 18:22:39 Same comment as in the other file. Use scoped_ptr,
stanisc 2015/09/26 00:16:01 Done.
+ context->data_type_state = data_type_state;
+ context->saved_pending_updates = saved_pending_updates;
+ context->type_task_runner = type_task_runner;
+ context->type_processor = type_processor;
+ return make_scoped_ptr(context);
+ }
+
private:
syncable::Directory* directory();
@@ -154,16 +167,18 @@ TEST_F(ModelTypeRegistryTest, NonBlockingTypes) {
EXPECT_TRUE(registry()->GetEnabledTypes().Empty());
registry()->ConnectSyncTypeToWorker(
- syncer::THEMES, MakeInitialDataTypeState(THEMES),
- syncer_v2::UpdateResponseDataList(), task_runner,
- themes_sync_proxy.AsWeakPtrForUI());
+ syncer::THEMES,
+ MakeActivationContext(MakeInitialDataTypeState(THEMES),
+ syncer_v2::UpdateResponseDataList(), task_runner,
+ themes_sync_proxy.AsWeakPtrForUI()));
EXPECT_TRUE(registry()->GetEnabledTypes().Equals(
ModelTypeSet(syncer::THEMES)));
registry()->ConnectSyncTypeToWorker(
- syncer::SESSIONS, MakeInitialDataTypeState(SESSIONS),
- syncer_v2::UpdateResponseDataList(), task_runner,
- sessions_sync_proxy.AsWeakPtrForUI());
+ syncer::SESSIONS,
+ MakeActivationContext(MakeInitialDataTypeState(SESSIONS),
+ syncer_v2::UpdateResponseDataList(), task_runner,
+ sessions_sync_proxy.AsWeakPtrForUI()));
EXPECT_TRUE(registry()->GetEnabledTypes().Equals(
ModelTypeSet(syncer::THEMES, syncer::SESSIONS)));
@@ -194,9 +209,10 @@ TEST_F(ModelTypeRegistryTest, NonBlockingTypesWithDirectoryTypes) {
// Add the themes non-blocking type.
registry()->ConnectSyncTypeToWorker(
- syncer::THEMES, MakeInitialDataTypeState(THEMES),
- syncer_v2::UpdateResponseDataList(), task_runner,
- themes_sync_proxy.AsWeakPtrForUI());
+ syncer::THEMES,
+ MakeActivationContext(MakeInitialDataTypeState(THEMES),
+ syncer_v2::UpdateResponseDataList(), task_runner,
+ themes_sync_proxy.AsWeakPtrForUI()));
current_types.Put(syncer::THEMES);
EXPECT_TRUE(registry()->GetEnabledTypes().Equals(current_types));
@@ -207,9 +223,10 @@ TEST_F(ModelTypeRegistryTest, NonBlockingTypesWithDirectoryTypes) {
// Add sessions non-blocking type.
registry()->ConnectSyncTypeToWorker(
- syncer::SESSIONS, MakeInitialDataTypeState(SESSIONS),
- syncer_v2::UpdateResponseDataList(), task_runner,
- sessions_sync_proxy.AsWeakPtrForUI());
+ syncer::SESSIONS,
+ MakeActivationContext(MakeInitialDataTypeState(SESSIONS),
+ syncer_v2::UpdateResponseDataList(), task_runner,
+ sessions_sync_proxy.AsWeakPtrForUI()));
current_types.Put(syncer::SESSIONS);
EXPECT_TRUE(registry()->GetEnabledTypes().Equals(current_types));
@@ -239,13 +256,15 @@ TEST_F(ModelTypeRegistryTest, DeletionOrdering) {
EXPECT_TRUE(registry()->GetEnabledTypes().Empty());
registry()->ConnectSyncTypeToWorker(
- syncer::THEMES, MakeInitialDataTypeState(THEMES),
- syncer_v2::UpdateResponseDataList(), task_runner,
- themes_sync_proxy->AsWeakPtrForUI());
+ syncer::THEMES,
+ MakeActivationContext(MakeInitialDataTypeState(THEMES),
+ syncer_v2::UpdateResponseDataList(), task_runner,
+ themes_sync_proxy->AsWeakPtrForUI()));
registry()->ConnectSyncTypeToWorker(
- syncer::SESSIONS, MakeInitialDataTypeState(SESSIONS),
- syncer_v2::UpdateResponseDataList(), task_runner,
- sessions_sync_proxy->AsWeakPtrForUI());
+ syncer::SESSIONS,
+ MakeActivationContext(MakeInitialDataTypeState(SESSIONS),
+ syncer_v2::UpdateResponseDataList(), task_runner,
+ sessions_sync_proxy->AsWeakPtrForUI()));
EXPECT_TRUE(registry()->GetEnabledTypes().Equals(
ModelTypeSet(syncer::THEMES, syncer::SESSIONS)));

Powered by Google App Engine
This is Rietveld 408576698