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