| 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 e370b700ee7c8c52217b9a12a5e7d3e0231dd4e1..c7ccd33fc92233d9eaf0b9a87b6a6b14e9281efc 100644
|
| --- a/device/bluetooth/bluetooth_low_energy_win_fake.cc
|
| +++ b/device/bluetooth/bluetooth_low_energy_win_fake.cc
|
| @@ -261,7 +261,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;
|
| @@ -269,8 +268,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();
|
| @@ -481,6 +490,12 @@ void BluetoothLowEnergyWrapperFake::
|
| }
|
| }
|
|
|
| +void BluetoothLowEnergyWrapperFake::SimulateGattCharacteristicSetNotifyError(
|
| + GattCharacteristic* characteristic,
|
| + HRESULT error) {
|
| + characteristic->notify_errors.push_back(error);
|
| +}
|
| +
|
| void BluetoothLowEnergyWrapperFake::SimulateGattCharacteristicReadError(
|
| GattCharacteristic* characteristic,
|
| HRESULT error) {
|
|
|