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

Side by Side Diff: chromeos/components/tether/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
OLDNEW
(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 /* cryptauth_service */) {}
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 bool success = false;
42
43 if (public_key_ && public_key_out) {
44 *public_key_out = *public_key_;
45 success = true;
46 }
47
48 if (beacon_seeds_ && beacon_seeds_out) {
49 *beacon_seeds_out = *beacon_seeds_;
50 success = true;
51 }
52
53 return success;
54 }
55
56 } // namespace tether
57
58 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/components/tether/mock_local_device_data_provider.h ('k') | components/cryptauth/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698