Chromium Code Reviews| Index: sync/internal_api/test/test_internal_components_factory.cc |
| diff --git a/sync/internal_api/test/test_internal_components_factory.cc b/sync/internal_api/test/test_internal_components_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..49cc289959e79ba0612a947bb058b3b1bb03810e |
| --- /dev/null |
| +++ b/sync/internal_api/test/test_internal_components_factory.cc |
| @@ -0,0 +1,54 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "sync/internal_api/public/test/test_internal_components_factory.h" |
| + |
| +#include "sync/sessions/sync_session_context.h" |
| +#include "sync/syncable/in_memory_directory_backing_store.h" |
| +#include "sync/syncable/on_disk_directory_backing_store.h" |
| +#include "sync/test/engine/fake_sync_scheduler.h" |
| + |
| +namespace syncer { |
| + |
| +TestInternalComponentsFactory::TestInternalComponentsFactory( |
| + 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
|
| +} |
| + |
| +TestInternalComponentsFactory::~TestInternalComponentsFactory() { } |
| + |
| +SyncScheduler* TestInternalComponentsFactory::BuildScheduler( |
| + const std::string& name, sessions::SyncSessionContext* context) { |
| + return new FakeSyncScheduler(); |
| +} |
| + |
| +sessions::SyncSessionContext* TestInternalComponentsFactory::BuildContext( |
| + ServerConnectionManager* connection_manager, |
| + syncable::Directory* directory, |
| + const ModelSafeRoutingInfo& routing_info, |
| + const std::vector<ModelSafeWorker*> workers, |
| + ExtensionsActivityMonitor* monitor, |
| + ThrottledDataTypeTracker* throttled_data_type_tracker, |
| + const std::vector<SyncEngineEventListener*>& listeners, |
| + sessions::DebugInfoGetter* debug_info_getter, |
| + syncer::TrafficRecorder* traffic_recorder) { |
| + |
| + // Tests don't wire up listeners. |
| + std::vector<SyncEngineEventListener*> empty_listeners; |
| + return new sessions::SyncSessionContext(connection_manager, directory, |
| + routing_info, workers, monitor, throttled_data_type_tracker, |
| + empty_listeners, debug_info_getter, traffic_recorder); |
| +} |
| + |
| +syncable::DirectoryBackingStore* |
| +TestInternalComponentsFactory::BuildDirectoryBackingStore( |
| + const std::string& dir_name, const FilePath& backing_filepath) { |
| + if (storage_option_ == IN_MEMORY) { |
| + return new syncable::InMemoryDirectoryBackingStore(dir_name); |
| + } else { |
| + return new syncable::OnDiskDirectoryBackingStore(dir_name, |
| + backing_filepath); |
| + } |
| +} |
| + |
| +} // namespace syncer |