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

Unified Diff: components/sync_driver/shared_change_processor_unittest.cc

Issue 1310553005: [Sync] Replace ProfileSyncComponentsFactory with SyncClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Really fix GN Created 5 years, 4 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: components/sync_driver/shared_change_processor_unittest.cc
diff --git a/components/sync_driver/shared_change_processor_unittest.cc b/components/sync_driver/shared_change_processor_unittest.cc
index bf07fcd1662501438298ee1227b4cd3ec6136a85..b97ea3616ca47573aed5d08b54ab8c8eb9f7a278 100644
--- a/components/sync_driver/shared_change_processor_unittest.cc
+++ b/components/sync_driver/shared_change_processor_unittest.cc
@@ -14,8 +14,10 @@
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "components/sync_driver/data_type_error_handler_mock.h"
+#include "components/sync_driver/fake_sync_client.h"
#include "components/sync_driver/generic_change_processor.h"
#include "components/sync_driver/generic_change_processor_factory.h"
+#include "components/sync_driver/local_device_info_provider.h"
#include "components/sync_driver/sync_api_component_factory.h"
#include "sync/api/attachments/attachment_id.h"
#include "sync/api/attachments/attachment_store.h"
@@ -33,12 +35,62 @@ namespace {
using ::testing::NiceMock;
using ::testing::StrictMock;
+class TestSyncApiComponentFactory : public SyncApiComponentFactory {
+ public:
+ TestSyncApiComponentFactory() {}
+ ~TestSyncApiComponentFactory() override {}
+
+ // SyncApiComponentFactory implementation.
+ void Initialize(sync_driver::SyncService* pss) override {}
+ void RegisterDataTypes() override {}
+ sync_driver::DataTypeManager* CreateDataTypeManager(
+ const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
+ debug_info_listener,
+ const sync_driver::DataTypeController::TypeMap* controllers,
+ const sync_driver::DataTypeEncryptionHandler* encryption_handler,
+ browser_sync::SyncBackendHost* backend,
+ sync_driver::DataTypeManagerObserver* observer) override {
+ return nullptr;
+ }
+ browser_sync::SyncBackendHost* CreateSyncBackendHost(
+ const std::string& name,
+ invalidation::InvalidationService* invalidator,
+ const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs,
+ const base::FilePath& sync_folder) override {
+ return nullptr;
+ }
+ scoped_ptr<sync_driver::LocalDeviceInfoProvider>
+ CreateLocalDeviceInfoProvider() override {
+ return nullptr;
+ }
+ SyncApiComponentFactory::SyncComponents CreateBookmarkSyncComponents(
+ sync_driver::SyncService* sync_service,
+ sync_driver::DataTypeErrorHandler* error_handler) override {
+ return SyncApiComponentFactory::SyncComponents(nullptr, nullptr);
+ }
+ SyncApiComponentFactory::SyncComponents CreateTypedUrlSyncComponents(
+ sync_driver::SyncService* sync_service,
+ history::HistoryBackend* history_backend,
+ sync_driver::DataTypeErrorHandler* error_handler) override {
+ return SyncApiComponentFactory::SyncComponents(nullptr, nullptr);
+ }
+ scoped_ptr<syncer::AttachmentService> CreateAttachmentService(
+ scoped_ptr<syncer::AttachmentStoreForSync> attachment_store,
+ const syncer::UserShare& user_share,
+ const std::string& store_birthday,
+ syncer::ModelType model_type,
+ syncer::AttachmentService::Delegate* delegate) override {
+ return syncer::AttachmentServiceImpl::CreateForTest();
+ }
+};
+
class SyncSharedChangeProcessorTest :
public testing::Test,
- public SyncApiComponentFactory {
+ public FakeSyncClient {
public:
SyncSharedChangeProcessorTest()
- : backend_thread_("dbthread"),
+ : FakeSyncClient(&factory_),
+ backend_thread_("dbthread"),
did_connect_(false),
has_attachment_service_(false) {}
@@ -46,20 +98,12 @@ class SyncSharedChangeProcessorTest :
EXPECT_FALSE(db_syncable_service_.get());
}
+ // FakeSyncClient override.
base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType(
syncer::ModelType type) override {
return db_syncable_service_->AsWeakPtr();
}
- scoped_ptr<syncer::AttachmentService> CreateAttachmentService(
- scoped_ptr<syncer::AttachmentStoreForSync> attachment_store,
- const syncer::UserShare& user_share,
- const std::string& store_birthday,
- syncer::ModelType model_type,
- syncer::AttachmentService::Delegate* delegate) override {
- return syncer::AttachmentServiceImpl::CreateForTest();
- }
-
protected:
void SetUp() override {
test_user_share_.SetUp();
@@ -164,6 +208,7 @@ class SyncSharedChangeProcessorTest :
base::MessageLoop frontend_loop_;
base::Thread backend_thread_;
syncer::TestUserShare test_user_share_;
+ TestSyncApiComponentFactory factory_;
scoped_refptr<SharedChangeProcessor> shared_change_processor_;
StrictMock<DataTypeErrorHandlerMock> error_handler_;
« no previous file with comments | « components/sync_driver/shared_change_processor.cc ('k') | components/sync_driver/sync_api_component_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698