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

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

Issue 2767813002: Bluetooth: macOS: Implementing read/write for descriptors (Closed)
Patch Set: . 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/mock_bluetooth_cbdescriptor_mac.mm
diff --git a/device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm b/device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm
index 9c8512b5142a99d2d765d2fdbfd5099525492e0e..3a2f6152cc760c43c3c70542fa6d4aa04a1216fe 100644
--- a/device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm
+++ b/device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.mm
@@ -15,6 +15,7 @@ using base::scoped_nsobject;
// Owner of this instance.
CBCharacteristic* _characteristic;
scoped_nsobject<CBUUID> _UUID;
+ scoped_nsobject<NSData> _value;
}
@end
@@ -50,6 +51,10 @@ using base::scoped_nsobject;
return _UUID.get();
}
+- (NSData*)value {
+ return _value.get();
+}
+
- (CBDescriptor*)descriptor {
return ObjCCast<CBDescriptor>(self);
}
@@ -58,4 +63,19 @@ using base::scoped_nsobject;
return _characteristic;
}
+- (void)simulateReadWithValue:(id)value error:(NSError*)error {
+ _value.reset([value copy]);
+ CBPeripheral* peripheral = _characteristic.service.peripheral;
+ [peripheral.delegate peripheral:peripheral
+ didUpdateValueForDescriptor:self.descriptor
+ error:error];
+}
+
+- (void)simulateWriteWithError:(NSError*)error {
+ CBPeripheral* peripheral = _characteristic.service.peripheral;
+ [peripheral.delegate peripheral:peripheral
+ didWriteValueForDescriptor:self.descriptor
+ error:error];
+}
+
@end
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.h ('k') | device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698