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

Unified Diff: device/bluetooth/test/mock_bluetooth_cbperipheral_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
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm
diff --git a/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm b/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm
index eae22f4e987255e1188095a086c24c458e0727f6..8a5eafe8d5a22d1864ac43538898697a115ff75e 100644
--- a/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm
+++ b/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm
@@ -7,6 +7,7 @@
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsobject.h"
#include "device/bluetooth/test/bluetooth_test_mac.h"
+#include "device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h"
#include "device/bluetooth/test/mock_bluetooth_cbservice_mac.h"
using base::mac::ObjCCast;
@@ -89,6 +90,12 @@ using base::scoped_nsobject;
forService:(CBService*)service {
}
+- (void)discoverDescriptorsForCharacteristic:(CBCharacteristic*)characteristic {
+ MockCBCharacteristic* mock_characteristic =
+ ObjCCast<MockCBCharacteristic>(characteristic);
+ [mock_characteristic discoverDescriptors];
+}
+
- (void)readValueForCharacteristic:(CBCharacteristic*)characteristic {
DCHECK(_bluetoothTestMac);
_bluetoothTestMac->OnFakeBluetoothCharacteristicReadValue();
@@ -132,13 +139,6 @@ using base::scoped_nsobject;
[self didModifyServices:@[ serviceToRemove ]];
}
-
-- (void)didModifyServices:(NSArray*)invalidatedServices {
- DCHECK(
- [_delegate respondsToSelector:@selector(peripheral:didModifyServices:)]);
- [_delegate peripheral:self.peripheral didModifyServices:invalidatedServices];
-}
-
- (void)mockDidDiscoverEvents {
[_delegate peripheral:self.peripheral didDiscoverServices:nil];
// BluetoothLowEnergyDeviceMac is expected to call
@@ -149,9 +149,29 @@ using base::scoped_nsobject;
[_delegate peripheral:self.peripheral
didDiscoverCharacteristicsForService:service
error:nil];
+ for (CBCharacteristic* characteristic in service.characteristics) {
+ // After discovering services, BluetoothLowEnergyDeviceMac is expected to
+ // discover characteristics for all services.
+ [_delegate peripheral:self.peripheral
+ didDiscoverDescriptorsForCharacteristic:characteristic
+ error:nil];
+ }
}
}
+- (void)didModifyServices:(NSArray*)invalidatedServices {
+ DCHECK(
+ [_delegate respondsToSelector:@selector(peripheral:didModifyServices:)]);
+ [_delegate peripheral:self.peripheral didModifyServices:invalidatedServices];
+}
+
+- (void)didDiscoverDescriptorsWithCharacteristic:
+ (MockCBCharacteristic*)characteristic_mock {
+ [_delegate peripheral:self.peripheral
+ didDiscoverDescriptorsForCharacteristic:characteristic_mock.characteristic
+ error:nil];
+}
+
- (NSUUID*)identifier {
return _identifier.get();
}
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698