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

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

Issue 2026193002: Preparing for characteristics discovery (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Same behavior than CoreBluetooth Created 4 years, 7 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 02d64556d53624d5446a7a0b98b20190ac7065b2..3508121f5afb5f6d01fe5f1b793daf8812cf431f 100644
--- a/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm
+++ b/device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm
@@ -45,7 +45,6 @@ using base::scoped_nsobject;
- (instancetype)initWithIdentifier:(NSUUID*)identifier name:(NSString*)name {
self = [super init];
if (self) {
- _services.reset([[NSMutableArray alloc] init]);
_identifier.reset([identifier retain]);
if (name) {
_name.reset([name retain]);
@@ -76,6 +75,9 @@ using base::scoped_nsobject;
- (void)setState:(CBPeripheralState)state {
_state = state;
+ if (_state == CBPeripheralStateDisconnected) {
+ _services = nil;
+ }
}
- (void)discoverServices:(NSArray*)serviceUUIDs {
@@ -89,6 +91,9 @@ using base::scoped_nsobject;
}
- (void)addServices:(NSArray*)services {
+ if (!_services.get()) {
+ _services.reset([[NSMutableArray alloc] init]);
+ }
for (CBUUID* uuid in services) {
base::scoped_nsobject<MockCBService> service(
[[MockCBService alloc] initWithCBUUID:uuid primary:YES]);
@@ -96,7 +101,7 @@ using base::scoped_nsobject;
}
}
-- (void)didDiscoverWithError:(NSError*)error {
+- (void)didDiscoverServicesWithError:(NSError*)error {
[_delegate peripheral:self.peripheral didDiscoverServices:error];
}

Powered by Google App Engine
This is Rietveld 408576698