Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: components/cryptauth/mock_local_device_data_provider.cc

Issue 2951303002: [CrOS Tether] Move LocalDeviceDataProvider from //chromeos/components/tether to //components/crypta… (Closed)
Patch Set: Rebased. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/cryptauth/mock_local_device_data_provider.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "chromeos/components/tether/mock_local_device_data_provider.h" 5 #include "components/cryptauth/mock_local_device_data_provider.h"
6 6
7 #include "components/cryptauth/cryptauth_device_manager.h" 7 #include "components/cryptauth/cryptauth_device_manager.h"
8 #include "components/cryptauth/cryptauth_enrollment_manager.h" 8 #include "components/cryptauth/cryptauth_enrollment_manager.h"
9 #include "components/cryptauth/proto/cryptauth_api.pb.h" 9 #include "components/cryptauth/proto/cryptauth_api.pb.h"
10 10
11 namespace chromeos { 11 namespace cryptauth {
12
13 namespace tether {
14 12
15 MockLocalDeviceDataProvider::MockLocalDeviceDataProvider() 13 MockLocalDeviceDataProvider::MockLocalDeviceDataProvider()
16 : LocalDeviceDataProvider(nullptr /* cryptauth_service */) {} 14 : LocalDeviceDataProvider(nullptr /* cryptauth_service */) {}
17 15
18 MockLocalDeviceDataProvider::~MockLocalDeviceDataProvider() {} 16 MockLocalDeviceDataProvider::~MockLocalDeviceDataProvider() {}
19 17
20 void MockLocalDeviceDataProvider::SetPublicKey( 18 void MockLocalDeviceDataProvider::SetPublicKey(
21 std::unique_ptr<std::string> public_key) { 19 std::unique_ptr<std::string> public_key) {
22 if (public_key) { 20 if (public_key) {
23 public_key_ = std::move(public_key); 21 public_key_ = std::move(public_key);
24 } else { 22 } else {
25 public_key_.reset(); 23 public_key_.reset();
26 } 24 }
27 } 25 }
28 26
29 void MockLocalDeviceDataProvider::SetBeaconSeeds( 27 void MockLocalDeviceDataProvider::SetBeaconSeeds(
30 std::unique_ptr<std::vector<cryptauth::BeaconSeed>> beacon_seeds) { 28 std::unique_ptr<std::vector<BeaconSeed>> beacon_seeds) {
31 if (beacon_seeds) { 29 if (beacon_seeds) {
32 beacon_seeds_ = std::move(beacon_seeds); 30 beacon_seeds_ = std::move(beacon_seeds);
33 } else { 31 } else {
34 beacon_seeds_.reset(); 32 beacon_seeds_.reset();
35 } 33 }
36 } 34 }
37 35
38 bool MockLocalDeviceDataProvider::GetLocalDeviceData( 36 bool MockLocalDeviceDataProvider::GetLocalDeviceData(
39 std::string* public_key_out, 37 std::string* public_key_out,
40 std::vector<cryptauth::BeaconSeed>* beacon_seeds_out) const { 38 std::vector<BeaconSeed>* beacon_seeds_out) const {
41 bool success = false; 39 bool success = false;
42 40
43 if (public_key_ && public_key_out) { 41 if (public_key_ && public_key_out) {
44 *public_key_out = *public_key_; 42 *public_key_out = *public_key_;
45 success = true; 43 success = true;
46 } 44 }
47 45
48 if (beacon_seeds_ && beacon_seeds_out) { 46 if (beacon_seeds_ && beacon_seeds_out) {
49 *beacon_seeds_out = *beacon_seeds_; 47 *beacon_seeds_out = *beacon_seeds_;
50 success = true; 48 success = true;
51 } 49 }
52 50
53 return success; 51 return success;
54 } 52 }
55 53
56 } // namespace tether 54 } // namespace cryptauth
57
58 } // namespace chromeos
OLDNEW
« no previous file with comments | « components/cryptauth/mock_local_device_data_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698