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_TEST_BLUETOOTH_TEST_H_ | 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 BluetoothRemoteGattCharacteristic* characteristic) {} | 170 BluetoothRemoteGattCharacteristic* characteristic) {} |
171 | 171 |
172 // Simulates a Characteristic Set Notify error. | 172 // Simulates a Characteristic Set Notify error. |
173 // If |characteristic| is null, acts upon the characteristic & CCC | 173 // If |characteristic| is null, acts upon the characteristic & CCC |
174 // descriptor provided to RememberCharacteristicForSubsequentAction & | 174 // descriptor provided to RememberCharacteristicForSubsequentAction & |
175 // RememberCCCDescriptorForSubsequentAction. | 175 // RememberCCCDescriptorForSubsequentAction. |
176 virtual void SimulateGattNotifySessionStartError( | 176 virtual void SimulateGattNotifySessionStartError( |
177 BluetoothRemoteGattCharacteristic* characteristic, | 177 BluetoothRemoteGattCharacteristic* characteristic, |
178 BluetoothRemoteGattService::GattErrorCode error_code) {} | 178 BluetoothRemoteGattService::GattErrorCode error_code) {} |
179 | 179 |
| 180 // Simulates a Characteristic Stop Notify completed. |
| 181 // If |characteristic| is null, acts upon the characteristic & CCC |
| 182 // descriptor provided to RememberCharacteristicForSubsequentAction & |
| 183 // RememberCCCDescriptorForSubsequentAction. |
| 184 virtual void SimulateGattNotifySessionStopped( |
| 185 BluetoothRemoteGattCharacteristic* characteristic) {} |
| 186 |
| 187 // Simulates a Characteristic Stop Notify error. |
| 188 // If |characteristic| is null, acts upon the characteristic & CCC |
| 189 // descriptor provided to RememberCharacteristicForSubsequentAction & |
| 190 // RememberCCCDescriptorForSubsequentAction. |
| 191 virtual void SimulateGattNotifySessionStopError( |
| 192 BluetoothRemoteGattCharacteristic* characteristic, |
| 193 BluetoothRemoteGattService::GattErrorCode error_code) {} |
| 194 |
180 // Simulates a Characteristic Set Notify operation failing synchronously once | 195 // Simulates a Characteristic Set Notify operation failing synchronously once |
181 // for an unknown reason. | 196 // for an unknown reason. |
182 virtual void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( | 197 virtual void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( |
183 BluetoothRemoteGattCharacteristic* characteristic) {} | 198 BluetoothRemoteGattCharacteristic* characteristic) {} |
184 | 199 |
185 // Simulates a Characteristic Changed operation with updated |value|. | 200 // Simulates a Characteristic Changed operation with updated |value|. |
186 virtual void SimulateGattCharacteristicChanged( | 201 virtual void SimulateGattCharacteristicChanged( |
187 BluetoothRemoteGattCharacteristic* characteristic, | 202 BluetoothRemoteGattCharacteristic* characteristic, |
188 const std::vector<uint8_t>& value) {} | 203 const std::vector<uint8_t>& value) {} |
189 | 204 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 virtual void DeleteDevice(BluetoothDevice* device); | 336 virtual void DeleteDevice(BluetoothDevice* device); |
322 | 337 |
323 // Callbacks that increment |callback_count_|, |error_callback_count_|: | 338 // Callbacks that increment |callback_count_|, |error_callback_count_|: |
324 void Callback(Call expected); | 339 void Callback(Call expected); |
325 void DiscoverySessionCallback(Call expected, | 340 void DiscoverySessionCallback(Call expected, |
326 std::unique_ptr<BluetoothDiscoverySession>); | 341 std::unique_ptr<BluetoothDiscoverySession>); |
327 void GattConnectionCallback(Call expected, | 342 void GattConnectionCallback(Call expected, |
328 std::unique_ptr<BluetoothGattConnection>); | 343 std::unique_ptr<BluetoothGattConnection>); |
329 void NotifyCallback(Call expected, | 344 void NotifyCallback(Call expected, |
330 std::unique_ptr<BluetoothGattNotifySession>); | 345 std::unique_ptr<BluetoothGattNotifySession>); |
| 346 void StopNotifyCallback(Call expected, |
| 347 BluetoothGattNotifySession* notify_session); |
331 void ReadValueCallback(Call expected, const std::vector<uint8_t>& value); | 348 void ReadValueCallback(Call expected, const std::vector<uint8_t>& value); |
332 void ErrorCallback(Call expected); | 349 void ErrorCallback(Call expected); |
333 void ConnectErrorCallback(Call expected, | 350 void ConnectErrorCallback(Call expected, |
334 enum BluetoothDevice::ConnectErrorCode); | 351 enum BluetoothDevice::ConnectErrorCode); |
335 void GattErrorCallback(Call expected, | 352 void GattErrorCallback(Call expected, |
336 BluetoothRemoteGattService::GattErrorCode); | 353 BluetoothRemoteGattService::GattErrorCode); |
337 void ReentrantStartNotifySessionSuccessCallback( | 354 void ReentrantStartNotifySessionSuccessCallback( |
338 Call expected, | 355 Call expected, |
339 BluetoothRemoteGattCharacteristic* characteristic, | 356 BluetoothRemoteGattCharacteristic* characteristic, |
340 std::unique_ptr<BluetoothGattNotifySession> notify_session); | 357 std::unique_ptr<BluetoothGattNotifySession> notify_session); |
341 void ReentrantStartNotifySessionErrorCallback( | 358 void ReentrantStartNotifySessionErrorCallback( |
342 Call expected, | 359 Call expected, |
343 BluetoothRemoteGattCharacteristic* characteristic, | 360 BluetoothRemoteGattCharacteristic* characteristic, |
344 bool error_in_reentrant, | 361 bool error_in_reentrant, |
345 BluetoothGattService::GattErrorCode error_code); | 362 BluetoothGattService::GattErrorCode error_code); |
346 | 363 |
347 // Accessors to get callbacks bound to this fixture: | 364 // Accessors to get callbacks bound to this fixture: |
348 base::Closure GetCallback(Call expected); | 365 base::Closure GetCallback(Call expected); |
349 BluetoothAdapter::DiscoverySessionCallback GetDiscoverySessionCallback( | 366 BluetoothAdapter::DiscoverySessionCallback GetDiscoverySessionCallback( |
350 Call expected); | 367 Call expected); |
351 BluetoothDevice::GattConnectionCallback GetGattConnectionCallback( | 368 BluetoothDevice::GattConnectionCallback GetGattConnectionCallback( |
352 Call expected); | 369 Call expected); |
353 BluetoothRemoteGattCharacteristic::NotifySessionCallback GetNotifyCallback( | 370 BluetoothRemoteGattCharacteristic::NotifySessionCallback GetNotifyCallback( |
354 Call expected); | 371 Call expected); |
| 372 base::Closure GetStopNotifyCallback( |
| 373 Call expected, |
| 374 BluetoothGattNotifySession* notify_session); |
355 BluetoothRemoteGattCharacteristic::ValueCallback GetReadValueCallback( | 375 BluetoothRemoteGattCharacteristic::ValueCallback GetReadValueCallback( |
356 Call expected); | 376 Call expected); |
357 BluetoothAdapter::ErrorCallback GetErrorCallback(Call expected); | 377 BluetoothAdapter::ErrorCallback GetErrorCallback(Call expected); |
358 BluetoothDevice::ConnectErrorCallback GetConnectErrorCallback(Call expected); | 378 BluetoothDevice::ConnectErrorCallback GetConnectErrorCallback(Call expected); |
359 base::Callback<void(BluetoothRemoteGattService::GattErrorCode)> | 379 base::Callback<void(BluetoothRemoteGattService::GattErrorCode)> |
360 GetGattErrorCallback(Call expected); | 380 GetGattErrorCallback(Call expected); |
361 BluetoothRemoteGattCharacteristic::NotifySessionCallback | 381 BluetoothRemoteGattCharacteristic::NotifySessionCallback |
362 GetReentrantStartNotifySessionSuccessCallback( | 382 GetReentrantStartNotifySessionSuccessCallback( |
363 Call expected, | 383 Call expected, |
364 BluetoothRemoteGattCharacteristic* characteristic); | 384 BluetoothRemoteGattCharacteristic* characteristic); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 int actual_error_callback_calls_ = 0; | 426 int actual_error_callback_calls_ = 0; |
407 bool unexpected_success_callback_ = false; | 427 bool unexpected_success_callback_ = false; |
408 bool unexpected_error_callback_ = false; | 428 bool unexpected_error_callback_ = false; |
409 | 429 |
410 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 430 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
411 }; | 431 }; |
412 | 432 |
413 } // namespace device | 433 } // namespace device |
414 | 434 |
415 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 435 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
OLD | NEW |