Index: components/proximity_auth/bluetooth_low_energy_connection_finder_unittest.cc |
diff --git a/components/proximity_auth/bluetooth_low_energy_connection_finder_unittest.cc b/components/proximity_auth/bluetooth_low_energy_connection_finder_unittest.cc |
index e596b8d661e4e85ced12f1ad98b732dfeef5c461..24460f9a2c01020c2855ce60916d14a57e0ecc7f 100644 |
--- a/components/proximity_auth/bluetooth_low_energy_connection_finder_unittest.cc |
+++ b/components/proximity_auth/bluetooth_low_energy_connection_finder_unittest.cc |
@@ -51,6 +51,7 @@ const char kEidForPreviousTimeQuantum[] = "\x12\x34"; |
const char kEidForCurrentTimeQuantum[] = "\xab\xcd"; |
const char kEidForNextTimeQuantum[] = "\x56\x78"; |
const char kWrongEid[] = "\xff\xff"; |
+const int64_t kEidPeriodMs = 60 * 1000 * 15; // 15 minutes. |
std::vector<cryptauth::BeaconSeed> CreateBeaconSeeds() { |
std::vector<cryptauth::BeaconSeed> beacon_seeds; |
@@ -69,7 +70,7 @@ class FakeEidGenerator : public cryptauth::BackgroundEidGenerator { |
: connection_finder_(connection_finder) {} |
~FakeEidGenerator() override {} |
- std::vector<std::string> GenerateNearestEids( |
+ std::vector<cryptauth::DataWithTimestamp> GenerateNearestEids( |
const std::vector<cryptauth::BeaconSeed>& beacon_seed) const override; |
private: |
@@ -131,9 +132,19 @@ class MockBluetoothLowEnergyConnectionFinder |
// Not declared in-line due to dependency on |
// MockBluetoothLowEnergyConnectionFinder. |
-std::vector<std::string> FakeEidGenerator::GenerateNearestEids( |
+std::vector<cryptauth::DataWithTimestamp> FakeEidGenerator::GenerateNearestEids( |
const std::vector<cryptauth::BeaconSeed>& beacon_seed) const { |
- return connection_finder_->nearest_eids(); |
+ std::vector<std::string> nearest_eids = connection_finder_->nearest_eids(); |
+ |
+ std::vector<cryptauth::DataWithTimestamp> eid_data_with_timestamps; |
+ int64_t start_of_period_ms = 0; |
+ for (const std::string& eid : nearest_eids) { |
+ eid_data_with_timestamps.push_back(cryptauth::DataWithTimestamp( |
+ eid, start_of_period_ms, start_of_period_ms + kEidPeriodMs)); |
+ start_of_period_ms += kEidPeriodMs; |
+ } |
+ |
+ return eid_data_with_timestamps; |
} |
} // namespace |