| OLD | NEW |
| 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 "sync/internal_api/public/test/test_internal_components_factory.h" | 5 #include "sync/internal_api/public/test/test_internal_components_factory.h" |
| 6 | 6 |
| 7 #include "sync/sessions/sync_session_context.h" | 7 #include "sync/sessions/sync_session_context.h" |
| 8 #include "sync/syncable/in_memory_directory_backing_store.h" | 8 #include "sync/syncable/in_memory_directory_backing_store.h" |
| 9 #include "sync/syncable/on_disk_directory_backing_store.h" | 9 #include "sync/syncable/on_disk_directory_backing_store.h" |
| 10 #include "sync/test/engine/fake_sync_scheduler.h" | 10 #include "sync/test/engine/fake_sync_scheduler.h" |
| 11 | 11 |
| 12 namespace syncer { | 12 namespace syncer { |
| 13 | 13 |
| 14 TestInternalComponentsFactory::TestInternalComponentsFactory( | 14 TestInternalComponentsFactory::TestInternalComponentsFactory( |
| 15 StorageOption option) | 15 StorageOption option) |
| 16 : storage_option_(option) { | 16 : storage_option_(option) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 TestInternalComponentsFactory::~TestInternalComponentsFactory() { } | 19 TestInternalComponentsFactory::~TestInternalComponentsFactory() { } |
| 20 | 20 |
| 21 scoped_ptr<SyncScheduler> TestInternalComponentsFactory::BuildScheduler( | 21 scoped_ptr<SyncScheduler> TestInternalComponentsFactory::BuildScheduler( |
| 22 const std::string& name, sessions::SyncSessionContext* context) { | 22 const std::string& name, sessions::SyncSessionContext* context) { |
| 23 return scoped_ptr<SyncScheduler>(new FakeSyncScheduler()); | 23 return scoped_ptr<SyncScheduler>(new FakeSyncScheduler()); |
| 24 } | 24 } |
| 25 | 25 |
| 26 scoped_ptr<sessions::SyncSessionContext> | 26 scoped_ptr<sessions::SyncSessionContext> |
| 27 TestInternalComponentsFactory::BuildContext( | 27 TestInternalComponentsFactory::BuildContext( |
| 28 ServerConnectionManager* connection_manager, | 28 ServerConnectionManager* connection_manager, |
| 29 syncable::Directory* directory, | 29 syncable::Directory* directory, |
| 30 const ModelSafeRoutingInfo& routing_info, | |
| 31 const std::vector<ModelSafeWorker*> workers, | 30 const std::vector<ModelSafeWorker*> workers, |
| 32 ExtensionsActivityMonitor* monitor, | 31 ExtensionsActivityMonitor* monitor, |
| 33 ThrottledDataTypeTracker* throttled_data_type_tracker, | 32 ThrottledDataTypeTracker* throttled_data_type_tracker, |
| 34 const std::vector<SyncEngineEventListener*>& listeners, | 33 const std::vector<SyncEngineEventListener*>& listeners, |
| 35 sessions::DebugInfoGetter* debug_info_getter, | 34 sessions::DebugInfoGetter* debug_info_getter, |
| 36 TrafficRecorder* traffic_recorder) { | 35 TrafficRecorder* traffic_recorder) { |
| 37 | 36 |
| 38 // Tests don't wire up listeners. | 37 // Tests don't wire up listeners. |
| 39 std::vector<SyncEngineEventListener*> empty_listeners; | 38 std::vector<SyncEngineEventListener*> empty_listeners; |
| 40 return scoped_ptr<sessions::SyncSessionContext>( | 39 return scoped_ptr<sessions::SyncSessionContext>( |
| 41 new sessions::SyncSessionContext(connection_manager, directory, | 40 new sessions::SyncSessionContext( |
| 42 routing_info, workers, monitor, throttled_data_type_tracker, | 41 connection_manager, directory, workers, monitor, |
| 43 empty_listeners, debug_info_getter, traffic_recorder)); | 42 throttled_data_type_tracker, empty_listeners, debug_info_getter, |
| 43 traffic_recorder)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 scoped_ptr<syncable::DirectoryBackingStore> | 46 scoped_ptr<syncable::DirectoryBackingStore> |
| 47 TestInternalComponentsFactory::BuildDirectoryBackingStore( | 47 TestInternalComponentsFactory::BuildDirectoryBackingStore( |
| 48 const std::string& dir_name, const FilePath& backing_filepath) { | 48 const std::string& dir_name, const FilePath& backing_filepath) { |
| 49 if (storage_option_ == IN_MEMORY) { | 49 if (storage_option_ == IN_MEMORY) { |
| 50 return scoped_ptr<syncable::DirectoryBackingStore>( | 50 return scoped_ptr<syncable::DirectoryBackingStore>( |
| 51 new syncable::InMemoryDirectoryBackingStore(dir_name)); | 51 new syncable::InMemoryDirectoryBackingStore(dir_name)); |
| 52 } else { | 52 } else { |
| 53 return scoped_ptr<syncable::DirectoryBackingStore>( | 53 return scoped_ptr<syncable::DirectoryBackingStore>( |
| 54 new syncable::OnDiskDirectoryBackingStore(dir_name, | 54 new syncable::OnDiskDirectoryBackingStore(dir_name, |
| 55 backing_filepath)); | 55 backing_filepath)); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace syncer | 59 } // namespace syncer |
| OLD | NEW |