| 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 #ifndef DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CENTRAL_MANAGER_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CENTRAL_MANAGER_MAC_H_ |
| 6 #define DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CENTRAL_MANAGER_MAC_H_ | 6 #define DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CENTRAL_MANAGER_MAC_H_ |
| 7 | 7 |
| 8 #include "base/mac/sdk_forward_declarations.h" | 8 #import <CoreBluetooth/CoreBluetooth.h> |
| 9 |
| 10 #import "base/mac/sdk_forward_declarations.h" |
| 9 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 10 #include "device/bluetooth/test/bluetooth_test_mac.h" | 12 #import "device/bluetooth/bluetooth_adapter_mac.h" |
| 11 | 13 #import "device/bluetooth/test/bluetooth_test_mac.h" |
| 12 #import <CoreBluetooth/CoreBluetooth.h> | |
| 13 | 14 |
| 14 // Class to mock a CBCentralManager. Cannot use a OCMockObject because mocking | 15 // Class to mock a CBCentralManager. Cannot use a OCMockObject because mocking |
| 15 // the 'state' property gives a compiler warning when mock_central_manager is of | 16 // the 'state' property gives a compiler warning when mock_central_manager is of |
| 16 // type id (multiple methods named 'state' found), and a compiler warning when | 17 // type id (multiple methods named 'state' found), and a compiler warning when |
| 17 // mock_central_manager is of type CBCentralManager (CBCentralManager may not | 18 // mock_central_manager is of type CBCentralManager (CBCentralManager may not |
| 18 // respond to 'stub'). | 19 // respond to 'stub'). |
| 19 @interface MockCentralManager : NSObject | 20 @interface MockCentralManager : NSObject |
| 20 | 21 |
| 21 @property(nonatomic, assign) NSInteger scanForPeripheralsCallCount; | 22 @property(nonatomic, assign) NSInteger scanForPeripheralsCallCount; |
| 22 @property(nonatomic, assign) NSInteger stopScanCallCount; | 23 @property(nonatomic, assign) NSInteger stopScanCallCount; |
| 23 @property(nonatomic, assign) id<CBCentralManagerDelegate> delegate; | 24 @property(nonatomic, assign) id<CBCentralManagerDelegate> delegate; |
| 24 @property(nonatomic, assign) CBCentralManagerState state; | 25 @property(nonatomic, assign) CBManagerState state; |
| 25 @property(nonatomic, assign) device::BluetoothTestMac* bluetoothTestMac; | 26 @property(nonatomic, assign) device::BluetoothTestMac* bluetoothTestMac; |
| 26 @property(nonatomic, readonly) NSArray* retrieveConnectedPeripheralServiceUUIDs; | 27 @property(nonatomic, readonly) NSArray* retrieveConnectedPeripheralServiceUUIDs; |
| 27 | 28 |
| 28 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs | 29 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs |
| 29 options:(NSDictionary*)options; | 30 options:(NSDictionary*)options; |
| 30 | 31 |
| 31 - (void)stopScan; | 32 - (void)stopScan; |
| 32 | 33 |
| 33 - (void)connectPeripheral:(CBPeripheral*)peripheral | 34 - (void)connectPeripheral:(CBPeripheral*)peripheral |
| 34 options:(NSDictionary*)options; | 35 options:(NSDictionary*)options; |
| 35 | 36 |
| 36 // Simulates a peripheral being used by another application. This peripheral | 37 // Simulates a peripheral being used by another application. This peripheral |
| 37 // will be returned by -[MockCentralManager | 38 // will be returned by -[MockCentralManager |
| 38 // retrieveConnectedPeripheralsWithServices:]. | 39 // retrieveConnectedPeripheralsWithServices:]. |
| 39 - (void)setConnectedMockPeripheral:(CBPeripheral*)peripheral | 40 - (void)setConnectedMockPeripheral:(CBPeripheral*)peripheral |
| 40 withServiceUUIDs:(NSSet*)serviceUUIDs; | 41 withServiceUUIDs:(NSSet*)serviceUUIDs; |
| 41 | 42 |
| 42 // Reset -[MockCentralManager retrieveConnectedPeripheralServiceUUIDs]. | 43 // Reset -[MockCentralManager retrieveConnectedPeripheralServiceUUIDs]. |
| 43 - (void)resetRetrieveConnectedPeripheralServiceUUIDs; | 44 - (void)resetRetrieveConnectedPeripheralServiceUUIDs; |
| 44 | 45 |
| 45 @end | 46 @end |
| 46 | 47 |
| 47 #endif // DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CENTRAL_MANAGER_MAC_H_ | 48 #endif // DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CENTRAL_MANAGER_MAC_H_ |
| OLD | NEW |