| Index: device/bluetooth/bluetooth_low_energy_win_fake.cc
|
| diff --git a/device/bluetooth/bluetooth_low_energy_win_fake.cc b/device/bluetooth/bluetooth_low_energy_win_fake.cc
|
| index 3f4c1ff3f008ffb2c46f6fa5106096a6c2dfe01f..ef5dcd63e7d50d437a1378ab19688d0c46ba22e8 100644
|
| --- a/device/bluetooth/bluetooth_low_energy_win_fake.cc
|
| +++ b/device/bluetooth/bluetooth_low_energy_win_fake.cc
|
| @@ -256,7 +256,6 @@ HRESULT BluetoothLowEnergyWrapperFake::RegisterGattEvents(
|
| observer->callback = callback;
|
| observer->context = context;
|
| *out_handle = (BLUETOOTH_GATT_EVENT_HANDLE)observer.get();
|
| - gatt_characteristic_observers_[*out_handle] = std::move(observer);
|
|
|
| PBLUETOOTH_GATT_VALUE_CHANGED_EVENT_REGISTRATION parameter =
|
| (PBLUETOOTH_GATT_VALUE_CHANGED_EVENT_REGISTRATION)event_parameter;
|
| @@ -264,8 +263,18 @@ HRESULT BluetoothLowEnergyWrapperFake::RegisterGattEvents(
|
| GattCharacteristic* target_characteristic = GetSimulatedGattCharacteristic(
|
| service_path, ¶meter->Characteristics[i]);
|
| CHECK(target_characteristic);
|
| +
|
| + // Return error simulated by SimulateGattCharacteristicSetNotifyError.
|
| + if (target_characteristic->notify_errors.size()) {
|
| + HRESULT error = target_characteristic->notify_errors[0];
|
| + target_characteristic->notify_errors.erase(
|
| + target_characteristic->notify_errors.begin());
|
| + return error;
|
| + }
|
| +
|
| target_characteristic->observers.push_back(*out_handle);
|
| }
|
| + gatt_characteristic_observers_[*out_handle] = std::move(observer);
|
|
|
| if (observer_)
|
| observer_->OnStartCharacteristicNotification();
|
| @@ -440,6 +449,12 @@ void BluetoothLowEnergyWrapperFake::
|
| }
|
| }
|
|
|
| +void BluetoothLowEnergyWrapperFake::SimulateGattCharacteristicSetNotifyError(
|
| + GattCharacteristic* characteristic,
|
| + HRESULT error) {
|
| + characteristic->notify_errors.push_back(error);
|
| +}
|
| +
|
| void BluetoothLowEnergyWrapperFake::SimulateGattCharacteristicReadError(
|
| GattCharacteristic* characteristic,
|
| HRESULT error) {
|
|
|