Chromium Code Reviews| Index: device/bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc |
| diff --git a/device/bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc b/device/bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc |
| index c96c1a419250a740869f2323fdb12b5f5321e711..d529681ab908a9434a308a9d205fe0f2e428e391 100644 |
| --- a/device/bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc |
| +++ b/device/bluetooth/test/test_bluetooth_local_gatt_service_delegate.cc |
| @@ -16,6 +16,9 @@ TestBluetoothLocalGattServiceDelegate::TestBluetoothLocalGattServiceDelegate() |
| expected_characteristic_(nullptr), |
| expected_descriptor_(nullptr) {} |
| +TestBluetoothLocalGattServiceDelegate:: |
| + ~TestBluetoothLocalGattServiceDelegate() {} |
| + |
| void TestBluetoothLocalGattServiceDelegate::OnCharacteristicReadRequest( |
| const BluetoothLocalGattService* service, |
| const BluetoothLocalGattCharacteristic* characteristic, |
| @@ -80,4 +83,32 @@ void TestBluetoothLocalGattServiceDelegate::OnDescriptorWriteRequest( |
| callback.Run(); |
| } |
| +void TestBluetoothLocalGattServiceDelegate::OnNotificationsStart( |
| + const BluetoothLocalGattService* service, |
| + const BluetoothLocalGattCharacteristic* characteristic) { |
| + EXPECT_EQ(expected_service_, service); |
| + EXPECT_EQ(expected_characteristic_, characteristic); |
| + notifications_started_for_characteristic_[characteristic->GetIdentifier()] = |
| + true; |
| +} |
| + |
| +void TestBluetoothLocalGattServiceDelegate::OnNotificationsStop( |
| + const BluetoothLocalGattService* service, |
| + const BluetoothLocalGattCharacteristic* characteristic) { |
| + EXPECT_EQ(expected_service_, service); |
| + EXPECT_EQ(expected_characteristic_, characteristic); |
| + notifications_started_for_characteristic_[characteristic->GetIdentifier()] = |
| + false; |
| +} |
| + |
| +bool TestBluetoothLocalGattServiceDelegate::NotificationStatusForCharacteristic( |
| + BluetoothLocalGattCharacteristic* characteristic) { |
| + auto found = notifications_started_for_characteristic_.find( |
| + characteristic->GetIdentifier()); |
| + if (found == notifications_started_for_characteristic_.end()) |
| + return false; |
| + return notifications_started_for_characteristic_[characteristic |
|
xiyuan
2016/05/12 19:49:43
nit: return found.second; since we have |found|?
rkc
2016/05/12 20:12:49
Done.
|
| + ->GetIdentifier()]; |
| +} |
| + |
| } // namespace device |