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

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

Issue 455023003: Let SyncBackupManager keep backup data in memory until shutdown. Only persist (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ToT Created 6 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 | Annotate | Revision Log
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/deferred_on_disk_directory_backing_store.h"
8 #include "sync/syncable/in_memory_directory_backing_store.h" 9 #include "sync/syncable/in_memory_directory_backing_store.h"
9 #include "sync/syncable/on_disk_directory_backing_store.h" 10 #include "sync/syncable/on_disk_directory_backing_store.h"
10 #include "sync/syncable/invalid_directory_backing_store.h" 11 #include "sync/syncable/invalid_directory_backing_store.h"
11 #include "sync/test/engine/fake_sync_scheduler.h" 12 #include "sync/test/engine/fake_sync_scheduler.h"
12 13
13 namespace syncer { 14 namespace syncer {
14 15
15 TestInternalComponentsFactory::TestInternalComponentsFactory( 16 TestInternalComponentsFactory::TestInternalComponentsFactory(
16 const Switches& switches, 17 const Switches& switches,
17 StorageOption option) 18 StorageOption option,
19 StorageOption expected_storage)
18 : switches_(switches), 20 : switches_(switches),
19 storage_option_(option) { 21 storage_override_(option),
22 expected_storage_(expected_storage) {
20 } 23 }
21 24
22 TestInternalComponentsFactory::~TestInternalComponentsFactory() { } 25 TestInternalComponentsFactory::~TestInternalComponentsFactory() { }
23 26
24 scoped_ptr<SyncScheduler> TestInternalComponentsFactory::BuildScheduler( 27 scoped_ptr<SyncScheduler> TestInternalComponentsFactory::BuildScheduler(
25 const std::string& name, 28 const std::string& name,
26 sessions::SyncSessionContext* context, 29 sessions::SyncSessionContext* context,
27 syncer::CancelationSignal* cancelation_signal) { 30 syncer::CancelationSignal* cancelation_signal) {
28 return scoped_ptr<SyncScheduler>(new FakeSyncScheduler()); 31 return scoped_ptr<SyncScheduler>(new FakeSyncScheduler());
29 } 32 }
(...skipping 17 matching lines...) Expand all
47 model_type_registry, 50 model_type_registry,
48 switches_.encryption_method == ENCRYPTION_KEYSTORE, 51 switches_.encryption_method == ENCRYPTION_KEYSTORE,
49 switches_.pre_commit_updates_policy == 52 switches_.pre_commit_updates_policy ==
50 FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE, 53 FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE,
51 invalidator_client_id)); 54 invalidator_client_id));
52 55
53 } 56 }
54 57
55 scoped_ptr<syncable::DirectoryBackingStore> 58 scoped_ptr<syncable::DirectoryBackingStore>
56 TestInternalComponentsFactory::BuildDirectoryBackingStore( 59 TestInternalComponentsFactory::BuildDirectoryBackingStore(
57 const std::string& dir_name, const base::FilePath& backing_filepath) { 60 StorageOption storage, const std::string& dir_name,
58 switch (storage_option_) { 61 const base::FilePath& backing_filepath) {
62 CHECK_EQ(expected_storage_, storage);
Nicolas Zea 2014/08/13 20:32:05 I prefer keeping the verification of expectations
haitaol1 2014/08/14 01:30:34 Done.
63
64 switch (storage_override_) {
59 case STORAGE_IN_MEMORY: 65 case STORAGE_IN_MEMORY:
60 return scoped_ptr<syncable::DirectoryBackingStore>( 66 return scoped_ptr<syncable::DirectoryBackingStore>(
61 new syncable::InMemoryDirectoryBackingStore(dir_name)); 67 new syncable::InMemoryDirectoryBackingStore(dir_name));
62 case STORAGE_ON_DISK: 68 case STORAGE_ON_DISK:
63 return scoped_ptr<syncable::DirectoryBackingStore>( 69 return scoped_ptr<syncable::DirectoryBackingStore>(
64 new syncable::OnDiskDirectoryBackingStore(dir_name, 70 new syncable::OnDiskDirectoryBackingStore(dir_name,
65 backing_filepath)); 71 backing_filepath));
72 case STORAGE_ON_DISK_DEFERRED:
73 return scoped_ptr<syncable::DirectoryBackingStore>(
74 new syncable::DeferredOnDiskDirectoryBackingStore(dir_name,
75 backing_filepath));
66 case STORAGE_INVALID: 76 case STORAGE_INVALID:
67 return scoped_ptr<syncable::DirectoryBackingStore>( 77 return scoped_ptr<syncable::DirectoryBackingStore>(
68 new syncable::InvalidDirectoryBackingStore()); 78 new syncable::InvalidDirectoryBackingStore());
69 } 79 }
70 NOTREACHED(); 80 NOTREACHED();
71 return scoped_ptr<syncable::DirectoryBackingStore>(); 81 return scoped_ptr<syncable::DirectoryBackingStore>();
72 } 82 }
73 83
74 InternalComponentsFactory::Switches 84 InternalComponentsFactory::Switches
75 TestInternalComponentsFactory::GetSwitches() const { 85 TestInternalComponentsFactory::GetSwitches() const {
76 return switches_; 86 return switches_;
77 } 87 }
78 88
79 } // namespace syncer 89 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698