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

Unified Diff: device/bluetooth/bluetooth_gatt_characteristic_unittest.cc

Issue 1765773002: bluetooth: Refactor GetDescriptorForUUID to GetDescriptorsForUUID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-notify-tommyt-
Patch Set: GetDescriptorsForUUID split from other changes. Created 4 years, 9 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
Index: device/bluetooth/bluetooth_gatt_characteristic_unittest.cc
diff --git a/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc b/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc
index ba3e25ba371760cdbb8e6d448752569f9a8d7549..00ecba11bb200e0444b8648b2a089ba82df5f9c5 100644
--- a/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc
+++ b/device/bluetooth/bluetooth_gatt_characteristic_unittest.cc
@@ -897,8 +897,8 @@ TEST_F(BluetoothGattCharacteristicTest, StartNotifySession_Multiple) {
FakeCharacteristicBoilerplate(/* properties: NOTIFY */ 0x10));
SimulateGattDescriptor(
characteristic1_,
- /* Client Characteristic Configuration descriptor's standard UUID: */
- "00002902-0000-1000-8000-00805F9B34FB");
+ BluetoothGattDescriptor::ClientCharacteristicConfigurationUuid()
+ .canonical_value());
ASSERT_EQ(1u, characteristic1_->GetDescriptors().size());
characteristic1_->StartNotifySession(
@@ -977,4 +977,31 @@ TEST_F(BluetoothGattCharacteristicTest, GetDescriptors_and_GetDescriptor) {
}
#endif // defined(OS_ANDROID) || defined(OS_WIN)
+#if defined(OS_ANDROID) || defined(OS_WIN)
+TEST_F(BluetoothGattCharacteristicTest, GetDescriptorsForUUID) {
+ ASSERT_NO_FATAL_FAILURE(FakeCharacteristicBoilerplate());
+
+ // Add several Descriptors:
+ BluetoothUUID id1("11111111-0000-1000-8000-00805f9b34fb");
+ BluetoothUUID id2("22222222-0000-1000-8000-00805f9b34fb");
+ BluetoothUUID id3("33333333-0000-1000-8000-00805f9b34fb");
+ SimulateGattDescriptor(characteristic1_, id1.canonical_value());
+ SimulateGattDescriptor(characteristic1_, id2.canonical_value());
+ SimulateGattDescriptor(characteristic2_, id3.canonical_value());
+ SimulateGattDescriptor(characteristic2_, id3.canonical_value());
+
+ EXPECT_EQ(id1, characteristic1_->GetDescriptorsForUUID(id1).at(0)->GetUUID());
+ EXPECT_EQ(id2, characteristic1_->GetDescriptorsForUUID(id2).at(0)->GetUUID());
+ EXPECT_EQ(id3, characteristic2_->GetDescriptorsForUUID(id3).at(0)->GetUUID());
+ EXPECT_EQ(id3, characteristic2_->GetDescriptorsForUUID(id3).at(1)->GetUUID());
ortuno 2016/03/13 20:41:44 Add EXPECT_NE(characteristic2_->GetDescriptorsForU
scheib 2016/03/25 00:13:57 Done.
+ EXPECT_EQ(1u, characteristic1_->GetDescriptorsForUUID(id1).size());
+ EXPECT_EQ(1u, characteristic1_->GetDescriptorsForUUID(id2).size());
+ EXPECT_EQ(2u, characteristic2_->GetDescriptorsForUUID(id3).size());
+
+ EXPECT_EQ(0u, characteristic2_->GetDescriptorsForUUID(id1).size());
+ EXPECT_EQ(0u, characteristic2_->GetDescriptorsForUUID(id2).size());
+ EXPECT_EQ(0u, characteristic1_->GetDescriptorsForUUID(id3).size());
+}
+#endif // defined(OS_ANDROID) || defined(OS_WIN)
+
} // namespace device

Powered by Google App Engine
This is Rietveld 408576698