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

Unified Diff: content/browser/bluetooth/bluetooth_allowed_devices_map_unittest.cc

Issue 1663883003: bluetooth: When adding a device a second time merge the list of services. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Address jyasskin's comments Created 4 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 | « content/browser/bluetooth/bluetooth_allowed_devices_map.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/bluetooth/bluetooth_allowed_devices_map_unittest.cc
diff --git a/content/browser/bluetooth/bluetooth_allowed_devices_map_unittest.cc b/content/browser/bluetooth/bluetooth_allowed_devices_map_unittest.cc
index 821494249ab56f1ee68d73099f5eaffe0b4cee9f..925d1a1393f6f1b71027714da501aa7354da4c09 100644
--- a/content/browser/bluetooth/bluetooth_allowed_devices_map_unittest.cc
+++ b/content/browser/bluetooth/bluetooth_allowed_devices_map_unittest.cc
@@ -350,6 +350,45 @@ TEST(BluetoothAllowedDevicesMapTest, AllowedServices_TwoOriginsOneDevice) {
kTestOrigin2, device_id1, kBloodPressureUUIDString));
}
+TEST(BluetoothAllowedDevicesMapTest, MergeServices) {
+ BluetoothAllowedDevicesMap allowed_devices_map;
+
+ // Setup first request.
+ BluetoothScanFilter scanFilter1;
+ scanFilter1.services.push_back(kGlucoseUUID);
+ std::vector<BluetoothScanFilter> filters1;
+ filters1.push_back(scanFilter1);
+ std::vector<BluetoothUUID> optional_services1;
+ optional_services1.push_back(kBatteryServiceUUID);
+
+ // Add to map.
+ const std::string device_id1 = allowed_devices_map.AddDevice(
+ kTestOrigin1, kDeviceAddress1, filters1, optional_services1);
+
+ // Setup second request.
+ BluetoothScanFilter scanFilter2;
+ scanFilter2.services.push_back(kHeartRateUUID);
+ std::vector<BluetoothScanFilter> filters2;
+ filters2.push_back(scanFilter2);
+ std::vector<BluetoothUUID> optional_services2;
+ optional_services2.push_back(kBloodPressureUUID);
+
+ // Add to map again.
+ const std::string device_id2 = allowed_devices_map.AddDevice(
+ kTestOrigin1, kDeviceAddress1, filters2, optional_services2);
+
+ EXPECT_EQ(device_id1, device_id2);
+
+ EXPECT_TRUE(allowed_devices_map.IsOriginAllowedToAccessService(
+ kTestOrigin1, device_id1, kGlucoseUUIDString));
+ EXPECT_TRUE(allowed_devices_map.IsOriginAllowedToAccessService(
+ kTestOrigin1, device_id1, kBatteryServiceUUIDString));
+ EXPECT_TRUE(allowed_devices_map.IsOriginAllowedToAccessService(
+ kTestOrigin1, device_id1, kHeartRateUUIDString));
+ EXPECT_TRUE(allowed_devices_map.IsOriginAllowedToAccessService(
+ kTestOrigin1, device_id1, kBloodPressureUUIDString));
+}
+
TEST(BluetoothAllowedDevicesMapTest, CorrectIdFormat) {
BluetoothAllowedDevicesMap allowed_devices_map;
« no previous file with comments | « content/browser/bluetooth/bluetooth_allowed_devices_map.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698