| 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 #include "components/sync_driver/local_device_info_provider_mock.h" | 5 #include "components/sync/driver/local_device_info_provider_mock.h" |
| 6 | 6 |
| 7 namespace sync_driver { | 7 namespace sync_driver { |
| 8 | 8 |
| 9 LocalDeviceInfoProviderMock::LocalDeviceInfoProviderMock() | 9 LocalDeviceInfoProviderMock::LocalDeviceInfoProviderMock() |
| 10 : is_initialized_(false) {} | 10 : is_initialized_(false) {} |
| 11 | 11 |
| 12 LocalDeviceInfoProviderMock::LocalDeviceInfoProviderMock( | 12 LocalDeviceInfoProviderMock::LocalDeviceInfoProviderMock( |
| 13 const std::string& guid, | 13 const std::string& guid, |
| 14 const std::string& client_name, | 14 const std::string& client_name, |
| 15 const std::string& chrome_version, | 15 const std::string& chrome_version, |
| 16 const std::string& sync_user_agent, | 16 const std::string& sync_user_agent, |
| 17 const sync_pb::SyncEnums::DeviceType device_type, | 17 const sync_pb::SyncEnums::DeviceType device_type, |
| 18 const std::string& signin_scoped_device_id) | 18 const std::string& signin_scoped_device_id) |
| 19 : is_initialized_(true) { | 19 : is_initialized_(true) { |
| 20 local_device_info_.reset( | 20 local_device_info_.reset(new DeviceInfo(guid, client_name, chrome_version, |
| 21 new DeviceInfo( | 21 sync_user_agent, device_type, |
| 22 guid, | 22 signin_scoped_device_id)); |
| 23 client_name, | |
| 24 chrome_version, | |
| 25 sync_user_agent, | |
| 26 device_type, | |
| 27 signin_scoped_device_id)); | |
| 28 } | 23 } |
| 29 | 24 |
| 30 LocalDeviceInfoProviderMock::~LocalDeviceInfoProviderMock() {} | 25 LocalDeviceInfoProviderMock::~LocalDeviceInfoProviderMock() {} |
| 31 | 26 |
| 32 const DeviceInfo* LocalDeviceInfoProviderMock::GetLocalDeviceInfo() const { | 27 const DeviceInfo* LocalDeviceInfoProviderMock::GetLocalDeviceInfo() const { |
| 33 return is_initialized_ ? local_device_info_.get() : nullptr; | 28 return is_initialized_ ? local_device_info_.get() : nullptr; |
| 34 } | 29 } |
| 35 | 30 |
| 36 std::string LocalDeviceInfoProviderMock::GetSyncUserAgent() const { | 31 std::string LocalDeviceInfoProviderMock::GetSyncUserAgent() const { |
| 37 return "useragent"; | 32 return "useragent"; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 65 } |
| 71 | 66 |
| 72 void LocalDeviceInfoProviderMock::SetInitialized(bool is_initialized) { | 67 void LocalDeviceInfoProviderMock::SetInitialized(bool is_initialized) { |
| 73 is_initialized_ = is_initialized; | 68 is_initialized_ = is_initialized; |
| 74 if (is_initialized_) { | 69 if (is_initialized_) { |
| 75 callback_list_.Notify(); | 70 callback_list_.Notify(); |
| 76 } | 71 } |
| 77 } | 72 } |
| 78 | 73 |
| 79 } // namespace sync_driver | 74 } // namespace sync_driver |
| OLD | NEW |