| Index: device/bluetooth/test/bluetooth_test_bluez.cc
|
| diff --git a/device/bluetooth/test/bluetooth_test_bluez.cc b/device/bluetooth/test/bluetooth_test_bluez.cc
|
| index 7ee6ec6f65f2c85b63f481f00544825134a07995..66fe343d40ea89c0d14732c534f3ccf8b643acc1 100644
|
| --- a/device/bluetooth/test/bluetooth_test_bluez.cc
|
| +++ b/device/bluetooth/test/bluetooth_test_bluez.cc
|
| @@ -239,6 +239,58 @@ void BluetoothTestBlueZ::SimulateLocalGattDescriptorValueWriteRequest(
|
| run_loop.Run();
|
| }
|
|
|
| +bool BluetoothTestBlueZ::SimulateLocalGattCharacteristicNotificationsRequest(
|
| + BluetoothLocalGattService* service,
|
| + BluetoothLocalGattCharacteristic* characteristic,
|
| + bool start) {
|
| + bluez::BluetoothLocalGattCharacteristicBlueZ* characteristic_bluez =
|
| + static_cast<bluez::BluetoothLocalGattCharacteristicBlueZ*>(
|
| + characteristic);
|
| + bluez::FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
|
| + static_cast<bluez::FakeBluetoothGattManagerClient*>(
|
| + bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
|
| + bluez::FakeBluetoothGattCharacteristicServiceProvider*
|
| + characteristic_provider =
|
| + fake_bluetooth_gatt_manager_client->GetCharacteristicServiceProvider(
|
| + characteristic_bluez->object_path());
|
| +
|
| + bluez::BluetoothLocalGattServiceBlueZ* service_bluez =
|
| + static_cast<bluez::BluetoothLocalGattServiceBlueZ*>(service);
|
| + static_cast<TestBluetoothLocalGattServiceDelegate*>(
|
| + service_bluez->GetDelegate())
|
| + ->set_expected_characteristic(characteristic);
|
| +
|
| + return characteristic_provider->NotificationsChange(start);
|
| +}
|
| +
|
| +bool BluetoothTestBlueZ::SimulateLocalGattCharacteristicSendValueUpdate(
|
| + BluetoothLocalGattService* service,
|
| + BluetoothLocalGattCharacteristic* characteristic,
|
| + const std::vector<uint8_t>& new_value) {
|
| + bluez::BluetoothLocalGattCharacteristicBlueZ* characteristic_bluez =
|
| + static_cast<bluez::BluetoothLocalGattCharacteristicBlueZ*>(
|
| + characteristic);
|
| + bluez::FakeBluetoothGattManagerClient* fake_bluetooth_gatt_manager_client =
|
| + static_cast<bluez::FakeBluetoothGattManagerClient*>(
|
| + bluez::BluezDBusManager::Get()->GetBluetoothGattManagerClient());
|
| + bluez::FakeBluetoothGattCharacteristicServiceProvider*
|
| + characteristic_provider =
|
| + fake_bluetooth_gatt_manager_client->GetCharacteristicServiceProvider(
|
| + characteristic_bluez->object_path());
|
| +
|
| + bluez::BluetoothLocalGattServiceBlueZ* service_bluez =
|
| + static_cast<bluez::BluetoothLocalGattServiceBlueZ*>(service);
|
| + static_cast<TestBluetoothLocalGattServiceDelegate*>(
|
| + service_bluez->GetDelegate())
|
| + ->set_expected_characteristic(characteristic);
|
| +
|
| + if (characteristic->NotifyValueChanged(new_value, false) !=
|
| + BluetoothLocalGattCharacteristic::NOTIFICATION_SUCCESS)
|
| + return false;
|
| +
|
| + return characteristic_provider->sent_value() == new_value;
|
| +}
|
| +
|
| std::vector<BluetoothLocalGattService*>
|
| BluetoothTestBlueZ::RegisteredGattServices() {
|
| std::vector<BluetoothLocalGattService*> services;
|
|
|