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

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

Issue 1950033002: bluetooth: mac: Initial BluetoothRemoteGattCharacteristicMac implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@servicescan_cleanup
Patch Set: Fixing the build Created 4 years, 6 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_cbperipheral_mac.mm
diff --git a/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm b/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm
index a4fa499dca958d7585a54fb3aaa91e3132aa78c9..3f36cc7142bec020ff87c97c93fa361e15f1a439 100644
--- a/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm
+++ b/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm
@@ -84,6 +84,11 @@ using base::scoped_nsobject;
if (_bluetoothTestMac) {
_bluetoothTestMac->OnFakeBluetoothServiceDiscovery();
}
+ [_delegate peripheral:self.peripheral didDiscoverServices:nil];
+}
+
+- (void)discoverCharacteristics:(NSArray*)characteristics
+ forService:(CBService*)service {
}
- (void)removeAllServices {
@@ -95,8 +100,10 @@ using base::scoped_nsobject;
_services.reset([[NSMutableArray alloc] init]);
}
for (CBUUID* uuid in services) {
- base::scoped_nsobject<MockCBService> service(
- [[MockCBService alloc] initWithCBUUID:uuid primary:YES]);
+ base::scoped_nsobject<MockCBService> service([[MockCBService alloc]
+ initWithPeripheral:self.peripheral
+ CBUUID:uuid
+ primary:YES]);
[_services.get() addObject:service.get().service];
}
}
@@ -110,6 +117,18 @@ using base::scoped_nsobject;
base::scoped_policy::RETAIN);
DCHECK(serviceToRemove);
[_services.get() removeObject:serviceToRemove];
+ [self didModifyServices:@[ serviceToRemove ]];
+}
+
+- (void)didDiscoverCharactericsForAllServices {
+ for (CBService* service in _services.get()) {
+ [_delegate peripheral:self.peripheral
+ didDiscoverCharacteristicsForService:service
+ error:nil];
+ }
+}
+
+- (void)didModifyServices:(NSArray*)invalidatedServices {
// -[CBPeripheralDelegate peripheral:didModifyServices:] is only available
// with 10.9. It is safe to call this method (even if chrome is running on
// 10.8) since WebBluetooth is enabled only with 10.10.
@@ -117,7 +136,7 @@ using base::scoped_nsobject;
[_delegate respondsToSelector:@selector(peripheral:didModifyServices:)]);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
- [_delegate peripheral:self.peripheral didModifyServices:@[ serviceToRemove ]];
+ [_delegate peripheral:self.peripheral didModifyServices:invalidatedServices];
#pragma clang diagnostic pop
}
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h ('k') | device/bluetooth/test/mock_bluetooth_cbservice_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698