• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #include "chrome/browser/sync/profile_sync_components_factory_mock.h"
6 #include "components/sync_driver/change_processor.h"
7 #include "components/sync_driver/model_associator.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "sync/api/attachments/attachment_service_impl.h"
10 #include "sync/internal_api/public/attachments/fake_attachment_store.h"
11 
12 using browser_sync::AssociatorInterface;
13 using browser_sync::ChangeProcessor;
14 using testing::_;
15 using testing::InvokeWithoutArgs;
16 
ProfileSyncComponentsFactoryMock()17 ProfileSyncComponentsFactoryMock::ProfileSyncComponentsFactoryMock() {}
18 
ProfileSyncComponentsFactoryMock(AssociatorInterface * model_associator,ChangeProcessor * change_processor)19 ProfileSyncComponentsFactoryMock::ProfileSyncComponentsFactoryMock(
20     AssociatorInterface* model_associator, ChangeProcessor* change_processor)
21     : model_associator_(model_associator),
22       change_processor_(change_processor) {
23   ON_CALL(*this, CreateBookmarkSyncComponents(_, _)).
24       WillByDefault(
25           InvokeWithoutArgs(
26               this,
27               &ProfileSyncComponentsFactoryMock::MakeSyncComponents));
28 }
29 
~ProfileSyncComponentsFactoryMock()30 ProfileSyncComponentsFactoryMock::~ProfileSyncComponentsFactoryMock() {}
31 
32 scoped_ptr<syncer::AttachmentService>
CreateAttachmentService(syncer::AttachmentService::Delegate * delegate)33 ProfileSyncComponentsFactoryMock::CreateAttachmentService(
34     syncer::AttachmentService::Delegate* delegate) {
35   return syncer::AttachmentServiceImpl::CreateForTest();
36 }
37 
38 ProfileSyncComponentsFactory::SyncComponents
MakeSyncComponents()39 ProfileSyncComponentsFactoryMock::MakeSyncComponents() {
40   return SyncComponents(model_associator_.release(),
41                         change_processor_.release());
42 }
43