| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "device/bluetooth/test/mock_bluetooth_central_manager_mac.h" | 5 #import "device/bluetooth/test/mock_bluetooth_central_manager_mac.h" |
| 6 | 6 |
| 7 #import "device/bluetooth/test/bluetooth_test_mac.h" | 7 #import "device/bluetooth/test/bluetooth_test_mac.h" |
| 8 #import "device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h" | 8 #import "device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h" |
| 9 | 9 |
| 10 @implementation MockCentralManager | 10 @implementation MockCentralManager |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 - (BOOL)isMemberOfClass:(Class)aClass { | 26 - (BOOL)isMemberOfClass:(Class)aClass { |
| 27 if (aClass == [CBCentralManager class] || | 27 if (aClass == [CBCentralManager class] || |
| 28 [aClass isSubclassOfClass:[CBCentralManager class]]) { | 28 [aClass isSubclassOfClass:[CBCentralManager class]]) { |
| 29 return YES; | 29 return YES; |
| 30 } | 30 } |
| 31 return [super isKindOfClass:aClass]; | 31 return [super isKindOfClass:aClass]; |
| 32 } | 32 } |
| 33 | 33 |
| 34 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs | 34 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs |
| 35 options:(NSDictionary*)options { | 35 options:(NSDictionary*)options { |
| 36 scan_uuids_.reset([serviceUUIDs retain]); |
| 36 _scanForPeripheralsCallCount++; | 37 _scanForPeripheralsCallCount++; |
| 37 } | 38 } |
| 38 | 39 |
| 39 - (void)stopScan { | 40 - (void)stopScan { |
| 40 _stopScanCallCount++; | 41 _stopScanCallCount++; |
| 41 } | 42 } |
| 42 | 43 |
| 43 - (void)connectPeripheral:(CBPeripheral*)peripheral | 44 - (void)connectPeripheral:(CBPeripheral*)peripheral |
| 44 options:(NSDictionary*)options { | 45 options:(NSDictionary*)options { |
| 45 if (_bluetoothTestMac) { | 46 if (_bluetoothTestMac) { |
| 46 _bluetoothTestMac->OnFakeBluetoothDeviceConnectGattCalled(); | 47 _bluetoothTestMac->OnFakeBluetoothDeviceConnectGattCalled(); |
| 47 } | 48 } |
| 48 } | 49 } |
| 49 | 50 |
| 50 - (void)cancelPeripheralConnection:(CBPeripheral*)peripheral { | 51 - (void)cancelPeripheralConnection:(CBPeripheral*)peripheral { |
| 51 if (_bluetoothTestMac) { | 52 if (_bluetoothTestMac) { |
| 52 _bluetoothTestMac->OnFakeBluetoothGattDisconnect(); | 53 _bluetoothTestMac->OnFakeBluetoothGattDisconnect(); |
| 53 } | 54 } |
| 54 } | 55 } |
| 55 | 56 |
| 57 - (NSArray*)scan_uuids { |
| 58 return scan_uuids_.get(); |
| 59 } |
| 60 |
| 61 - (void)resetEventCounts { |
| 62 _scanForPeripheralsCallCount = 0; |
| 63 _stopScanCallCount = 0; |
| 64 } |
| 65 |
| 56 @end | 66 @end |
| OLD | NEW |