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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 BluetoothRemoteGattCharacteristic* characteristic) {} | 180 BluetoothRemoteGattCharacteristic* characteristic) {} |
181 | 181 |
182 // Simulates a Characteristic Set Notify error. | 182 // Simulates a Characteristic Set Notify error. |
183 // If |characteristic| is null, acts upon the characteristic & CCC | 183 // If |characteristic| is null, acts upon the characteristic & CCC |
184 // descriptor provided to RememberCharacteristicForSubsequentAction & | 184 // descriptor provided to RememberCharacteristicForSubsequentAction & |
185 // RememberCCCDescriptorForSubsequentAction. | 185 // RememberCCCDescriptorForSubsequentAction. |
186 virtual void SimulateGattNotifySessionStartError( | 186 virtual void SimulateGattNotifySessionStartError( |
187 BluetoothRemoteGattCharacteristic* characteristic, | 187 BluetoothRemoteGattCharacteristic* characteristic, |
188 BluetoothRemoteGattService::GattErrorCode error_code) {} | 188 BluetoothRemoteGattService::GattErrorCode error_code) {} |
189 | 189 |
| 190 // Simulates a Characteristic Stop Notify completed. |
| 191 // If |characteristic| is null, acts upon the characteristic & CCC |
| 192 // descriptor provided to RememberCharacteristicForSubsequentAction & |
| 193 // RememberCCCDescriptorForSubsequentAction. |
| 194 virtual void SimulateGattNotifySessionStopped( |
| 195 BluetoothRemoteGattCharacteristic* characteristic) {} |
| 196 |
| 197 // Simulates a Characteristic Stop Notify error. |
| 198 // If |characteristic| is null, acts upon the characteristic & CCC |
| 199 // descriptor provided to RememberCharacteristicForSubsequentAction & |
| 200 // RememberCCCDescriptorForSubsequentAction. |
| 201 virtual void SimulateGattNotifySessionStopError( |
| 202 BluetoothRemoteGattCharacteristic* characteristic, |
| 203 BluetoothRemoteGattService::GattErrorCode error_code) {} |
| 204 |
190 // Simulates a Characteristic Set Notify operation failing synchronously once | 205 // Simulates a Characteristic Set Notify operation failing synchronously once |
191 // for an unknown reason. | 206 // for an unknown reason. |
192 virtual void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( | 207 virtual void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( |
193 BluetoothRemoteGattCharacteristic* characteristic) {} | 208 BluetoothRemoteGattCharacteristic* characteristic) {} |
194 | 209 |
195 // Simulates a Characteristic Changed operation with updated |value|. | 210 // Simulates a Characteristic Changed operation with updated |value|. |
196 virtual void SimulateGattCharacteristicChanged( | 211 virtual void SimulateGattCharacteristicChanged( |
197 BluetoothRemoteGattCharacteristic* characteristic, | 212 BluetoothRemoteGattCharacteristic* characteristic, |
198 const std::vector<uint8_t>& value) {} | 213 const std::vector<uint8_t>& value) {} |
199 | 214 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 virtual void DeleteDevice(BluetoothDevice* device); | 346 virtual void DeleteDevice(BluetoothDevice* device); |
332 | 347 |
333 // Callbacks that increment |callback_count_|, |error_callback_count_|: | 348 // Callbacks that increment |callback_count_|, |error_callback_count_|: |
334 void Callback(Call expected); | 349 void Callback(Call expected); |
335 void DiscoverySessionCallback(Call expected, | 350 void DiscoverySessionCallback(Call expected, |
336 std::unique_ptr<BluetoothDiscoverySession>); | 351 std::unique_ptr<BluetoothDiscoverySession>); |
337 void GattConnectionCallback(Call expected, | 352 void GattConnectionCallback(Call expected, |
338 std::unique_ptr<BluetoothGattConnection>); | 353 std::unique_ptr<BluetoothGattConnection>); |
339 void NotifyCallback(Call expected, | 354 void NotifyCallback(Call expected, |
340 std::unique_ptr<BluetoothGattNotifySession>); | 355 std::unique_ptr<BluetoothGattNotifySession>); |
| 356 void NotifyCheckForPrecedingCalls( |
| 357 int num_of_preceding_calls, |
| 358 std::unique_ptr<BluetoothGattNotifySession>); |
| 359 void StopNotifyCallback(Call expected); |
| 360 void StopNotifyCheckForPrecedingCalls(int num_of_preceding_calls); |
341 void ReadValueCallback(Call expected, const std::vector<uint8_t>& value); | 361 void ReadValueCallback(Call expected, const std::vector<uint8_t>& value); |
342 void ErrorCallback(Call expected); | 362 void ErrorCallback(Call expected); |
343 void ConnectErrorCallback(Call expected, | 363 void ConnectErrorCallback(Call expected, |
344 enum BluetoothDevice::ConnectErrorCode); | 364 enum BluetoothDevice::ConnectErrorCode); |
345 void GattErrorCallback(Call expected, | 365 void GattErrorCallback(Call expected, |
346 BluetoothRemoteGattService::GattErrorCode); | 366 BluetoothRemoteGattService::GattErrorCode); |
347 void ReentrantStartNotifySessionSuccessCallback( | 367 void ReentrantStartNotifySessionSuccessCallback( |
348 Call expected, | 368 Call expected, |
349 BluetoothRemoteGattCharacteristic* characteristic, | 369 BluetoothRemoteGattCharacteristic* characteristic, |
350 std::unique_ptr<BluetoothGattNotifySession> notify_session); | 370 std::unique_ptr<BluetoothGattNotifySession> notify_session); |
351 void ReentrantStartNotifySessionErrorCallback( | 371 void ReentrantStartNotifySessionErrorCallback( |
352 Call expected, | 372 Call expected, |
353 BluetoothRemoteGattCharacteristic* characteristic, | 373 BluetoothRemoteGattCharacteristic* characteristic, |
354 bool error_in_reentrant, | 374 bool error_in_reentrant, |
355 BluetoothGattService::GattErrorCode error_code); | 375 BluetoothGattService::GattErrorCode error_code); |
356 | 376 |
357 // Accessors to get callbacks bound to this fixture: | 377 // Accessors to get callbacks bound to this fixture: |
358 base::Closure GetCallback(Call expected); | 378 base::Closure GetCallback(Call expected); |
359 BluetoothAdapter::DiscoverySessionCallback GetDiscoverySessionCallback( | 379 BluetoothAdapter::DiscoverySessionCallback GetDiscoverySessionCallback( |
360 Call expected); | 380 Call expected); |
361 BluetoothDevice::GattConnectionCallback GetGattConnectionCallback( | 381 BluetoothDevice::GattConnectionCallback GetGattConnectionCallback( |
362 Call expected); | 382 Call expected); |
363 BluetoothRemoteGattCharacteristic::NotifySessionCallback GetNotifyCallback( | 383 BluetoothRemoteGattCharacteristic::NotifySessionCallback GetNotifyCallback( |
364 Call expected); | 384 Call expected); |
| 385 BluetoothRemoteGattCharacteristic::NotifySessionCallback |
| 386 GetNotifyCheckForPrecedingCalls(int num_of_preceding_calls); |
| 387 base::Closure GetStopNotifyCallback(Call expected); |
| 388 base::Closure GetStopNotifyCheckForPrecedingCalls(int num_of_preceding_calls); |
365 BluetoothRemoteGattCharacteristic::ValueCallback GetReadValueCallback( | 389 BluetoothRemoteGattCharacteristic::ValueCallback GetReadValueCallback( |
366 Call expected); | 390 Call expected); |
367 BluetoothAdapter::ErrorCallback GetErrorCallback(Call expected); | 391 BluetoothAdapter::ErrorCallback GetErrorCallback(Call expected); |
368 BluetoothDevice::ConnectErrorCallback GetConnectErrorCallback(Call expected); | 392 BluetoothDevice::ConnectErrorCallback GetConnectErrorCallback(Call expected); |
369 base::Callback<void(BluetoothRemoteGattService::GattErrorCode)> | 393 base::Callback<void(BluetoothRemoteGattService::GattErrorCode)> |
370 GetGattErrorCallback(Call expected); | 394 GetGattErrorCallback(Call expected); |
371 BluetoothRemoteGattCharacteristic::NotifySessionCallback | 395 BluetoothRemoteGattCharacteristic::NotifySessionCallback |
372 GetReentrantStartNotifySessionSuccessCallback( | 396 GetReentrantStartNotifySessionSuccessCallback( |
373 Call expected, | 397 Call expected, |
374 BluetoothRemoteGattCharacteristic* characteristic); | 398 BluetoothRemoteGattCharacteristic* characteristic); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 int actual_error_callback_calls_ = 0; | 440 int actual_error_callback_calls_ = 0; |
417 bool unexpected_success_callback_ = false; | 441 bool unexpected_success_callback_ = false; |
418 bool unexpected_error_callback_ = false; | 442 bool unexpected_error_callback_ = false; |
419 | 443 |
420 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 444 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
421 }; | 445 }; |
422 | 446 |
423 } // namespace device | 447 } // namespace device |
424 | 448 |
425 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 449 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
OLD | NEW |