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 #ifndef SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 // Returns those types that have been marked as enabled since the | 52 // Returns those types that have been marked as enabled since the |
53 // last call to GetAndResetEnabledTypes(), or since startup if never | 53 // last call to GetAndResetEnabledTypes(), or since startup if never |
54 // called. | 54 // called. |
55 ModelTypeSet GetAndResetEnabledTypes(); | 55 ModelTypeSet GetAndResetEnabledTypes(); |
56 | 56 |
57 // Returns the types that have most recently received a refresh request. | 57 // Returns the types that have most recently received a refresh request. |
58 ModelTypeSet GetLastRefreshRequestTypes(); | 58 ModelTypeSet GetLastRefreshRequestTypes(); |
59 | 59 |
60 // Posts a method to invalidate the given IDs on the sync thread. | 60 // Posts a method to invalidate the given IDs on the sync thread. |
61 void Invalidate(const ObjectIdInvalidationMap& invalidation_map); | 61 virtual void Invalidate( |
| 62 const ObjectIdInvalidationMap& invalidation_map) OVERRIDE; |
62 | 63 |
63 // Posts a method to update the invalidator state on the sync thread. | 64 // Posts a method to update the invalidator state on the sync thread. |
64 void UpdateInvalidatorState(InvalidatorState state); | 65 virtual void UpdateInvalidatorState(InvalidatorState state) OVERRIDE; |
65 | 66 |
66 // Block until the sync thread has finished processing any pending messages. | 67 // Block until the sync thread has finished processing any pending messages. |
67 void WaitForSyncThread(); | 68 void WaitForSyncThread(); |
68 | 69 |
69 // SyncManager implementation. | 70 // SyncManager implementation. |
70 // Note: we treat whatever message loop this is called from as the sync | 71 // Note: we treat whatever message loop this is called from as the sync |
71 // loop for purposes of callbacks. | 72 // loop for purposes of callbacks. |
72 virtual void Init( | 73 virtual void Init( |
73 const base::FilePath& database_location, | 74 const base::FilePath& database_location, |
74 const WeakHandle<JsEventHandler>& event_handler, | 75 const WeakHandle<JsEventHandler>& event_handler, |
75 const std::string& sync_server_and_path, | 76 const std::string& sync_server_and_path, |
76 int sync_server_port, | 77 int sync_server_port, |
77 bool use_ssl, | 78 bool use_ssl, |
78 scoped_ptr<HttpPostProviderFactory> post_factory, | 79 scoped_ptr<HttpPostProviderFactory> post_factory, |
79 const std::vector<ModelSafeWorker*>& workers, | 80 const std::vector<ModelSafeWorker*>& workers, |
80 ExtensionsActivityMonitor* extensions_activity_monitor, | 81 ExtensionsActivityMonitor* extensions_activity_monitor, |
81 ChangeDelegate* change_delegate, | 82 ChangeDelegate* change_delegate, |
82 const SyncCredentials& credentials, | 83 const SyncCredentials& credentials, |
83 scoped_ptr<Invalidator> invalidator, | |
84 const std::string& invalidator_client_id, | 84 const std::string& invalidator_client_id, |
85 const std::string& restored_key_for_bootstrapping, | 85 const std::string& restored_key_for_bootstrapping, |
86 const std::string& restored_keystore_key_for_bootstrapping, | 86 const std::string& restored_keystore_key_for_bootstrapping, |
87 scoped_ptr<InternalComponentsFactory> internal_components_factory, | 87 scoped_ptr<InternalComponentsFactory> internal_components_factory, |
88 Encryptor* encryptor, | 88 Encryptor* encryptor, |
89 UnrecoverableErrorHandler* unrecoverable_error_handler, | 89 UnrecoverableErrorHandler* unrecoverable_error_handler, |
90 ReportUnrecoverableErrorFunction | 90 ReportUnrecoverableErrorFunction |
91 report_unrecoverable_error_function) OVERRIDE; | 91 report_unrecoverable_error_function) OVERRIDE; |
92 virtual void ThrowUnrecoverableError() OVERRIDE; | 92 virtual void ThrowUnrecoverableError() OVERRIDE; |
93 virtual ModelTypeSet InitialSyncEndedTypes() OVERRIDE; | 93 virtual ModelTypeSet InitialSyncEndedTypes() OVERRIDE; |
94 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( | 94 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( |
95 ModelTypeSet types) OVERRIDE; | 95 ModelTypeSet types) OVERRIDE; |
96 virtual bool PurgePartiallySyncedTypes() OVERRIDE; | 96 virtual bool PurgePartiallySyncedTypes() OVERRIDE; |
97 virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE; | 97 virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE; |
98 virtual void UpdateEnabledTypes(ModelTypeSet types) OVERRIDE; | |
99 virtual void RegisterInvalidationHandler( | |
100 InvalidationHandler* handler) OVERRIDE; | |
101 virtual void UpdateRegisteredInvalidationIds( | |
102 InvalidationHandler* handler, | |
103 const ObjectIdSet& ids) OVERRIDE; | |
104 virtual void UnregisterInvalidationHandler( | |
105 InvalidationHandler* handler) OVERRIDE; | |
106 virtual void AcknowledgeInvalidation( | |
107 const invalidation::ObjectId& id, | |
108 const syncer::AckHandle& ack_handle) OVERRIDE; | |
109 virtual void StartSyncingNormally( | 98 virtual void StartSyncingNormally( |
110 const ModelSafeRoutingInfo& routing_info) OVERRIDE; | 99 const ModelSafeRoutingInfo& routing_info) OVERRIDE; |
111 virtual void ConfigureSyncer( | 100 virtual void ConfigureSyncer( |
112 ConfigureReason reason, | 101 ConfigureReason reason, |
113 ModelTypeSet types_to_config, | 102 ModelTypeSet types_to_config, |
114 ModelTypeSet failed_types, | 103 ModelTypeSet failed_types, |
115 const ModelSafeRoutingInfo& new_routing_info, | 104 const ModelSafeRoutingInfo& new_routing_info, |
116 const base::Closure& ready_task, | 105 const base::Closure& ready_task, |
117 const base::Closure& retry_task) OVERRIDE; | 106 const base::Closure& retry_task) OVERRIDE; |
118 virtual void AddObserver(Observer* observer) OVERRIDE; | 107 virtual void AddObserver(Observer* observer) OVERRIDE; |
119 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 108 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
120 virtual SyncStatus GetDetailedStatus() const OVERRIDE; | 109 virtual SyncStatus GetDetailedStatus() const OVERRIDE; |
121 virtual void SaveChanges() OVERRIDE; | 110 virtual void SaveChanges() OVERRIDE; |
122 virtual void StopSyncingForShutdown(const base::Closure& callback) OVERRIDE; | 111 virtual void StopSyncingForShutdown(const base::Closure& callback) OVERRIDE; |
123 virtual void ShutdownOnSyncThread() OVERRIDE; | 112 virtual void ShutdownOnSyncThread() OVERRIDE; |
124 virtual UserShare* GetUserShare() OVERRIDE; | 113 virtual UserShare* GetUserShare() OVERRIDE; |
125 virtual const std::string cache_guid() OVERRIDE; | 114 virtual const std::string cache_guid() OVERRIDE; |
126 virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE; | 115 virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE; |
127 virtual bool HasUnsyncedItems() OVERRIDE; | 116 virtual bool HasUnsyncedItems() OVERRIDE; |
128 virtual SyncEncryptionHandler* GetEncryptionHandler() OVERRIDE; | 117 virtual SyncEncryptionHandler* GetEncryptionHandler() OVERRIDE; |
129 virtual void RefreshTypes(ModelTypeSet types) OVERRIDE; | 118 virtual void RefreshTypes(ModelTypeSet types) OVERRIDE; |
130 | 119 |
131 private: | 120 private: |
132 void InvalidateOnSyncThread( | |
133 const ObjectIdInvalidationMap& invalidation_map); | |
134 void UpdateInvalidatorStateOnSyncThread(InvalidatorState state); | |
135 | |
136 scoped_refptr<base::SequencedTaskRunner> sync_task_runner_; | 121 scoped_refptr<base::SequencedTaskRunner> sync_task_runner_; |
137 | 122 |
138 ObserverList<SyncManager::Observer> observers_; | 123 ObserverList<SyncManager::Observer> observers_; |
139 | 124 |
140 // Faked directory state. | 125 // Faked directory state. |
141 ModelTypeSet initial_sync_ended_types_; | 126 ModelTypeSet initial_sync_ended_types_; |
142 ModelTypeSet progress_marker_types_; | 127 ModelTypeSet progress_marker_types_; |
143 | 128 |
144 // Test specific state. | 129 // Test specific state. |
145 // The types that should fail configuration attempts. These types will not | 130 // The types that should fail configuration attempts. These types will not |
(...skipping 15 matching lines...) Expand all Loading... |
161 scoped_ptr<FakeSyncEncryptionHandler> fake_encryption_handler_; | 146 scoped_ptr<FakeSyncEncryptionHandler> fake_encryption_handler_; |
162 | 147 |
163 TestUserShare test_user_share_; | 148 TestUserShare test_user_share_; |
164 | 149 |
165 DISALLOW_COPY_AND_ASSIGN(FakeSyncManager); | 150 DISALLOW_COPY_AND_ASSIGN(FakeSyncManager); |
166 }; | 151 }; |
167 | 152 |
168 } // namespace syncer | 153 } // namespace syncer |
169 | 154 |
170 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_ | 155 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_ |
OLD | NEW |