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_; |
} |