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

Unified Diff: device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.mm

Issue 2595373003: Bluetooth: mac: Working on macOS descriptor implementation. (Closed)
Patch Set: Fixes Created 3 years, 11 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/mock_bluetooth_cbcharacteristic_mac.mm
diff --git a/device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.mm b/device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.mm
index be7a3f2cc43e1d0989006339dcda9cf0159c7af2..31816c79a50847c2823cdb052bcec3dafd48e39f 100644
--- a/device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.mm
+++ b/device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.mm
@@ -7,6 +7,7 @@
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsobject.h"
#include "device/bluetooth/bluetooth_gatt_characteristic.h"
+#include "device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.h"
using base::mac::ObjCCast;
using base::scoped_nsobject;
@@ -93,7 +94,9 @@ CBCharacteristicProperties GattCharacteristicPropertyToCBCharacteristicProperty(
CBService* _service;
scoped_nsobject<CBUUID> _UUID;
CBCharacteristicProperties _cb_properties;
- base::scoped_nsobject<NSData> _value;
+ scoped_nsobject<NSMutableArray> _simulatedDescriptors;
+ scoped_nsobject<NSArray> _descriptors;
+ scoped_nsobject<NSData> _value;
BOOL _notifying;
}
@end
@@ -110,6 +113,7 @@ CBCharacteristicProperties GattCharacteristicPropertyToCBCharacteristicProperty(
_cb_properties =
device::GattCharacteristicPropertyToCBCharacteristicProperty(
properties);
+ _simulatedDescriptors.reset([[NSMutableArray alloc] init]);
}
return self;
}
@@ -168,6 +172,17 @@ CBCharacteristicProperties GattCharacteristicPropertyToCBCharacteristicProperty(
error:nil];
}
+- (void)simulateDescriptorWithUUID:(CBUUID*)uuid {
+ scoped_nsobject<MockCBDescriptor> descriptor_mock([[MockCBDescriptor alloc]
+ initWithCharacteristic:self.characteristic
+ CBUUID:uuid]);
+ [_simulatedDescriptors.get() addObject:descriptor_mock];
+}
+
+- (void)discoverDescriptors {
+ _descriptors.reset([_simulatedDescriptors copy]);
+}
+
- (CBUUID*)UUID {
return _UUID.get();
}
@@ -184,6 +199,10 @@ CBCharacteristicProperties GattCharacteristicPropertyToCBCharacteristicProperty(
return _cb_properties;
}
+- (NSArray*)descriptors {
+ return _descriptors;
+}
+
- (NSData*)value {
return _value.get();
}
@@ -192,4 +211,4 @@ CBCharacteristicProperties GattCharacteristicPropertyToCBCharacteristicProperty(
return _notifying;
}
-@end
+@end
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h ('k') | device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698