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

Side by Side Diff: sync/internal_api/public/test/test_internal_components_factory.h

Issue 235053006: Add sync manager classes for backup/rollback: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | 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 #ifndef SYNC_INTERNAL_API_PUBLIC_TEST_TEST_INTERNAL_COMPONENTS_FACTORY_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_TEST_TEST_INTERNAL_COMPONENTS_FACTORY_H_
6 #define SYNC_INTERNAL_API_PUBLIC_TEST_TEST_INTERNAL_COMPONENTS_FACTORY_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_TEST_TEST_INTERNAL_COMPONENTS_FACTORY_H_
7 7
8 #include "sync/internal_api/public/internal_components_factory.h" 8 #include "sync/internal_api/public/internal_components_factory.h"
9 9
10 namespace syncer { 10 namespace syncer {
11 11
12 enum StorageOption { 12 enum StorageOption {
13 // BuildDirectoryBackingStore should not use persistent on-disk storage. 13 // BuildDirectoryBackingStore should not use persistent on-disk storage.
14 STORAGE_IN_MEMORY, 14 STORAGE_IN_MEMORY,
15 // Use this if you want BuildDirectoryBackingStore to create a real 15 // Use this if you want BuildDirectoryBackingStore to create a real
16 // on disk store. 16 // on disk store.
17 STORAGE_ON_DISK, 17 STORAGE_ON_DISK,
18 // Use this to test the case where a directory fails to load. 18 // Use this to test the case where a directory fails to load.
19 STORAGE_INVALID 19 STORAGE_INVALID
20 }; 20 };
21 21
22 class TestInternalComponentsFactory : public InternalComponentsFactory { 22 class TestInternalComponentsFactory : public InternalComponentsFactory {
23 public: 23 public:
24 // Create SyncSessionContext and DirectoryBackingStore using specified
25 // settings.
24 explicit TestInternalComponentsFactory(const Switches& switches, 26 explicit TestInternalComponentsFactory(const Switches& switches,
25 StorageOption option); 27 StorageOption option);
28 // Create SyncSessionContext using default settings. Return injected |store|
29 // when BuildDirectoryBackingStore() is called so that injector can check
30 // store data.
31 explicit TestInternalComponentsFactory(
32 scoped_ptr<syncable::DirectoryBackingStore> store);
26 virtual ~TestInternalComponentsFactory(); 33 virtual ~TestInternalComponentsFactory();
27 34
28 virtual scoped_ptr<SyncScheduler> BuildScheduler( 35 virtual scoped_ptr<SyncScheduler> BuildScheduler(
29 const std::string& name, 36 const std::string& name,
30 sessions::SyncSessionContext* context, 37 sessions::SyncSessionContext* context,
31 syncer::CancelationSignal* cancelation_signal) OVERRIDE; 38 syncer::CancelationSignal* cancelation_signal) OVERRIDE;
32 39
33 virtual scoped_ptr<sessions::SyncSessionContext> BuildContext( 40 virtual scoped_ptr<sessions::SyncSessionContext> BuildContext(
34 ServerConnectionManager* connection_manager, 41 ServerConnectionManager* connection_manager,
35 syncable::Directory* directory, 42 syncable::Directory* directory,
36 ExtensionsActivity* monitor, 43 ExtensionsActivity* monitor,
37 const std::vector<SyncEngineEventListener*>& listeners, 44 const std::vector<SyncEngineEventListener*>& listeners,
38 sessions::DebugInfoGetter* debug_info_getter, 45 sessions::DebugInfoGetter* debug_info_getter,
39 ModelTypeRegistry* model_type_registry, 46 ModelTypeRegistry* model_type_registry,
40 const std::string& invalidator_client_id) OVERRIDE; 47 const std::string& invalidator_client_id) OVERRIDE;
41 48
42 virtual scoped_ptr<syncable::DirectoryBackingStore> 49 virtual scoped_ptr<syncable::DirectoryBackingStore>
43 BuildDirectoryBackingStore( 50 BuildDirectoryBackingStore(
44 const std::string& dir_name, 51 const std::string& dir_name,
45 const base::FilePath& backing_filepath) OVERRIDE; 52 const base::FilePath& backing_filepath) OVERRIDE;
46 53
47 virtual Switches GetSwitches() const OVERRIDE; 54 virtual Switches GetSwitches() const OVERRIDE;
48 55
49 private: 56 private:
50 const Switches switches_; 57 const Switches switches_;
51 const StorageOption storage_option_; 58 const StorageOption storage_option_;
52 59
60 scoped_ptr<syncable::DirectoryBackingStore> store_;
61
53 DISALLOW_COPY_AND_ASSIGN(TestInternalComponentsFactory); 62 DISALLOW_COPY_AND_ASSIGN(TestInternalComponentsFactory);
54 }; 63 };
55 64
56 } // namespace syncer 65 } // namespace syncer
57 66
58 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_TEST_INTERNAL_COMPONENTS_FACTORY_H_ 67 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_TEST_INTERNAL_COMPONENTS_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698