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

Unified Diff: device/bluetooth/test/bluetooth_test_mac.h

Issue 2767813002: Bluetooth: macOS: Implementing read/write for descriptors (Closed)
Patch Set: NSString/NSNumber type for descriptor value Created 3 years, 8 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_mac.h
diff --git a/device/bluetooth/test/bluetooth_test_mac.h b/device/bluetooth/test/bluetooth_test_mac.h
index 46e168a4d7c103432301130a05f5c1e113bd6085..5eb0042626a26eeb434f605a4677c13e4972f119 100644
--- a/device/bluetooth/test/bluetooth_test_mac.h
+++ b/device/bluetooth/test/bluetooth_test_mac.h
@@ -11,9 +11,11 @@
#include "device/bluetooth/test/bluetooth_test.h"
#if __OBJC__
+@class MockCBDescriptor;
@class MockCBCharacteristic;
@class MockCBPeripheral;
#else // __OBJC__
+class MockCBDescriptor;
class MockCBCharacteristic;
class MockCBPeripheral;
#endif // __OBJC__
@@ -85,6 +87,16 @@ class BluetoothTestMac : public BluetoothTestBase {
void SimulateGattCharacteristicRemoved(
BluetoothRemoteGattService* service,
BluetoothRemoteGattCharacteristic* characteristic) override;
+ void SimulateGattDescriptorRead(BluetoothRemoteGattDescriptor* descriptor,
+ const std::vector<uint8_t>& value) override;
+ void SimulateGattDescriptorReadError(
+ BluetoothRemoteGattDescriptor* descriptor,
+ BluetoothRemoteGattService::GattErrorCode error_code) override;
+ void SimulateGattDescriptorWrite(
+ BluetoothRemoteGattDescriptor* descriptor) override;
+ void SimulateGattDescriptorWriteError(
+ BluetoothRemoteGattDescriptor* descriptor,
+ BluetoothRemoteGattService::GattErrorCode error_code) override;
void ExpectedChangeNotifyValueAttempts(int attempts) override;
void ExpectedNotifyValue(NotifyValueState expected_value_state) override;
@@ -93,6 +105,21 @@ class BluetoothTestMac : public BluetoothTestBase {
// set of attributes.
void SimulateDidDiscoverServices(BluetoothDevice* device,
const std::vector<std::string>& uuids);
+ // CoreBluetooth can return NSData when reading remote gatt descriptors.
+ // This methods simulate receiving NSData from CoreBluetooth.
+ void SimulateGattDescriptorReadNSData(
+ BluetoothRemoteGattDescriptor* descriptor,
+ const std::vector<uint8_t>& value);
+ // CoreBluetooth can return NSString when reading remote gatt descriptors.
+ // This methods simulate receiving NSString from CoreBluetooth.
+ void SimulateGattDescriptorReadNSString(
+ BluetoothRemoteGattDescriptor* descriptor,
+ const std::string& value);
+ // CoreBluetooth can return NSString when reading remote gatt descriptors.
+ // This methods simulate receiving NSString from CoreBluetooth.
+ void SimulateGattDescriptorReadNSNumber(
+ BluetoothRemoteGattDescriptor* descriptor,
+ short value);
// Callback for the bluetooth central manager mock.
void OnFakeBluetoothDeviceConnectGattCalled();
@@ -104,6 +131,8 @@ class BluetoothTestMac : public BluetoothTestBase {
void OnFakeBluetoothCharacteristicReadValue();
void OnFakeBluetoothCharacteristicWriteValue(std::vector<uint8_t> value);
void OnFakeBluetoothGattSetCharacteristicNotification(bool notify_value);
+ void OnFakeBluetoothDescriptorReadValue();
+ void OnFakeBluetoothDescriptorWriteValue(std::vector<uint8_t> value);
// Returns the service UUIDs used to retrieve connected peripherals.
BluetoothDevice::UUIDSet RetrieveConnectedPeripheralServiceUUIDs();
@@ -121,9 +150,15 @@ class BluetoothTestMac : public BluetoothTestBase {
// Returns MockCBPeripheral from BluetoothRemoteGattCharacteristic.
MockCBPeripheral* GetMockCBPeripheral(
BluetoothRemoteGattCharacteristic* characteristic) const;
+ // Returns MockCBPeripheral from BluetoothRemoteGattDescriptor.
+ MockCBPeripheral* GetMockCBPeripheral(
+ BluetoothRemoteGattDescriptor* descriptor) const;
// Returns MockCBCharacteristic from BluetoothRemoteGattCharacteristic.
MockCBCharacteristic* GetCBMockCharacteristic(
BluetoothRemoteGattCharacteristic* characteristic) const;
+ // Returns MockCBDescriptor from BluetoothRemoteGattDescriptor.
+ MockCBDescriptor* GetCBMockDescriptor(
+ BluetoothRemoteGattDescriptor* descriptor) const;
// Adds services in MockCBPeripheral.
void AddServicesToDevice(BluetoothDevice* device,
const std::vector<std::string>& uuids);

Powered by Google App Engine
This is Rietveld 408576698