OLD | NEW |
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/test/engine/fake_sync_scheduler.h" | 11 #include "sync/test/engine/fake_sync_scheduler.h" |
11 | 12 |
12 namespace syncer { | 13 namespace syncer { |
13 | 14 |
14 TestInternalComponentsFactory::TestInternalComponentsFactory( | 15 TestInternalComponentsFactory::TestInternalComponentsFactory( |
15 StorageOption option) | 16 StorageOption option) |
16 : storage_option_(option) { | 17 : storage_option_(option) { |
17 } | 18 } |
18 | 19 |
19 TestInternalComponentsFactory::~TestInternalComponentsFactory() { } | 20 TestInternalComponentsFactory::~TestInternalComponentsFactory() { } |
(...skipping 19 matching lines...) Expand all Loading... |
39 return scoped_ptr<sessions::SyncSessionContext>( | 40 return scoped_ptr<sessions::SyncSessionContext>( |
40 new sessions::SyncSessionContext( | 41 new sessions::SyncSessionContext( |
41 connection_manager, directory, workers, monitor, | 42 connection_manager, directory, workers, monitor, |
42 throttled_data_type_tracker, empty_listeners, debug_info_getter, | 43 throttled_data_type_tracker, empty_listeners, debug_info_getter, |
43 traffic_recorder)); | 44 traffic_recorder)); |
44 } | 45 } |
45 | 46 |
46 scoped_ptr<syncable::DirectoryBackingStore> | 47 scoped_ptr<syncable::DirectoryBackingStore> |
47 TestInternalComponentsFactory::BuildDirectoryBackingStore( | 48 TestInternalComponentsFactory::BuildDirectoryBackingStore( |
48 const std::string& dir_name, const FilePath& backing_filepath) { | 49 const std::string& dir_name, const FilePath& backing_filepath) { |
49 if (storage_option_ == IN_MEMORY) { | 50 switch (storage_option_) { |
50 return scoped_ptr<syncable::DirectoryBackingStore>( | 51 case STORAGE_IN_MEMORY: |
51 new syncable::InMemoryDirectoryBackingStore(dir_name)); | 52 return scoped_ptr<syncable::DirectoryBackingStore>( |
52 } else { | 53 new syncable::InMemoryDirectoryBackingStore(dir_name)); |
53 return scoped_ptr<syncable::DirectoryBackingStore>( | 54 case STORAGE_ON_DISK: |
54 new syncable::OnDiskDirectoryBackingStore(dir_name, | 55 return scoped_ptr<syncable::DirectoryBackingStore>( |
55 backing_filepath)); | 56 new syncable::OnDiskDirectoryBackingStore(dir_name, |
| 57 backing_filepath)); |
| 58 case STORAGE_INVALID: |
| 59 return scoped_ptr<syncable::DirectoryBackingStore>( |
| 60 new syncable::InvalidDirectoryBackingStore()); |
56 } | 61 } |
| 62 NOTREACHED(); |
| 63 return scoped_ptr<syncable::DirectoryBackingStore>(); |
57 } | 64 } |
58 | 65 |
59 } // namespace syncer | 66 } // namespace syncer |
OLD | NEW |