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

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

Issue 1973703002: Implement //device/bt changes for notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notifications_dbus
Patch Set: 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 7ee6ec6f65f2c85b63f481f00544825134a07995..6194bc2673f74d1094c5fe1fe90c90884b288ac8 100644
--- a/device/bluetooth/test/bluetooth_test_bluez.cc
+++ b/device/bluetooth/test/bluetooth_test_bluez.cc
@@ -239,6 +239,47 @@ 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);
+}
+
+std::vector<uint8_t> BluetoothTestBlueZ::LastNotifactionValueForCharacteristic(
+ BluetoothLocalGattCharacteristic* characteristic) {
+ 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());
+
+ return characteristic_provider ? characteristic_provider->sent_value()
+ : std::vector<uint8_t>();
+}
+
std::vector<BluetoothLocalGattService*>
BluetoothTestBlueZ::RegisteredGattServices() {
std::vector<BluetoothLocalGattService*> services;
« 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