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

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: Addressed CR feedback 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
« no previous file with comments | « sync/sessions/model_type_registry.cc ('k') | sync/sync.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..74967ac4376de070a4ef42579514a9f79e89b5cd 100644
--- a/sync/sessions/model_type_registry_unittest.cc
+++ b/sync/sessions/model_type_registry_unittest.cc
@@ -8,6 +8,7 @@
#include "base/message_loop/message_loop.h"
#include "base/thread_task_runner_handle.h"
#include "sync/engine/model_type_processor_impl.h"
+#include "sync/internal_api/public/activation_context.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/sessions/model_type_registry.h"
#include "sync/test/engine/fake_model_worker.h"
@@ -32,6 +33,20 @@ 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) {
+ scoped_ptr<syncer_v2::ActivationContext> context =
+ make_scoped_ptr(new syncer_v2::ActivationContext);
+ 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 context.Pass();
+ }
+
private:
syncable::Directory* directory();
@@ -154,16 +169,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 +211,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 +225,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 +258,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)));
« no previous file with comments | « sync/sessions/model_type_registry.cc ('k') | sync/sync.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698