Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Unified Diff: sync/internal_api/test/test_internal_components_factory.cc

Issue 10701046: sync: Remove SyncManager::TestingMode in favour of InternalComponentsFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: now with more scope Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/internal_api/test/fake_sync_manager.cc ('k') | sync/sync.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..df607710d77ca01fe6c5aa599e21e656a36b68f2
--- /dev/null
+++ b/sync/internal_api/test/test_internal_components_factory.cc
@@ -0,0 +1,59 @@
+// 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) {
+}
+
+TestInternalComponentsFactory::~TestInternalComponentsFactory() { }
+
+scoped_ptr<SyncScheduler> TestInternalComponentsFactory::BuildScheduler(
+ const std::string& name, sessions::SyncSessionContext* context) {
+ return scoped_ptr<SyncScheduler>(new FakeSyncScheduler());
+}
+
+scoped_ptr<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 scoped_ptr<sessions::SyncSessionContext>(
+ 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
+ routing_info, workers, monitor, throttled_data_type_tracker,
+ empty_listeners, debug_info_getter, traffic_recorder));
+}
+
+scoped_ptr<syncable::DirectoryBackingStore>
+TestInternalComponentsFactory::BuildDirectoryBackingStore(
+ const std::string& dir_name, const FilePath& backing_filepath) {
+ if (storage_option_ == IN_MEMORY) {
+ return scoped_ptr<syncable::DirectoryBackingStore>(
+ new syncable::InMemoryDirectoryBackingStore(dir_name));
+ } else {
+ return scoped_ptr<syncable::DirectoryBackingStore>(
+ new syncable::OnDiskDirectoryBackingStore(dir_name,
+ backing_filepath));
+ }
+}
+
+} // namespace syncer
« no previous file with comments | « sync/internal_api/test/fake_sync_manager.cc ('k') | sync/sync.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698