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

Side by Side Diff: components/sync/engine/test_engine_components_factory.cc

Issue 2413313004: [Sync] Move the last things out of core/. (Closed)
Patch Set: Address comments. Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync/core/test/test_internal_components_factory.h" 5 #include "components/sync/engine/test_engine_components_factory.h"
6 6
7 #include "components/sync/engine_impl/cycle/sync_cycle_context.h" 7 #include "components/sync/engine_impl/cycle/sync_cycle_context.h"
8 #include "components/sync/syncable/in_memory_directory_backing_store.h" 8 #include "components/sync/syncable/in_memory_directory_backing_store.h"
9 #include "components/sync/syncable/invalid_directory_backing_store.h" 9 #include "components/sync/syncable/invalid_directory_backing_store.h"
10 #include "components/sync/syncable/on_disk_directory_backing_store.h" 10 #include "components/sync/syncable/on_disk_directory_backing_store.h"
11 #include "components/sync/test/engine/fake_sync_scheduler.h" 11 #include "components/sync/test/engine/fake_sync_scheduler.h"
12 12
13 namespace syncer { 13 namespace syncer {
14 14
15 TestInternalComponentsFactory::TestInternalComponentsFactory( 15 TestEngineComponentsFactory::TestEngineComponentsFactory(
16 const Switches& switches, 16 const Switches& switches,
17 StorageOption option, 17 StorageOption option,
18 StorageOption* storage_used) 18 StorageOption* storage_used)
19 : switches_(switches), 19 : switches_(switches),
20 storage_override_(option), 20 storage_override_(option),
21 storage_used_(storage_used) {} 21 storage_used_(storage_used) {}
22 22
23 TestInternalComponentsFactory::~TestInternalComponentsFactory() {} 23 TestEngineComponentsFactory::~TestEngineComponentsFactory() {}
24 24
25 std::unique_ptr<SyncScheduler> TestInternalComponentsFactory::BuildScheduler( 25 std::unique_ptr<SyncScheduler> TestEngineComponentsFactory::BuildScheduler(
26 const std::string& name, 26 const std::string& name,
27 SyncCycleContext* context, 27 SyncCycleContext* context,
28 CancelationSignal* cancelation_signal) { 28 CancelationSignal* cancelation_signal) {
29 return std::unique_ptr<SyncScheduler>(new FakeSyncScheduler()); 29 return std::unique_ptr<SyncScheduler>(new FakeSyncScheduler());
30 } 30 }
31 31
32 std::unique_ptr<SyncCycleContext> TestInternalComponentsFactory::BuildContext( 32 std::unique_ptr<SyncCycleContext> TestEngineComponentsFactory::BuildContext(
33 ServerConnectionManager* connection_manager, 33 ServerConnectionManager* connection_manager,
34 syncable::Directory* directory, 34 syncable::Directory* directory,
35 ExtensionsActivity* monitor, 35 ExtensionsActivity* monitor,
36 const std::vector<SyncEngineEventListener*>& listeners, 36 const std::vector<SyncEngineEventListener*>& listeners,
37 DebugInfoGetter* debug_info_getter, 37 DebugInfoGetter* debug_info_getter,
38 ModelTypeRegistry* model_type_registry, 38 ModelTypeRegistry* model_type_registry,
39 const std::string& invalidator_client_id) { 39 const std::string& invalidator_client_id) {
40 // Tests don't wire up listeners. 40 // Tests don't wire up listeners.
41 std::vector<SyncEngineEventListener*> empty_listeners; 41 std::vector<SyncEngineEventListener*> empty_listeners;
42 return std::unique_ptr<SyncCycleContext>(new SyncCycleContext( 42 return std::unique_ptr<SyncCycleContext>(new SyncCycleContext(
43 connection_manager, directory, monitor, empty_listeners, 43 connection_manager, directory, monitor, empty_listeners,
44 debug_info_getter, model_type_registry, 44 debug_info_getter, model_type_registry,
45 switches_.encryption_method == ENCRYPTION_KEYSTORE, 45 switches_.encryption_method == ENCRYPTION_KEYSTORE,
46 switches_.pre_commit_updates_policy == 46 switches_.pre_commit_updates_policy ==
47 FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE, 47 FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE,
48 invalidator_client_id)); 48 invalidator_client_id));
49 } 49 }
50 50
51 std::unique_ptr<syncable::DirectoryBackingStore> 51 std::unique_ptr<syncable::DirectoryBackingStore>
52 TestInternalComponentsFactory::BuildDirectoryBackingStore( 52 TestEngineComponentsFactory::BuildDirectoryBackingStore(
53 StorageOption storage, 53 StorageOption storage,
54 const std::string& dir_name, 54 const std::string& dir_name,
55 const base::FilePath& backing_filepath) { 55 const base::FilePath& backing_filepath) {
56 if (storage_used_) 56 if (storage_used_)
57 *storage_used_ = storage; 57 *storage_used_ = storage;
58 58
59 switch (storage_override_) { 59 switch (storage_override_) {
60 case STORAGE_IN_MEMORY: 60 case STORAGE_IN_MEMORY:
61 return std::unique_ptr<syncable::DirectoryBackingStore>( 61 return std::unique_ptr<syncable::DirectoryBackingStore>(
62 new syncable::InMemoryDirectoryBackingStore(dir_name)); 62 new syncable::InMemoryDirectoryBackingStore(dir_name));
63 case STORAGE_ON_DISK: 63 case STORAGE_ON_DISK:
64 return std::unique_ptr<syncable::DirectoryBackingStore>( 64 return std::unique_ptr<syncable::DirectoryBackingStore>(
65 new syncable::OnDiskDirectoryBackingStore(dir_name, 65 new syncable::OnDiskDirectoryBackingStore(dir_name,
66 backing_filepath)); 66 backing_filepath));
67 case STORAGE_INVALID: 67 case STORAGE_INVALID:
68 return std::unique_ptr<syncable::DirectoryBackingStore>( 68 return std::unique_ptr<syncable::DirectoryBackingStore>(
69 new syncable::InvalidDirectoryBackingStore()); 69 new syncable::InvalidDirectoryBackingStore());
70 } 70 }
71 NOTREACHED(); 71 NOTREACHED();
72 return std::unique_ptr<syncable::DirectoryBackingStore>(); 72 return std::unique_ptr<syncable::DirectoryBackingStore>();
73 } 73 }
74 74
75 InternalComponentsFactory::Switches TestInternalComponentsFactory::GetSwitches() 75 EngineComponentsFactory::Switches TestEngineComponentsFactory::GetSwitches()
76 const { 76 const {
77 return switches_; 77 return switches_;
78 } 78 }
79 79
80 } // namespace syncer 80 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine/test_engine_components_factory.h ('k') | components/sync/engine_impl/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698