| 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 { | 13 namespace device { |
| 14 | 14 |
| 15 class BluetoothTestMac; | 15 class BluetoothTestMac; |
| 16 } | 16 } |
| 17 | 17 |
| 18 @class MockCBCharacteristic; |
| 19 |
| 18 // This class mocks the behavior of a CBPeripheral. | 20 // This class mocks the behavior of a CBPeripheral. |
| 19 @interface MockCBPeripheral : NSObject | 21 @interface MockCBPeripheral : NSObject |
| 20 | 22 |
| 21 @property(nonatomic, readonly) CBPeripheralState state; | 23 @property(nonatomic, readonly) CBPeripheralState state; |
| 22 @property(nonatomic, readonly) NSUUID* identifier; | 24 @property(nonatomic, readonly) NSUUID* identifier; |
| 23 @property(nonatomic, readonly) NSString* name; | 25 @property(nonatomic, readonly) NSString* name; |
| 24 @property(nonatomic, assign) id<CBPeripheralDelegate> delegate; | 26 @property(nonatomic, assign) id<CBPeripheralDelegate> delegate; |
| 25 @property(nonatomic, readonly) CBPeripheral* peripheral; | 27 @property(nonatomic, readonly) CBPeripheral* peripheral; |
| 26 @property(retain, readonly) NSArray* services; | 28 @property(retain, readonly) NSArray* services; |
| 27 @property(nonatomic, assign) device::BluetoothTestMac* bluetoothTestMac; | 29 @property(nonatomic, assign) device::BluetoothTestMac* bluetoothTestMac; |
| 28 | 30 |
| 29 - (instancetype)init NS_UNAVAILABLE; | 31 - (instancetype)init NS_UNAVAILABLE; |
| 30 - (instancetype)initWithUTF8StringIdentifier:(const char*)identifier; | 32 - (instancetype)initWithUTF8StringIdentifier:(const char*)identifier; |
| 31 - (instancetype)initWithUTF8StringIdentifier:(const char*)identifier | 33 - (instancetype)initWithUTF8StringIdentifier:(const char*)identifier |
| 32 name:(NSString*)name; | 34 name:(NSString*)name; |
| 33 - (instancetype)initWithIdentifier:(NSUUID*)identifier | 35 - (instancetype)initWithIdentifier:(NSUUID*)identifier |
| 34 name:(NSString*)name NS_DESIGNATED_INITIALIZER; | 36 name:(NSString*)name NS_DESIGNATED_INITIALIZER; |
| 35 | 37 |
| 36 // Methods for faking events. | 38 // Methods for faking events. |
| 37 - (void)setState:(CBPeripheralState)state; | 39 - (void)setState:(CBPeripheralState)state; |
| 38 - (void)removeAllServices; | 40 - (void)removeAllServices; |
| 39 - (void)addServices:(NSArray*)services; | 41 - (void)addServices:(NSArray*)services; |
| 40 - (void)didDiscoverServicesWithError:(NSError*)error; | 42 - (void)didDiscoverServicesWithError:(NSError*)error; |
| 41 - (void)removeService:(CBService*)uuid; | 43 - (void)removeService:(CBService*)uuid; |
| 44 - (void)mockDidDiscoverEvents; |
| 42 - (void)didModifyServices:(NSArray*)invalidatedServices; | 45 - (void)didModifyServices:(NSArray*)invalidatedServices; |
| 43 - (void)mockDidDiscoverEvents; | 46 - (void)didDiscoverDescriptorsWithCharacteristic: |
| 47 (MockCBCharacteristic*)characteristic_mock; |
| 44 | 48 |
| 45 @end | 49 @end |
| 46 | 50 |
| 47 #endif // DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CBPERIPHERAL_MAC_H_ | 51 #endif // DEVICE_BLUETOOTH_MOCK_BLUETOOTH_CBPERIPHERAL_MAC_H_ |
| OLD | NEW |