| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_LOCAL_DEVICE_INFO_PROVIDER_MOCK_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_MOCK_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_MOCK_H_ | 6 #define COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_MOCK_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "components/sync_driver/device_info.h" | 10 #include "components/sync/driver/device_info.h" |
| 11 #include "components/sync_driver/local_device_info_provider.h" | 11 #include "components/sync/driver/local_device_info_provider.h" |
| 12 | 12 |
| 13 namespace sync_driver { | 13 namespace sync_driver { |
| 14 | 14 |
| 15 class LocalDeviceInfoProviderMock | 15 class LocalDeviceInfoProviderMock |
| 16 : public sync_driver::LocalDeviceInfoProvider { | 16 : public sync_driver::LocalDeviceInfoProvider { |
| 17 public: | 17 public: |
| 18 // Creates uninitialized provider. | 18 // Creates uninitialized provider. |
| 19 LocalDeviceInfoProviderMock(); | 19 LocalDeviceInfoProviderMock(); |
| 20 // Creates initialized provider with the specified device info. | 20 // Creates initialized provider with the specified device info. |
| 21 LocalDeviceInfoProviderMock( | 21 LocalDeviceInfoProviderMock(const std::string& guid, |
| 22 const std::string& guid, | 22 const std::string& client_name, |
| 23 const std::string& client_name, | 23 const std::string& chrome_version, |
| 24 const std::string& chrome_version, | 24 const std::string& sync_user_agent, |
| 25 const std::string& sync_user_agent, | 25 const sync_pb::SyncEnums::DeviceType device_type, |
| 26 const sync_pb::SyncEnums::DeviceType device_type, | 26 const std::string& signin_scoped_device_id); |
| 27 const std::string& signin_scoped_device_id); | |
| 28 ~LocalDeviceInfoProviderMock() override; | 27 ~LocalDeviceInfoProviderMock() override; |
| 29 | 28 |
| 30 const DeviceInfo* GetLocalDeviceInfo() const override; | 29 const DeviceInfo* GetLocalDeviceInfo() const override; |
| 31 std::string GetSyncUserAgent() const override; | 30 std::string GetSyncUserAgent() const override; |
| 32 std::string GetLocalSyncCacheGUID() const override; | 31 std::string GetLocalSyncCacheGUID() const override; |
| 33 void Initialize( | 32 void Initialize( |
| 34 const std::string& cache_guid, | 33 const std::string& cache_guid, |
| 35 const std::string& signin_scoped_device_id, | 34 const std::string& signin_scoped_device_id, |
| 36 const scoped_refptr<base::TaskRunner>& blocking_task_runner) override; | 35 const scoped_refptr<base::TaskRunner>& blocking_task_runner) override; |
| 37 std::unique_ptr<Subscription> RegisterOnInitializedCallback( | 36 std::unique_ptr<Subscription> RegisterOnInitializedCallback( |
| 38 const base::Closure& callback) override; | 37 const base::Closure& callback) override; |
| 39 void Clear() override; | 38 void Clear() override; |
| 40 | 39 |
| 41 void Initialize(std::unique_ptr<DeviceInfo> local_device_info); | 40 void Initialize(std::unique_ptr<DeviceInfo> local_device_info); |
| 42 void SetInitialized(bool is_initialized); | 41 void SetInitialized(bool is_initialized); |
| 43 | 42 |
| 44 private: | 43 private: |
| 45 bool is_initialized_; | 44 bool is_initialized_; |
| 46 | 45 |
| 47 std::unique_ptr<DeviceInfo> local_device_info_; | 46 std::unique_ptr<DeviceInfo> local_device_info_; |
| 48 base::CallbackList<void(void)> callback_list_; | 47 base::CallbackList<void(void)> callback_list_; |
| 49 }; | 48 }; |
| 50 | 49 |
| 51 } // namespace sync_driver | 50 } // namespace sync_driver |
| 52 | 51 |
| 53 #endif // COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_MOCK_H_ | 52 #endif // COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_MOCK_H_ |
| OLD | NEW |