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

Unified Diff: components/cryptauth/mock_eid_generator.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
« no previous file with comments | « components/cryptauth/mock_eid_generator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cryptauth/mock_eid_generator.cc
diff --git a/components/cryptauth/mock_eid_generator.cc b/components/cryptauth/mock_eid_generator.cc
index adebf26b78e89fe1f7594fe5e5aa6c7bc92a8772..c9515a74086aa7b70c71c155dc9bbee338c1f8e4 100644
--- a/components/cryptauth/mock_eid_generator.cc
+++ b/components/cryptauth/mock_eid_generator.cc
@@ -11,7 +11,8 @@ namespace cryptauth {
MockEidGenerator::MockEidGenerator() : background_scan_filter_(nullptr),
advertisement_(nullptr),
possible_advertisements_(nullptr),
- identified_device_(nullptr) {}
+ identified_device_(nullptr),
+ num_identify_calls_(0) {}
MockEidGenerator::~MockEidGenerator() {}
@@ -62,6 +63,11 @@ RemoteDevice const* MockEidGenerator::IdentifyRemoteDeviceByAdvertisement(
const std::string& advertisement_service_data,
const std::vector<RemoteDevice>& device_list,
const std::vector<BeaconSeed>& scanning_device_beacon_seeds) const {
+ // Increment num_identify_calls_. Since this overrides a const method, some
+ // hacking is needed to modify the num_identify_calls_ instance variable.
+ int* num_identify_calls_ptr = const_cast<int*>(&num_identify_calls_);
+ *num_identify_calls_ptr = *num_identify_calls_ptr + 1;
+
return identified_device_;
}
« no previous file with comments | « components/cryptauth/mock_eid_generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698