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

Side by Side 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: remove SetSchedulerForTest 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 SyncScheduler* TestInternalComponentsFactory::BuildScheduler(
22 const std::string& name, sessions::SyncSessionContext* context) {
23 return new FakeSyncScheduler();
24 }
25
26 sessions::SyncSessionContext* TestInternalComponentsFactory::BuildContext(
27 ServerConnectionManager* connection_manager,
28 syncable::Directory* directory,
29 const ModelSafeRoutingInfo& routing_info,
30 const std::vector<ModelSafeWorker*> workers,
31 ExtensionsActivityMonitor* monitor,
32 ThrottledDataTypeTracker* throttled_data_type_tracker,
33 const std::vector<SyncEngineEventListener*>& listeners,
34 sessions::DebugInfoGetter* debug_info_getter,
35 syncer::TrafficRecorder* traffic_recorder) {
36
37 // Tests don't wire up listeners.
38 std::vector<SyncEngineEventListener*> empty_listeners;
39 return new sessions::SyncSessionContext(connection_manager, directory,
40 routing_info, workers, monitor, throttled_data_type_tracker,
41 empty_listeners, debug_info_getter, traffic_recorder);
42 }
43
44 syncable::DirectoryBackingStore*
45 TestInternalComponentsFactory::BuildDirectoryBackingStore(
46 const std::string& dir_name, const FilePath& backing_filepath) {
47 if (storage_option_ == IN_MEMORY) {
48 return new syncable::InMemoryDirectoryBackingStore(dir_name);
49 } else {
50 return new syncable::OnDiskDirectoryBackingStore(dir_name,
51 backing_filepath);
52 }
53 }
54
55 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698