OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chromeos/components/tether/mock_local_device_data_provider.h" |
| 6 |
| 7 #include "components/cryptauth/cryptauth_device_manager.h" |
| 8 #include "components/cryptauth/cryptauth_enrollment_manager.h" |
| 9 #include "components/cryptauth/proto/cryptauth_api.pb.h" |
| 10 |
| 11 namespace chromeos { |
| 12 |
| 13 namespace tether { |
| 14 |
| 15 MockLocalDeviceDataProvider::MockLocalDeviceDataProvider() |
| 16 : LocalDeviceDataProvider(nullptr, nullptr) {} |
| 17 |
| 18 MockLocalDeviceDataProvider::~MockLocalDeviceDataProvider() {} |
| 19 |
| 20 void MockLocalDeviceDataProvider::SetPublicKey( |
| 21 std::unique_ptr<std::string> public_key) { |
| 22 if (public_key) { |
| 23 public_key_ = std::move(public_key); |
| 24 } else { |
| 25 public_key_.reset(); |
| 26 } |
| 27 } |
| 28 |
| 29 void MockLocalDeviceDataProvider::SetBeaconSeeds( |
| 30 std::unique_ptr<std::vector<cryptauth::BeaconSeed>> beacon_seeds) { |
| 31 if (beacon_seeds) { |
| 32 beacon_seeds_ = std::move(beacon_seeds); |
| 33 } else { |
| 34 beacon_seeds_.reset(); |
| 35 } |
| 36 } |
| 37 |
| 38 bool MockLocalDeviceDataProvider::GetLocalDeviceData( |
| 39 std::string* public_key_out, |
| 40 std::vector<cryptauth::BeaconSeed>* beacon_seeds_out) const { |
| 41 if (public_key_ && beacon_seeds_) { |
| 42 if (public_key_out) { |
| 43 *public_key_out = *public_key_; |
| 44 } |
| 45 if (beacon_seeds_out) { |
| 46 *beacon_seeds_out = *beacon_seeds_; |
| 47 } |
| 48 return true; |
| 49 } |
| 50 |
| 51 return false; |
| 52 } |
| 53 |
| 54 } // namespace tether |
| 55 |
| 56 } // namespace cryptauth |
OLD | NEW |