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

Unified Diff: chromeos/components/tether/mock_local_device_data_provider.cc

Issue 2604063003: [CrOS Tether] Create BleScanner, a class which scan BLE advertisements and identifies nearby device… (Closed)
Patch Set: Add missing dependency. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/components/tether/mock_local_device_data_provider.cc
diff --git a/chromeos/components/tether/mock_local_device_data_provider.cc b/chromeos/components/tether/mock_local_device_data_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2774368ab6dde201fb9d1470f4e8c2a936015337
--- /dev/null
+++ b/chromeos/components/tether/mock_local_device_data_provider.cc
@@ -0,0 +1,56 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chromeos/components/tether/mock_local_device_data_provider.h"
+
+#include "components/cryptauth/cryptauth_device_manager.h"
+#include "components/cryptauth/cryptauth_enrollment_manager.h"
+#include "components/cryptauth/proto/cryptauth_api.pb.h"
+
+namespace chromeos {
+
+namespace tether {
+
+MockLocalDeviceDataProvider::MockLocalDeviceDataProvider()
+ : LocalDeviceDataProvider(nullptr, nullptr) {}
+
+MockLocalDeviceDataProvider::~MockLocalDeviceDataProvider() {}
+
+void MockLocalDeviceDataProvider::SetPublicKey(
+ std::unique_ptr<std::string> public_key) {
+ if (public_key) {
+ public_key_ = std::move(public_key);
+ } else {
+ public_key_.reset();
+ }
+}
+
+void MockLocalDeviceDataProvider::SetBeaconSeeds(
+ std::unique_ptr<std::vector<cryptauth::BeaconSeed>> beacon_seeds) {
+ if (beacon_seeds) {
+ beacon_seeds_ = std::move(beacon_seeds);
+ } else {
+ beacon_seeds_.reset();
+ }
+}
+
+bool MockLocalDeviceDataProvider::GetLocalDeviceData(
+ std::string* public_key_out,
+ std::vector<cryptauth::BeaconSeed>* beacon_seeds_out) const {
+ if (public_key_ && beacon_seeds_) {
+ if (public_key_out) {
+ *public_key_out = *public_key_;
+ }
+ if (beacon_seeds_out) {
+ *beacon_seeds_out = *beacon_seeds_;
+ }
+ return true;
+ }
+
+ return false;
+}
+
+} // namespace tether
+
+} // namespace cryptauth
« no previous file with comments | « chromeos/components/tether/mock_local_device_data_provider.h ('k') | components/cryptauth/mock_eid_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698