OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h" | 5 #include "device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #include "device/bluetooth/bluetooth_gatt_characteristic.h" | 9 #include "device/bluetooth/bluetooth_gatt_characteristic.h" |
10 #include "device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.h" | 10 #include "device/bluetooth/test/mock_bluetooth_cbdescriptor_mac.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 | 183 |
184 - (void)simulateGattCharacteristicChangedWithValue:(NSData*)value { | 184 - (void)simulateGattCharacteristicChangedWithValue:(NSData*)value { |
185 _value.reset([value copy]); | 185 _value.reset([value copy]); |
186 CBPeripheral* peripheral = _service.peripheral; | 186 CBPeripheral* peripheral = _service.peripheral; |
187 [peripheral.delegate peripheral:peripheral | 187 [peripheral.delegate peripheral:peripheral |
188 didUpdateValueForCharacteristic:self.characteristic | 188 didUpdateValueForCharacteristic:self.characteristic |
189 error:nil]; | 189 error:nil]; |
190 } | 190 } |
191 | 191 |
192 - (void)simulateDescriptorWithUUID:(CBUUID*)uuid { | 192 - (void)addDescriptorWithUUID:(CBUUID*)uuid { |
193 scoped_nsobject<MockCBDescriptor> descriptor_mock([[MockCBDescriptor alloc] | 193 scoped_nsobject<MockCBDescriptor> descriptor_mock([[MockCBDescriptor alloc] |
194 initWithCharacteristic:self.characteristic | 194 initWithCharacteristic:self.characteristic |
195 CBUUID:uuid]); | 195 CBUUID:uuid]); |
196 [_simulatedDescriptors.get() addObject:descriptor_mock]; | 196 [_simulatedDescriptors.get() addObject:descriptor_mock]; |
197 } | 197 } |
198 | 198 |
199 - (void)discoverDescriptors { | 199 - (void)discoverDescriptors { |
200 _descriptors.reset([_simulatedDescriptors copy]); | 200 _descriptors.reset([_simulatedDescriptors copy]); |
201 } | 201 } |
202 | 202 |
(...skipping 19 matching lines...) Expand all Loading... |
222 | 222 |
223 - (NSData*)value { | 223 - (NSData*)value { |
224 return _value.get(); | 224 return _value.get(); |
225 } | 225 } |
226 | 226 |
227 - (BOOL)isNotifying { | 227 - (BOOL)isNotifying { |
228 return _notifying; | 228 return _notifying; |
229 } | 229 } |
230 | 230 |
231 @end | 231 @end |
OLD | NEW |