Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Unified Diff: device/bluetooth/test/bluetooth_test_bluez.cc

Issue 1979163002: Add DBus plumbing and tests for sending devices with ATT read/writes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@devices
Patch Set: gyp fix Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 182fd0f1840d261c6f232d568c5ce4eb9311c666..f1188ed64b99d7093cc892d977671510eaadb123 100644
--- a/device/bluetooth/test/bluetooth_test_bluez.cc
+++ b/device/bluetooth/test/bluetooth_test_bluez.cc
@@ -5,6 +5,7 @@
#include "device/bluetooth/test/bluetooth_test_bluez.h"
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/callback.h"
@@ -12,17 +13,19 @@
#include "base/run_loop.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluez/bluetooth_adapter_bluez.h"
+#include "device/bluetooth/bluez/bluetooth_device_bluez.h"
#include "device/bluetooth/bluez/bluetooth_gatt_characteristic_bluez.h"
#include "device/bluetooth/bluez/bluetooth_gatt_descriptor_bluez.h"
#include "device/bluetooth/bluez/bluetooth_local_gatt_characteristic_bluez.h"
#include "device/bluetooth/bluez/bluetooth_local_gatt_descriptor_bluez.h"
+#include "device/bluetooth/bluez/bluetooth_local_gatt_service_bluez.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
#include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
#include "device/bluetooth/dbus/fake_bluetooth_device_client.h"
#include "device/bluetooth/dbus/fake_bluetooth_gatt_characteristic_service_provider.h"
#include "device/bluetooth/dbus/fake_bluetooth_gatt_descriptor_service_provider.h"
#include "device/bluetooth/dbus/fake_bluetooth_gatt_manager_client.h"
-#include "device/bluetooth/test/bluetooth_gatt_server_test.h"
+#include "device/bluetooth/test/test_bluetooth_local_gatt_service_delegate.h"
namespace device {
@@ -46,6 +49,12 @@ void ClosureCallback(const base::Closure& quit_closure,
quit_closure.Run();
}
+dbus::ObjectPath GetDevicePath(BluetoothDevice* device) {
+ bluez::BluetoothDeviceBlueZ* device_bluez =
+ static_cast<bluez::BluetoothDeviceBlueZ*>(device);
+ return device_bluez->object_path();
+}
+
} // namespace
BluetoothTestBlueZ::BluetoothTestBlueZ()
@@ -124,6 +133,7 @@ BluetoothDevice* BluetoothTestBlueZ::SimulateLowEnergyDevice(
}
void BluetoothTestBlueZ::SimulateLocalGattCharacteristicValueReadRequest(
+ BluetoothDevice* from_device,
BluetoothLocalGattCharacteristic* characteristic,
const BluetoothLocalGattService::Delegate::ValueCallback& value_callback,
const base::Closure& error_callback) {
@@ -147,12 +157,14 @@ void BluetoothTestBlueZ::SimulateLocalGattCharacteristicValueReadRequest(
base::RunLoop run_loop;
characteristic_provider->GetValue(
+ GetDevicePath(from_device),
base::Bind(&GetValueCallback, run_loop.QuitClosure(), value_callback),
base::Bind(&ClosureCallback, run_loop.QuitClosure(), error_callback));
run_loop.Run();
}
void BluetoothTestBlueZ::SimulateLocalGattCharacteristicValueWriteRequest(
+ BluetoothDevice* from_device,
BluetoothLocalGattCharacteristic* characteristic,
const std::vector<uint8_t>& value_to_write,
const base::Closure& success_callback,
@@ -177,13 +189,14 @@ void BluetoothTestBlueZ::SimulateLocalGattCharacteristicValueWriteRequest(
base::RunLoop run_loop;
characteristic_provider->SetValue(
- value_to_write,
+ GetDevicePath(from_device), value_to_write,
base::Bind(&ClosureCallback, run_loop.QuitClosure(), success_callback),
base::Bind(&ClosureCallback, run_loop.QuitClosure(), error_callback));
run_loop.Run();
}
void BluetoothTestBlueZ::SimulateLocalGattDescriptorValueReadRequest(
+ BluetoothDevice* from_device,
BluetoothLocalGattDescriptor* descriptor,
const BluetoothLocalGattService::Delegate::ValueCallback& value_callback,
const base::Closure& error_callback) {
@@ -205,12 +218,14 @@ void BluetoothTestBlueZ::SimulateLocalGattDescriptorValueReadRequest(
base::RunLoop run_loop;
descriptor_provider->GetValue(
+ GetDevicePath(from_device),
base::Bind(&GetValueCallback, run_loop.QuitClosure(), value_callback),
base::Bind(&ClosureCallback, run_loop.QuitClosure(), error_callback));
run_loop.Run();
}
void BluetoothTestBlueZ::SimulateLocalGattDescriptorValueWriteRequest(
+ BluetoothDevice* from_device,
BluetoothLocalGattDescriptor* descriptor,
const std::vector<uint8_t>& value_to_write,
const base::Closure& success_callback,
@@ -233,7 +248,7 @@ void BluetoothTestBlueZ::SimulateLocalGattDescriptorValueWriteRequest(
base::RunLoop run_loop;
descriptor_provider->SetValue(
- value_to_write,
+ GetDevicePath(from_device), value_to_write,
base::Bind(&ClosureCallback, run_loop.QuitClosure(), success_callback),
base::Bind(&ClosureCallback, run_loop.QuitClosure(), error_callback));
run_loop.Run();
« no previous file with comments | « device/bluetooth/test/bluetooth_test_bluez.h ('k') | device/bluetooth/test/test_bluetooth_local_gatt_service_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698