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 "mock_bluetooth_central_manager_mac.h" | 5 #import "device/bluetooth/test/mock_bluetooth_central_manager_mac.h" |
| 6 |
| 7 #import "device/bluetooth/test/bluetooth_test_mac.h" |
| 8 #import "device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h" |
6 | 9 |
7 @implementation MockCentralManager | 10 @implementation MockCentralManager |
8 | 11 |
9 @synthesize scanForPeripheralsCallCount = _scanForPeripheralsCallCount; | 12 @synthesize scanForPeripheralsCallCount = _scanForPeripheralsCallCount; |
10 @synthesize stopScanCallCount = _stopScanCallCount; | 13 @synthesize stopScanCallCount = _stopScanCallCount; |
11 @synthesize delegate = _delegate; | 14 @synthesize delegate = _delegate; |
12 @synthesize state = _state; | 15 @synthesize state = _state; |
| 16 @synthesize bluetoothTestMac = _bluetoothTestMac; |
13 | 17 |
14 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs | 18 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs |
15 options:(NSDictionary*)options { | 19 options:(NSDictionary*)options { |
16 _scanForPeripheralsCallCount++; | 20 _scanForPeripheralsCallCount++; |
17 } | 21 } |
18 | 22 |
19 - (void)stopScan { | 23 - (void)stopScan { |
20 _stopScanCallCount++; | 24 _stopScanCallCount++; |
21 } | 25 } |
22 | 26 |
| 27 - (void)connectPeripheral:(CBPeripheral*)peripheral |
| 28 options:(NSDictionary*)options { |
| 29 if (_bluetoothTestMac) { |
| 30 _bluetoothTestMac->OnFakeBluetoothDeviceConnectGattCalled(); |
| 31 } |
| 32 } |
| 33 |
| 34 - (void)cancelPeripheralConnection:(CBPeripheral*)peripheral { |
| 35 if (_bluetoothTestMac) { |
| 36 _bluetoothTestMac->OnFakeBluetoothGattDisconnect(); |
| 37 } |
| 38 } |
| 39 |
23 @end | 40 @end |
OLD | NEW |