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

Side by Side Diff: components/sync/driver/sync_api_component_factory_mock.cc

Issue 2289143003: [Sync] Convert DTCs to be not RefCounted and NonThreadSafe. (Closed)
Patch Set: Rebase. Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync/driver/sync_api_component_factory_mock.h" 5 #include "components/sync/driver/sync_api_component_factory_mock.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "components/sync/api/attachments/attachment_store.h" 9 #include "components/sync/api/attachments/attachment_store.h"
10 #include "components/sync/core/attachments/attachment_service_impl.h" 10 #include "components/sync/core/attachments/attachment_service_impl.h"
11 #include "components/sync/device_info/local_device_info_provider_mock.h" 11 #include "components/sync/device_info/local_device_info_provider_mock.h"
12 #include "components/sync/driver/change_processor.h" 12 #include "components/sync/driver/change_processor.h"
13 #include "components/sync/driver/model_associator.h" 13 #include "components/sync/driver/model_associator.h"
14 14
15 using sync_driver::AssociatorInterface; 15 using sync_driver::AssociatorInterface;
16 using sync_driver::ChangeProcessor; 16 using sync_driver::ChangeProcessor;
17 using testing::_; 17 using testing::_;
18 using testing::InvokeWithoutArgs; 18 using testing::InvokeWithoutArgs;
19 using testing::Return; 19 using testing::Return;
20 20
21 SyncApiComponentFactoryMock::SyncApiComponentFactoryMock() 21 SyncApiComponentFactoryMock::SyncApiComponentFactoryMock()
22 : local_device_(new sync_driver::LocalDeviceInfoProviderMock()) {} 22 : local_device_(new sync_driver::LocalDeviceInfoProviderMock()) {}
23 23
24 SyncApiComponentFactoryMock::SyncApiComponentFactoryMock( 24 SyncApiComponentFactoryMock::SyncApiComponentFactoryMock(
25 AssociatorInterface* model_associator, 25 AssociatorInterface* model_associator,
26 ChangeProcessor* change_processor) 26 ChangeProcessor* change_processor)
27 : model_associator_(model_associator), 27 : model_associator_(model_associator),
28 change_processor_(change_processor), 28 change_processor_(change_processor),
29 local_device_(new sync_driver::LocalDeviceInfoProviderMock()) { 29 local_device_(new sync_driver::LocalDeviceInfoProviderMock()) {
30 ON_CALL(*this, CreateBookmarkSyncComponents(_, _))
31 .WillByDefault(InvokeWithoutArgs(
32 this, &SyncApiComponentFactoryMock::MakeSyncComponents));
33 } 30 }
34 31
35 SyncApiComponentFactoryMock::~SyncApiComponentFactoryMock() {} 32 SyncApiComponentFactoryMock::~SyncApiComponentFactoryMock() {}
36 33
37 std::unique_ptr<syncer::AttachmentService> 34 std::unique_ptr<syncer::AttachmentService>
38 SyncApiComponentFactoryMock::CreateAttachmentService( 35 SyncApiComponentFactoryMock::CreateAttachmentService(
39 std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store, 36 std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store,
40 const syncer::UserShare& user_share, 37 const syncer::UserShare& user_share,
41 const std::string& store_birthday, 38 const std::string& store_birthday,
42 syncer::ModelType model_type, 39 syncer::ModelType model_type,
43 syncer::AttachmentService::Delegate* delegate) { 40 syncer::AttachmentService::Delegate* delegate) {
44 return syncer::AttachmentServiceImpl::CreateForTest(); 41 return syncer::AttachmentServiceImpl::CreateForTest();
45 } 42 }
46 43
47 sync_driver::SyncApiComponentFactory::SyncComponents 44 sync_driver::SyncApiComponentFactory::SyncComponents
45 SyncApiComponentFactoryMock::CreateBookmarkSyncComponents(
46 sync_driver::SyncService* sync_service,
47 std::unique_ptr<syncer::DataTypeErrorHandler> error_handler) {
48 return MakeSyncComponents();
49 }
50
51 sync_driver::SyncApiComponentFactory::SyncComponents
48 SyncApiComponentFactoryMock::MakeSyncComponents() { 52 SyncApiComponentFactoryMock::MakeSyncComponents() {
49 return sync_driver::SyncApiComponentFactory::SyncComponents( 53 return sync_driver::SyncApiComponentFactory::SyncComponents(
50 model_associator_.release(), change_processor_.release()); 54 model_associator_.release(), change_processor_.release());
51 } 55 }
52 56
53 std::unique_ptr<sync_driver::LocalDeviceInfoProvider> 57 std::unique_ptr<sync_driver::LocalDeviceInfoProvider>
54 SyncApiComponentFactoryMock::CreateLocalDeviceInfoProvider() { 58 SyncApiComponentFactoryMock::CreateLocalDeviceInfoProvider() {
55 return std::move(local_device_); 59 return std::move(local_device_);
56 } 60 }
57 61
58 void SyncApiComponentFactoryMock::SetLocalDeviceInfoProvider( 62 void SyncApiComponentFactoryMock::SetLocalDeviceInfoProvider(
59 std::unique_ptr<sync_driver::LocalDeviceInfoProvider> local_device) { 63 std::unique_ptr<sync_driver::LocalDeviceInfoProvider> local_device) {
60 local_device_ = std::move(local_device); 64 local_device_ = std::move(local_device);
61 } 65 }
OLDNEW
« no previous file with comments | « components/sync/driver/sync_api_component_factory_mock.h ('k') | components/sync/driver/sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698