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

Side by Side Diff: sync/internal_api/test/test_internal_components_factory.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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
« no previous file with comments | « sync/internal_api/test/test_entry_factory.cc ('k') | sync/internal_api/test/test_user_share.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/syncable/invalid_directory_backing_store.h"
11 #include "sync/test/engine/fake_sync_scheduler.h"
12
13 namespace syncer {
14
15 TestInternalComponentsFactory::TestInternalComponentsFactory(
16 const Switches& switches,
17 StorageOption option,
18 StorageOption* storage_used)
19 : switches_(switches),
20 storage_override_(option),
21 storage_used_(storage_used) {
22 }
23
24 TestInternalComponentsFactory::~TestInternalComponentsFactory() { }
25
26 std::unique_ptr<SyncScheduler> TestInternalComponentsFactory::BuildScheduler(
27 const std::string& name,
28 sessions::SyncSessionContext* context,
29 syncer::CancelationSignal* cancelation_signal) {
30 return std::unique_ptr<SyncScheduler>(new FakeSyncScheduler());
31 }
32
33 std::unique_ptr<sessions::SyncSessionContext>
34 TestInternalComponentsFactory::BuildContext(
35 ServerConnectionManager* connection_manager,
36 syncable::Directory* directory,
37 ExtensionsActivity* monitor,
38 const std::vector<SyncEngineEventListener*>& listeners,
39 sessions::DebugInfoGetter* debug_info_getter,
40 ModelTypeRegistry* model_type_registry,
41 const std::string& invalidator_client_id) {
42 // Tests don't wire up listeners.
43 std::vector<SyncEngineEventListener*> empty_listeners;
44 return std::unique_ptr<sessions::SyncSessionContext>(
45 new sessions::SyncSessionContext(
46 connection_manager, directory, monitor, empty_listeners,
47 debug_info_getter, model_type_registry,
48 switches_.encryption_method == ENCRYPTION_KEYSTORE,
49 switches_.pre_commit_updates_policy ==
50 FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE,
51 invalidator_client_id));
52 }
53
54 std::unique_ptr<syncable::DirectoryBackingStore>
55 TestInternalComponentsFactory::BuildDirectoryBackingStore(
56 StorageOption storage,
57 const std::string& dir_name,
58 const base::FilePath& backing_filepath) {
59 if (storage_used_)
60 *storage_used_ = storage;
61
62 switch (storage_override_) {
63 case STORAGE_IN_MEMORY:
64 return std::unique_ptr<syncable::DirectoryBackingStore>(
65 new syncable::InMemoryDirectoryBackingStore(dir_name));
66 case STORAGE_ON_DISK:
67 return std::unique_ptr<syncable::DirectoryBackingStore>(
68 new syncable::OnDiskDirectoryBackingStore(dir_name,
69 backing_filepath));
70 case STORAGE_INVALID:
71 return std::unique_ptr<syncable::DirectoryBackingStore>(
72 new syncable::InvalidDirectoryBackingStore());
73 }
74 NOTREACHED();
75 return std::unique_ptr<syncable::DirectoryBackingStore>();
76 }
77
78 InternalComponentsFactory::Switches
79 TestInternalComponentsFactory::GetSwitches() const {
80 return switches_;
81 }
82
83 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/test/test_entry_factory.cc ('k') | sync/internal_api/test/test_user_share.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698