| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "components/sync_driver/glue/sync_backend_host.h" | 12 #include "components/sync_driver/glue/sync_backend_host.h" |
| 13 #include "sync/internal_api/public/util/weak_handle.h" | 13 #include "sync/internal_api/public/util/weak_handle.h" |
| 14 | 14 |
| 15 namespace browser_sync { | 15 namespace browser_sync { |
| 16 | 16 |
| 17 // A mock of the SyncBackendHost. | 17 // A mock of the SyncBackendHost. |
| 18 // | 18 // |
| 19 // This class implements the bare minimum required for the ProfileSyncService to | 19 // This class implements the bare minimum required for the ProfileSyncService to |
| 20 // get through initialization. It often returns NULL pointers or nonesense | 20 // get through initialization. It often returns NULL pointers or nonesense |
| 21 // values; it is not intended to be used in tests that depend on SyncBackendHost | 21 // values; it is not intended to be used in tests that depend on SyncBackendHost |
| 22 // behavior. | 22 // behavior. |
| 23 class SyncBackendHostMock : public SyncBackendHost { | 23 class SyncBackendHostMock : public SyncBackendHost { |
| 24 public: | 24 public: |
| 25 SyncBackendHostMock(); | 25 SyncBackendHostMock(); |
| 26 ~SyncBackendHostMock() override; | 26 ~SyncBackendHostMock() override; |
| 27 | 27 |
| 28 void Initialize( | 28 void Initialize( |
| 29 sync_driver::SyncFrontend* frontend, | 29 sync_driver::SyncFrontend* frontend, |
| 30 scoped_ptr<base::Thread> sync_thread, | 30 std::unique_ptr<base::Thread> sync_thread, |
| 31 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 31 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
| 32 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, | 32 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, |
| 33 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 33 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
| 34 const GURL& service_url, | 34 const GURL& service_url, |
| 35 const std::string& sync_user_agent, | 35 const std::string& sync_user_agent, |
| 36 const syncer::SyncCredentials& credentials, | 36 const syncer::SyncCredentials& credentials, |
| 37 bool delete_sync_data_folder, | 37 bool delete_sync_data_folder, |
| 38 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 38 std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
| 39 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& | 39 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& |
| 40 unrecoverable_error_handler, | 40 unrecoverable_error_handler, |
| 41 const base::Closure& report_unrecoverable_error_function, | 41 const base::Closure& report_unrecoverable_error_function, |
| 42 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, | 42 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, |
| 43 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> saved_nigori_state) | 43 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState> |
| 44 override; | 44 saved_nigori_state) override; |
| 45 | 45 |
| 46 void TriggerRefresh(const syncer::ModelTypeSet& types) override; | 46 void TriggerRefresh(const syncer::ModelTypeSet& types) override; |
| 47 | 47 |
| 48 void UpdateCredentials(const syncer::SyncCredentials& credentials) override; | 48 void UpdateCredentials(const syncer::SyncCredentials& credentials) override; |
| 49 | 49 |
| 50 void StartSyncingWithServer() override; | 50 void StartSyncingWithServer() override; |
| 51 | 51 |
| 52 void SetEncryptionPassphrase(const std::string& passphrase, | 52 void SetEncryptionPassphrase(const std::string& passphrase, |
| 53 bool is_explicit) override; | 53 bool is_explicit) override; |
| 54 | 54 |
| 55 bool SetDecryptionPassphrase(const std::string& passphrase) override; | 55 bool SetDecryptionPassphrase(const std::string& passphrase) override; |
| 56 | 56 |
| 57 void StopSyncingForShutdown() override; | 57 void StopSyncingForShutdown() override; |
| 58 | 58 |
| 59 scoped_ptr<base::Thread> Shutdown(syncer::ShutdownReason reason) override; | 59 std::unique_ptr<base::Thread> Shutdown( |
| 60 syncer::ShutdownReason reason) override; |
| 60 | 61 |
| 61 void UnregisterInvalidationIds() override; | 62 void UnregisterInvalidationIds() override; |
| 62 | 63 |
| 63 syncer::ModelTypeSet ConfigureDataTypes( | 64 syncer::ModelTypeSet ConfigureDataTypes( |
| 64 syncer::ConfigureReason reason, | 65 syncer::ConfigureReason reason, |
| 65 const DataTypeConfigStateMap& config_state_map, | 66 const DataTypeConfigStateMap& config_state_map, |
| 66 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>& | 67 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>& |
| 67 ready_task, | 68 ready_task, |
| 68 const base::Callback<void()>& retry_callback) override; | 69 const base::Callback<void()>& retry_callback) override; |
| 69 | 70 |
| 70 void EnableEncryptEverything() override; | 71 void EnableEncryptEverything() override; |
| 71 | 72 |
| 72 void ActivateDirectoryDataType( | 73 void ActivateDirectoryDataType( |
| 73 syncer::ModelType type, | 74 syncer::ModelType type, |
| 74 syncer::ModelSafeGroup group, | 75 syncer::ModelSafeGroup group, |
| 75 sync_driver::ChangeProcessor* change_processor) override; | 76 sync_driver::ChangeProcessor* change_processor) override; |
| 76 void DeactivateDirectoryDataType(syncer::ModelType type) override; | 77 void DeactivateDirectoryDataType(syncer::ModelType type) override; |
| 77 | 78 |
| 78 void ActivateNonBlockingDataType( | 79 void ActivateNonBlockingDataType( |
| 79 syncer::ModelType type, | 80 syncer::ModelType type, |
| 80 scoped_ptr<syncer_v2::ActivationContext>) override; | 81 std::unique_ptr<syncer_v2::ActivationContext>) override; |
| 81 void DeactivateNonBlockingDataType(syncer::ModelType type) override; | 82 void DeactivateNonBlockingDataType(syncer::ModelType type) override; |
| 82 | 83 |
| 83 syncer::UserShare* GetUserShare() const override; | 84 syncer::UserShare* GetUserShare() const override; |
| 84 | 85 |
| 85 Status GetDetailedStatus() override; | 86 Status GetDetailedStatus() override; |
| 86 | 87 |
| 87 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const override; | 88 syncer::sessions::SyncSessionSnapshot GetLastSessionSnapshot() const override; |
| 88 | 89 |
| 89 bool HasUnsyncedItems() const override; | 90 bool HasUnsyncedItems() const override; |
| 90 | 91 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 125 |
| 125 void set_fail_initial_download(bool should_fail); | 126 void set_fail_initial_download(bool should_fail); |
| 126 | 127 |
| 127 private: | 128 private: |
| 128 bool fail_initial_download_; | 129 bool fail_initial_download_; |
| 129 }; | 130 }; |
| 130 | 131 |
| 131 } // namespace browser_sync | 132 } // namespace browser_sync |
| 132 | 133 |
| 133 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ | 134 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_MOCK_H_ |
| OLD | NEW |