| 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/scoped_nsobject.h" |
| 8 #include "base/mac/sdk_forward_declarations.h" | 9 #include "base/mac/sdk_forward_declarations.h" |
| 9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 10 #include "device/bluetooth/test/bluetooth_test_mac.h" | 11 #include "device/bluetooth/test/bluetooth_test_mac.h" |
| 11 | 12 |
| 12 #import <CoreBluetooth/CoreBluetooth.h> | 13 #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 { |
| 21 @private |
| 22 base::scoped_nsobject<NSArray> scan_uuids_; |
| 23 } |
| 20 | 24 |
| 21 @property(nonatomic, assign) NSInteger scanForPeripheralsCallCount; | 25 @property(nonatomic, assign) NSInteger scanForPeripheralsCallCount; |
| 22 @property(nonatomic, assign) NSInteger stopScanCallCount; | 26 @property(nonatomic, assign) NSInteger stopScanCallCount; |
| 23 @property(nonatomic, assign) id<CBCentralManagerDelegate> delegate; | 27 @property(nonatomic, assign) id<CBCentralManagerDelegate> delegate; |
| 24 @property(nonatomic, assign) CBCentralManagerState state; | 28 @property(nonatomic, assign) CBCentralManagerState state; |
| 25 @property(nonatomic, assign) device::BluetoothTestMac* bluetoothTestMac; | 29 @property(nonatomic, assign) device::BluetoothTestMac* bluetoothTestMac; |
| 30 @property(nonatomic, copy, readonly) NSArray* scan_uuids; |
| 26 | 31 |
| 27 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs | 32 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs |
| 28 options:(NSDictionary*)options; | 33 options:(NSDictionary*)options; |
| 29 | 34 |
| 30 - (void)stopScan; | 35 - (void)stopScan; |
| 31 | 36 |
| 32 - (void)connectPeripheral:(CBPeripheral*)peripheral | 37 - (void)connectPeripheral:(CBPeripheral*)peripheral |
| 33 options:(NSDictionary*)options; | 38 options:(NSDictionary*)options; |
| 34 | 39 |
| 40 - (void)resetEventCounts; |
| 41 |
| 35 @end | 42 @end |
| 36 | 43 |
| 37 #endif // DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CENTRAL_MANAGER_MAC_H_ | 44 #endif // DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CENTRAL_MANAGER_MAC_H_ |
| OLD | NEW |