Index: device/bluetooth/test/mock_bluetooth_central_manager_mac.mm |
diff --git a/device/bluetooth/test/mock_bluetooth_central_manager_mac.mm b/device/bluetooth/test/mock_bluetooth_central_manager_mac.mm |
index 96e7ce9564303e3180cd52e75d1d9d9f8b149596..fbb0dff41e75d315a5044a6e61dde508fe7382fd 100644 |
--- a/device/bluetooth/test/mock_bluetooth_central_manager_mac.mm |
+++ b/device/bluetooth/test/mock_bluetooth_central_manager_mac.mm |
@@ -2,7 +2,10 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#import "mock_bluetooth_central_manager_mac.h" |
+#import "device/bluetooth/test/mock_bluetooth_central_manager_mac.h" |
+ |
+#import "device/bluetooth/test/bluetooth_test_mac.h" |
+#import "device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h" |
@implementation MockCentralManager |
@@ -10,6 +13,23 @@ |
@synthesize stopScanCallCount = _stopScanCallCount; |
@synthesize delegate = _delegate; |
@synthesize state = _state; |
+@synthesize bluetoothTestMac = _bluetoothTestMac; |
+ |
+- (BOOL)isKindOfClass:(Class)aClass { |
+ if (aClass == [CBCentralManager class] || |
+ [aClass isSubclassOfClass:[CBCentralManager class]]) { |
+ return YES; |
+ } |
+ return [super isKindOfClass:aClass]; |
+} |
+ |
+- (BOOL)isMemberOfClass:(Class)aClass { |
+ if (aClass == [CBCentralManager class] || |
+ [aClass isSubclassOfClass:[CBCentralManager class]]) { |
+ return YES; |
+ } |
+ return [super isKindOfClass:aClass]; |
+} |
- (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs |
options:(NSDictionary*)options { |
@@ -20,4 +40,17 @@ |
_stopScanCallCount++; |
} |
+- (void)connectPeripheral:(CBPeripheral*)peripheral |
+ options:(NSDictionary*)options { |
+ if (_bluetoothTestMac) { |
+ _bluetoothTestMac->OnFakeBluetoothDeviceConnectGattCalled(); |
+ } |
+} |
+ |
+- (void)cancelPeripheralConnection:(CBPeripheral*)peripheral { |
+ if (_bluetoothTestMac) { |
+ _bluetoothTestMac->OnFakeBluetoothGattDisconnect(); |
+ } |
+} |
+ |
@end |