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) : storage_option_(option) { | |
|
Nicolas Zea
2012/07/18 21:10:12
nit: move initializer list onto next line
tim (not reviewing)
2012/07/18 21:57:47
This isn't really clear from the style guide, I al
| |
| 16 } | |
| 17 | |
| 18 TestInternalComponentsFactory::~TestInternalComponentsFactory() { } | |
| 19 | |
| 20 SyncScheduler* TestInternalComponentsFactory::BuildScheduler( | |
| 21 const std::string& name, sessions::SyncSessionContext* context) { | |
| 22 return new FakeSyncScheduler(); | |
| 23 } | |
| 24 | |
| 25 sessions::SyncSessionContext* TestInternalComponentsFactory::BuildContext( | |
| 26 ServerConnectionManager* connection_manager, | |
| 27 syncable::Directory* directory, | |
| 28 const ModelSafeRoutingInfo& routing_info, | |
| 29 const std::vector<ModelSafeWorker*> workers, | |
| 30 ExtensionsActivityMonitor* monitor, | |
| 31 ThrottledDataTypeTracker* throttled_data_type_tracker, | |
| 32 const std::vector<SyncEngineEventListener*>& listeners, | |
| 33 sessions::DebugInfoGetter* debug_info_getter, | |
| 34 syncer::TrafficRecorder* traffic_recorder) { | |
| 35 | |
| 36 // Tests don't wire up listeners. | |
| 37 std::vector<SyncEngineEventListener*> empty_listeners; | |
| 38 return new sessions::SyncSessionContext(connection_manager, directory, | |
| 39 routing_info, workers, monitor, throttled_data_type_tracker, | |
| 40 empty_listeners, debug_info_getter, traffic_recorder); | |
| 41 } | |
| 42 | |
| 43 syncable::DirectoryBackingStore* | |
| 44 TestInternalComponentsFactory::BuildDirectoryBackingStore( | |
| 45 const std::string& dir_name, const FilePath& backing_filepath) { | |
| 46 if (storage_option_ == IN_MEMORY) { | |
| 47 return new syncable::InMemoryDirectoryBackingStore(dir_name); | |
| 48 } else { | |
| 49 return new syncable::OnDiskDirectoryBackingStore(dir_name, | |
| 50 backing_filepath); | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 } // namespace syncer | |
| OLD | NEW |