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) {} |
(...skipping 28 matching lines...) Expand all Loading... | |
39 | 39 |
40 std::string LocalDeviceInfoProviderMock::GetLocalSyncCacheGUID() const { | 40 std::string LocalDeviceInfoProviderMock::GetLocalSyncCacheGUID() const { |
41 return local_device_info_.get() ? local_device_info_->guid() : ""; | 41 return local_device_info_.get() ? local_device_info_->guid() : ""; |
42 } | 42 } |
43 | 43 |
44 void LocalDeviceInfoProviderMock::Initialize( | 44 void LocalDeviceInfoProviderMock::Initialize( |
45 const std::string& cache_guid, const std::string& signin_scoped_device_id) { | 45 const std::string& cache_guid, const std::string& signin_scoped_device_id) { |
46 // Ignored for the mock provider. | 46 // Ignored for the mock provider. |
47 } | 47 } |
48 | 48 |
49 void LocalDeviceInfoProviderMock::Initialize( | |
stanisc
2015/10/22 20:16:53
I am not sure why did you need to add this. You co
skym
2015/10/23 20:29:49
Because then I cannot test all the cases. The way
| |
50 scoped_ptr<DeviceInfo> local_device_info) { | |
51 local_device_info_.swap(local_device_info); | |
52 SetInitialized(true); | |
53 } | |
54 | |
49 scoped_ptr<LocalDeviceInfoProvider::Subscription> | 55 scoped_ptr<LocalDeviceInfoProvider::Subscription> |
50 LocalDeviceInfoProviderMock::RegisterOnInitializedCallback( | 56 LocalDeviceInfoProviderMock::RegisterOnInitializedCallback( |
51 const base::Closure& callback) { | 57 const base::Closure& callback) { |
52 DCHECK(!is_initialized_); | 58 DCHECK(!is_initialized_); |
53 return callback_list_.Add(callback); | 59 return callback_list_.Add(callback); |
54 } | 60 } |
55 | 61 |
56 void LocalDeviceInfoProviderMock::SetInitialized(bool is_initialized) { | 62 void LocalDeviceInfoProviderMock::SetInitialized(bool is_initialized) { |
57 is_initialized_ = is_initialized; | 63 is_initialized_ = is_initialized; |
58 if (is_initialized_) { | 64 if (is_initialized_) { |
59 callback_list_.Notify(); | 65 callback_list_.Notify(); |
60 } | 66 } |
61 } | 67 } |
62 | 68 |
63 } // namespace sync_driver | 69 } // namespace sync_driver |
OLD | NEW |