Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.mm

Issue 2634873002: Bluetooth: macOS: Implement BluetoothRemoteGattCharacteristicMac::UnsubscribeFromNotifications (Closed)
Patch Set: Adding last_notify_value for macOS Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 - (void)simulateGattNotifySessionStarted { 152 - (void)simulateGattNotifySessionStarted {
153 _notifying = YES; 153 _notifying = YES;
154 CBPeripheral* peripheral = _service.peripheral; 154 CBPeripheral* peripheral = _service.peripheral;
155 [peripheral.delegate peripheral:peripheral 155 [peripheral.delegate peripheral:peripheral
156 didUpdateNotificationStateForCharacteristic:self.characteristic 156 didUpdateNotificationStateForCharacteristic:self.characteristic
157 error:nil]; 157 error:nil];
158 } 158 }
159 159
160 - (void)simulateGattNotifySessionFailedWithError:(NSError*)error { 160 - (void)simulateGattNotifySessionFailedWithError:(NSError*)error {
161 _notifying = NO;
161 CBPeripheral* peripheral = _service.peripheral; 162 CBPeripheral* peripheral = _service.peripheral;
162 [peripheral.delegate peripheral:peripheral 163 [peripheral.delegate peripheral:peripheral
163 didUpdateNotificationStateForCharacteristic:self.characteristic 164 didUpdateNotificationStateForCharacteristic:self.characteristic
165 error:error];
166 }
167
168 - (void)simulateGattNotifySessionStopped {
169 _notifying = NO;
170 CBPeripheral* peripheral = _service.peripheral;
171 [peripheral.delegate peripheral:peripheral
172 didUpdateNotificationStateForCharacteristic:self.characteristic
173 error:nil];
174 }
175
176 - (void)simulateGattNotifySessionStoppedWithError:(NSError*)error {
177 _notifying = NO;
178 CBPeripheral* peripheral = _service.peripheral;
179 [peripheral.delegate peripheral:peripheral
180 didUpdateNotificationStateForCharacteristic:self.characteristic
164 error:error]; 181 error:error];
165 } 182 }
166 183
167 - (void)simulateGattCharacteristicChangedWithValue:(NSData*)value { 184 - (void)simulateGattCharacteristicChangedWithValue:(NSData*)value {
168 _value.reset([value copy]); 185 _value.reset([value copy]);
169 CBPeripheral* peripheral = _service.peripheral; 186 CBPeripheral* peripheral = _service.peripheral;
170 [peripheral.delegate peripheral:peripheral 187 [peripheral.delegate peripheral:peripheral
171 didUpdateValueForCharacteristic:self.characteristic 188 didUpdateValueForCharacteristic:self.characteristic
172 error:nil]; 189 error:nil];
173 } 190 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 222
206 - (NSData*)value { 223 - (NSData*)value {
207 return _value.get(); 224 return _value.get();
208 } 225 }
209 226
210 - (BOOL)isNotifying { 227 - (BOOL)isNotifying {
211 return _notifying; 228 return _notifying;
212 } 229 }
213 230
214 @end 231 @end
OLDNEW
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h ('k') | device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698