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

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

Issue 1866243002: Convert //sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 "sync/internal_api/public/test/test_internal_components_factory.h" 5 #include "sync/internal_api/public/test/test_internal_components_factory.h"
6 6
7 #include "sync/sessions/sync_session_context.h" 7 #include "sync/sessions/sync_session_context.h"
8 #include "sync/syncable/in_memory_directory_backing_store.h" 8 #include "sync/syncable/in_memory_directory_backing_store.h"
9 #include "sync/syncable/on_disk_directory_backing_store.h" 9 #include "sync/syncable/on_disk_directory_backing_store.h"
10 #include "sync/syncable/invalid_directory_backing_store.h" 10 #include "sync/syncable/invalid_directory_backing_store.h"
11 #include "sync/test/engine/fake_sync_scheduler.h" 11 #include "sync/test/engine/fake_sync_scheduler.h"
12 12
13 namespace syncer { 13 namespace syncer {
14 14
15 TestInternalComponentsFactory::TestInternalComponentsFactory( 15 TestInternalComponentsFactory::TestInternalComponentsFactory(
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 23
24 TestInternalComponentsFactory::~TestInternalComponentsFactory() { } 24 TestInternalComponentsFactory::~TestInternalComponentsFactory() { }
25 25
26 scoped_ptr<SyncScheduler> TestInternalComponentsFactory::BuildScheduler( 26 std::unique_ptr<SyncScheduler> TestInternalComponentsFactory::BuildScheduler(
27 const std::string& name, 27 const std::string& name,
28 sessions::SyncSessionContext* context, 28 sessions::SyncSessionContext* context,
29 syncer::CancelationSignal* cancelation_signal) { 29 syncer::CancelationSignal* cancelation_signal) {
30 return scoped_ptr<SyncScheduler>(new FakeSyncScheduler()); 30 return std::unique_ptr<SyncScheduler>(new FakeSyncScheduler());
31 } 31 }
32 32
33 scoped_ptr<sessions::SyncSessionContext> 33 std::unique_ptr<sessions::SyncSessionContext>
34 TestInternalComponentsFactory::BuildContext( 34 TestInternalComponentsFactory::BuildContext(
35 ServerConnectionManager* connection_manager, 35 ServerConnectionManager* connection_manager,
36 syncable::Directory* directory, 36 syncable::Directory* directory,
37 ExtensionsActivity* monitor, 37 ExtensionsActivity* monitor,
38 const std::vector<SyncEngineEventListener*>& listeners, 38 const std::vector<SyncEngineEventListener*>& listeners,
39 sessions::DebugInfoGetter* debug_info_getter, 39 sessions::DebugInfoGetter* debug_info_getter,
40 ModelTypeRegistry* model_type_registry, 40 ModelTypeRegistry* model_type_registry,
41 const std::string& invalidator_client_id) { 41 const std::string& invalidator_client_id) {
42
43 // Tests don't wire up listeners. 42 // Tests don't wire up listeners.
44 std::vector<SyncEngineEventListener*> empty_listeners; 43 std::vector<SyncEngineEventListener*> empty_listeners;
45 return scoped_ptr<sessions::SyncSessionContext>( 44 return std::unique_ptr<sessions::SyncSessionContext>(
46 new sessions::SyncSessionContext( 45 new sessions::SyncSessionContext(
47 connection_manager, directory, monitor, 46 connection_manager, directory, monitor, empty_listeners,
48 empty_listeners, debug_info_getter, 47 debug_info_getter, model_type_registry,
49 model_type_registry,
50 switches_.encryption_method == ENCRYPTION_KEYSTORE, 48 switches_.encryption_method == ENCRYPTION_KEYSTORE,
51 switches_.pre_commit_updates_policy == 49 switches_.pre_commit_updates_policy ==
52 FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE, 50 FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE,
53 invalidator_client_id)); 51 invalidator_client_id));
54 } 52 }
55 53
56 scoped_ptr<syncable::DirectoryBackingStore> 54 std::unique_ptr<syncable::DirectoryBackingStore>
57 TestInternalComponentsFactory::BuildDirectoryBackingStore( 55 TestInternalComponentsFactory::BuildDirectoryBackingStore(
58 StorageOption storage, const std::string& dir_name, 56 StorageOption storage,
57 const std::string& dir_name,
59 const base::FilePath& backing_filepath) { 58 const base::FilePath& backing_filepath) {
60 if (storage_used_) 59 if (storage_used_)
61 *storage_used_ = storage; 60 *storage_used_ = storage;
62 61
63 switch (storage_override_) { 62 switch (storage_override_) {
64 case STORAGE_IN_MEMORY: 63 case STORAGE_IN_MEMORY:
65 return scoped_ptr<syncable::DirectoryBackingStore>( 64 return std::unique_ptr<syncable::DirectoryBackingStore>(
66 new syncable::InMemoryDirectoryBackingStore(dir_name)); 65 new syncable::InMemoryDirectoryBackingStore(dir_name));
67 case STORAGE_ON_DISK: 66 case STORAGE_ON_DISK:
68 return scoped_ptr<syncable::DirectoryBackingStore>( 67 return std::unique_ptr<syncable::DirectoryBackingStore>(
69 new syncable::OnDiskDirectoryBackingStore(dir_name, 68 new syncable::OnDiskDirectoryBackingStore(dir_name,
70 backing_filepath)); 69 backing_filepath));
71 case STORAGE_INVALID: 70 case STORAGE_INVALID:
72 return scoped_ptr<syncable::DirectoryBackingStore>( 71 return std::unique_ptr<syncable::DirectoryBackingStore>(
73 new syncable::InvalidDirectoryBackingStore()); 72 new syncable::InvalidDirectoryBackingStore());
74 } 73 }
75 NOTREACHED(); 74 NOTREACHED();
76 return scoped_ptr<syncable::DirectoryBackingStore>(); 75 return std::unique_ptr<syncable::DirectoryBackingStore>();
77 } 76 }
78 77
79 InternalComponentsFactory::Switches 78 InternalComponentsFactory::Switches
80 TestInternalComponentsFactory::GetSwitches() const { 79 TestInternalComponentsFactory::GetSwitches() const {
81 return switches_; 80 return switches_;
82 } 81 }
83 82
84 } // namespace syncer 83 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698