diff options
Diffstat (limited to 'chromium/device/bluetooth/dbus/fake_bluetooth_device_client.cc')
-rw-r--r-- | chromium/device/bluetooth/dbus/fake_bluetooth_device_client.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/chromium/device/bluetooth/dbus/fake_bluetooth_device_client.cc b/chromium/device/bluetooth/dbus/fake_bluetooth_device_client.cc index ebe5e78ddd2..8dfcd20fd17 100644 --- a/chromium/device/bluetooth/dbus/fake_bluetooth_device_client.cc +++ b/chromium/device/bluetooth/dbus/fake_bluetooth_device_client.cc @@ -29,6 +29,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h" +#include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h" #include "device/bluetooth/dbus/bluez_dbus_manager.h" #include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h" #include "device/bluetooth/dbus/fake_bluetooth_agent_manager_client.h" @@ -625,6 +626,28 @@ void FakeBluetoothDeviceClient::GetServiceRecords( callback.Run(CreateFakeServiceRecords()); } +void FakeBluetoothDeviceClient::ExecuteWrite( + const dbus::ObjectPath& object_path, + const base::Closure& callback, + const ErrorCallback& error_callback) { + for (const auto& prepare_write_request : prepare_write_requests_) { + bluez::BluezDBusManager::Get() + ->GetBluetoothGattCharacteristicClient() + ->WriteValue(prepare_write_request.first, prepare_write_request.second, + base::DoNothing(), base::DoNothing()); + } + prepare_write_requests_.clear(); + callback.Run(); +} + +void FakeBluetoothDeviceClient::AbortWrite( + const dbus::ObjectPath& object_path, + const base::Closure& callback, + const ErrorCallback& error_callback) { + prepare_write_requests_.clear(); + callback.Run(); +} + void FakeBluetoothDeviceClient::BeginDiscoverySimulation( const dbus::ObjectPath& adapter_path) { VLOG(1) << "starting discovery simulation"; @@ -1885,4 +1908,10 @@ void FakeBluetoothDeviceClient::CreateTestDevice( observer.DeviceAdded(device_path); } +void FakeBluetoothDeviceClient::AddPrepareWriteRequest( + const dbus::ObjectPath& object_path, + const std::vector<uint8_t>& value) { + prepare_write_requests_.emplace_back(object_path, value); +} + } // namespace bluez |