Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 "sync/internal_api/public/test/test_internal_components_factory.h" | |
| 6 | |
| 7 #include "sync/sessions/sync_session_context.h" | |
| 8 #include "sync/syncable/in_memory_directory_backing_store.h" | |
| 9 #include "sync/syncable/on_disk_directory_backing_store.h" | |
| 10 #include "sync/test/engine/fake_sync_scheduler.h" | |
| 11 | |
| 12 namespace syncer { | |
| 13 | |
| 14 TestInternalComponentsFactory::TestInternalComponentsFactory( | |
| 15 StorageOption option) | |
| 16 : storage_option_(option) { | |
| 17 } | |
| 18 | |
| 19 TestInternalComponentsFactory::~TestInternalComponentsFactory() { } | |
| 20 | |
| 21 scoped_ptr<SyncScheduler> TestInternalComponentsFactory::BuildScheduler( | |
| 22 const std::string& name, sessions::SyncSessionContext* context) { | |
| 23 return scoped_ptr<SyncScheduler>(new FakeSyncScheduler()); | |
| 24 } | |
| 25 | |
| 26 scoped_ptr<sessions::SyncSessionContext> | |
| 27 TestInternalComponentsFactory::BuildContext( | |
| 28 ServerConnectionManager* connection_manager, | |
| 29 syncable::Directory* directory, | |
| 30 const ModelSafeRoutingInfo& routing_info, | |
| 31 const std::vector<ModelSafeWorker*> workers, | |
| 32 ExtensionsActivityMonitor* monitor, | |
| 33 ThrottledDataTypeTracker* throttled_data_type_tracker, | |
| 34 const std::vector<SyncEngineEventListener*>& listeners, | |
| 35 sessions::DebugInfoGetter* debug_info_getter, | |
| 36 syncer::TrafficRecorder* traffic_recorder) { | |
| 37 | |
| 38 // Tests don't wire up listeners. | |
| 39 std::vector<SyncEngineEventListener*> empty_listeners; | |
| 40 return scoped_ptr<sessions::SyncSessionContext>( | |
| 41 new sessions::SyncSessionContext(connection_manager, directory, | |
|
Nicolas Zea
2012/07/19 19:51:41
nit: I think style guide prefers the args all on i
tim (not reviewing)
2012/07/19 20:40:30
It says to consider one-line per arg if it makes t
Nicolas Zea
2012/07/19 20:42:38
sg, although should probably remove the stray spac
| |
| 42 routing_info, workers, monitor, throttled_data_type_tracker, | |
| 43 empty_listeners, debug_info_getter, traffic_recorder)); | |
| 44 } | |
| 45 | |
| 46 scoped_ptr<syncable::DirectoryBackingStore> | |
| 47 TestInternalComponentsFactory::BuildDirectoryBackingStore( | |
| 48 const std::string& dir_name, const FilePath& backing_filepath) { | |
| 49 if (storage_option_ == IN_MEMORY) { | |
| 50 return scoped_ptr<syncable::DirectoryBackingStore>( | |
| 51 new syncable::InMemoryDirectoryBackingStore(dir_name)); | |
| 52 } else { | |
| 53 return scoped_ptr<syncable::DirectoryBackingStore>( | |
| 54 new syncable::OnDiskDirectoryBackingStore(dir_name, | |
| 55 backing_filepath)); | |
| 56 } | |
| 57 } | |
| 58 | |
| 59 } // namespace syncer | |
| OLD | NEW |