| 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_CBPERIPHERAL_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CBPERIPHERAL_MAC_H_ |
| 6 #define DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CBPERIPHERAL_MAC_H_ | 6 #define DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CBPERIPHERAL_MAC_H_ |
| 7 | 7 |
| 8 #include "base/mac/sdk_forward_declarations.h" | 8 #include "base/mac/sdk_forward_declarations.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| 11 #import <CoreBluetooth/CoreBluetooth.h> | 11 #import <CoreBluetooth/CoreBluetooth.h> |
| 12 | 12 |
| 13 namespace device { |
| 14 |
| 15 class BluetoothTestMac; |
| 16 } |
| 17 |
| 13 // This class mocks the behavior of a CBPeripheral. | 18 // This class mocks the behavior of a CBPeripheral. |
| 14 @interface MockCBPeripheral : NSObject | 19 @interface MockCBPeripheral : NSObject |
| 15 | 20 |
| 16 @property(nonatomic, readonly) CBPeripheralState state; | 21 @property(nonatomic, readonly) CBPeripheralState state; |
| 17 @property(nonatomic, readonly) NSUUID* identifier; | 22 @property(nonatomic, readonly) NSUUID* identifier; |
| 18 @property(nonatomic, readonly) NSString* name; | 23 @property(nonatomic, readonly) NSString* name; |
| 24 @property(nonatomic, assign) id<CBPeripheralDelegate> delegate; |
| 19 @property(nonatomic, readonly) CBPeripheral* peripheral; | 25 @property(nonatomic, readonly) CBPeripheral* peripheral; |
| 26 @property(retain, readonly) NSArray* services; |
| 27 @property(nonatomic, assign) device::BluetoothTestMac* bluetoothTestMac; |
| 20 | 28 |
| 21 - (instancetype)init NS_UNAVAILABLE; | 29 - (instancetype)init NS_UNAVAILABLE; |
| 22 - (instancetype)initWithIdentifier:(NSUUID*)identifier; | 30 - (instancetype)initWithIdentifier:(NSUUID*)identifier; |
| 23 - (instancetype)initWithUTF8StringIdentifier:(const char*)identifier; | 31 - (instancetype)initWithUTF8StringIdentifier:(const char*)identifier; |
| 24 - (instancetype)initWithIdentifier:(NSUUID*)identifier | 32 - (instancetype)initWithIdentifier:(NSUUID*)identifier |
| 25 name:(NSString*)name NS_DESIGNATED_INITIALIZER; | 33 name:(NSString*)name NS_DESIGNATED_INITIALIZER; |
| 26 | 34 |
| 35 // Methods for faking events. |
| 27 - (void)setState:(CBPeripheralState)state; | 36 - (void)setState:(CBPeripheralState)state; |
| 37 - (void)removeAllServices; |
| 38 - (void)addServices:(NSArray*)services; |
| 39 - (void)didDiscoverWithError:(NSError*)error; |
| 40 - (void)removeService:(CBService*)uuid; |
| 28 | 41 |
| 29 @end | 42 @end |
| 30 | 43 |
| 31 #endif // DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CBPERIPHERAL_MAC_H_ | 44 #endif // DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CBPERIPHERAL_MAC_H_ |
| OLD | NEW |