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

Unified Diff: components/proximity_auth/bluetooth_low_energy_connection_finder_unittest.cc

Issue 2847233003: [EasyUnlock] Move DataWithTimestamp out of ForegroundEidGenerator so it can be shared. (Closed)
Patch Set: fixes Created 3 years, 8 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/proximity_auth/bluetooth_low_energy_connection_finder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « components/proximity_auth/bluetooth_low_energy_connection_finder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698