Chromium Code Reviews| 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 |