Chromium Code Reviews| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 // RememberCCCDescriptorForSubsequentAction. | 163 // RememberCCCDescriptorForSubsequentAction. |
| 164 virtual void SimulateGattNotifySessionStartError( | 164 virtual void SimulateGattNotifySessionStartError( |
| 165 BluetoothRemoteGattCharacteristic* characteristic, | 165 BluetoothRemoteGattCharacteristic* characteristic, |
| 166 BluetoothRemoteGattService::GattErrorCode error_code) {} | 166 BluetoothRemoteGattService::GattErrorCode error_code) {} |
| 167 | 167 |
| 168 // Simulates a Characteristic Set Notify operation failing synchronously once | 168 // Simulates a Characteristic Set Notify operation failing synchronously once |
| 169 // for an unknown reason. | 169 // for an unknown reason. |
| 170 virtual void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( | 170 virtual void SimulateGattCharacteristicSetNotifyWillFailSynchronouslyOnce( |
| 171 BluetoothRemoteGattCharacteristic* characteristic) {} | 171 BluetoothRemoteGattCharacteristic* characteristic) {} |
| 172 | 172 |
| 173 // Simulates a Characteristic Set Notify operation failing asynchronously once | |
| 174 // for an unknown reason. | |
| 175 virtual void SimulateGattCharacteristicSetNotifyWillFailAsynchronouslyOnce( | |
|
ortuno
2016/04/22 16:23:39
I think you can just reuse: SimulateGattNotifySess
gogerald1
2016/04/27 20:15:32
Done.
| |
| 176 BluetoothRemoteGattCharacteristic* characteristic) {} | |
| 177 | |
| 173 // Simulates a Characteristic Changed operation with updated |value|. | 178 // Simulates a Characteristic Changed operation with updated |value|. |
| 174 virtual void SimulateGattCharacteristicChanged( | 179 virtual void SimulateGattCharacteristicChanged( |
| 175 BluetoothRemoteGattCharacteristic* characteristic, | 180 BluetoothRemoteGattCharacteristic* characteristic, |
| 176 const std::vector<uint8_t>& value) {} | 181 const std::vector<uint8_t>& value) {} |
| 177 | 182 |
| 178 // Simulates a Characteristic Read operation succeeding, returning |value|. | 183 // Simulates a Characteristic Read operation succeeding, returning |value|. |
| 179 // If |characteristic| is null, acts upon the characteristic provided to | 184 // If |characteristic| is null, acts upon the characteristic provided to |
| 180 // RememberCharacteristicForSubsequentAction. | 185 // RememberCharacteristicForSubsequentAction. |
| 181 virtual void SimulateGattCharacteristicRead( | 186 virtual void SimulateGattCharacteristicRead( |
| 182 BluetoothRemoteGattCharacteristic* characteristic, | 187 BluetoothRemoteGattCharacteristic* characteristic, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 void GattConnectionCallback(Call expected, | 269 void GattConnectionCallback(Call expected, |
| 265 std::unique_ptr<BluetoothGattConnection>); | 270 std::unique_ptr<BluetoothGattConnection>); |
| 266 void NotifyCallback(Call expected, | 271 void NotifyCallback(Call expected, |
| 267 std::unique_ptr<BluetoothGattNotifySession>); | 272 std::unique_ptr<BluetoothGattNotifySession>); |
| 268 void ReadValueCallback(Call expected, const std::vector<uint8_t>& value); | 273 void ReadValueCallback(Call expected, const std::vector<uint8_t>& value); |
| 269 void ErrorCallback(Call expected); | 274 void ErrorCallback(Call expected); |
| 270 void ConnectErrorCallback(Call expected, | 275 void ConnectErrorCallback(Call expected, |
| 271 enum BluetoothDevice::ConnectErrorCode); | 276 enum BluetoothDevice::ConnectErrorCode); |
| 272 void GattErrorCallback(Call expected, | 277 void GattErrorCallback(Call expected, |
| 273 BluetoothRemoteGattService::GattErrorCode); | 278 BluetoothRemoteGattService::GattErrorCode); |
| 279 void ReentrantStartNotifySessionSuccessCallback( | |
| 280 Call expected, | |
| 281 BluetoothRemoteGattCharacteristic* characteristic, | |
| 282 std::unique_ptr<BluetoothGattNotifySession> notify_session); | |
| 283 void ReentrantStartNotifySessionErrorCallback( | |
| 284 Call expected, | |
| 285 BluetoothRemoteGattCharacteristic* characteristic, | |
| 286 bool error_in_reentrant, | |
| 287 BluetoothGattService::GattErrorCode error_code); | |
| 274 | 288 |
| 275 // Accessors to get callbacks bound to this fixture: | 289 // Accessors to get callbacks bound to this fixture: |
| 276 base::Closure GetCallback(Call expected); | 290 base::Closure GetCallback(Call expected); |
| 277 BluetoothAdapter::DiscoverySessionCallback GetDiscoverySessionCallback( | 291 BluetoothAdapter::DiscoverySessionCallback GetDiscoverySessionCallback( |
| 278 Call expected); | 292 Call expected); |
| 279 BluetoothDevice::GattConnectionCallback GetGattConnectionCallback( | 293 BluetoothDevice::GattConnectionCallback GetGattConnectionCallback( |
| 280 Call expected); | 294 Call expected); |
| 281 BluetoothRemoteGattCharacteristic::NotifySessionCallback GetNotifyCallback( | 295 BluetoothRemoteGattCharacteristic::NotifySessionCallback GetNotifyCallback( |
| 282 Call expected); | 296 Call expected); |
| 283 BluetoothRemoteGattCharacteristic::ValueCallback GetReadValueCallback( | 297 BluetoothRemoteGattCharacteristic::ValueCallback GetReadValueCallback( |
| 284 Call expected); | 298 Call expected); |
| 285 BluetoothAdapter::ErrorCallback GetErrorCallback(Call expected); | 299 BluetoothAdapter::ErrorCallback GetErrorCallback(Call expected); |
| 286 BluetoothDevice::ConnectErrorCallback GetConnectErrorCallback(Call expected); | 300 BluetoothDevice::ConnectErrorCallback GetConnectErrorCallback(Call expected); |
| 287 base::Callback<void(BluetoothRemoteGattService::GattErrorCode)> | 301 base::Callback<void(BluetoothRemoteGattService::GattErrorCode)> |
| 288 GetGattErrorCallback(Call expected); | 302 GetGattErrorCallback(Call expected); |
| 303 BluetoothRemoteGattCharacteristic::NotifySessionCallback | |
| 304 GetReentrantStartNotifySessionSuccessCallback( | |
| 305 Call expected, | |
| 306 BluetoothRemoteGattCharacteristic* characteristic); | |
| 307 base::Callback<void(BluetoothGattService::GattErrorCode)> | |
| 308 GetReentrantStartNotifySessionErrorCallback( | |
| 309 Call expected, | |
| 310 BluetoothRemoteGattCharacteristic* characteristic, | |
| 311 bool error_in_reentrant); | |
| 289 | 312 |
| 290 // Reset all event count members to 0. | 313 // Reset all event count members to 0. |
| 291 void ResetEventCounts(); | 314 void ResetEventCounts(); |
| 292 | 315 |
| 293 // A Message loop is required by some implementations that will PostTasks and | 316 // A Message loop is required by some implementations that will PostTasks and |
| 294 // by base::RunLoop().RunUntilIdle() use in this fixture. | 317 // by base::RunLoop().RunUntilIdle() use in this fixture. |
| 295 base::MessageLoop message_loop_; | 318 base::MessageLoop message_loop_; |
| 296 | 319 |
| 297 scoped_refptr<BluetoothAdapter> adapter_; | 320 scoped_refptr<BluetoothAdapter> adapter_; |
| 298 ScopedVector<BluetoothDiscoverySession> discovery_sessions_; | 321 ScopedVector<BluetoothDiscoverySession> discovery_sessions_; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 323 int actual_error_callback_calls_ = 0; | 346 int actual_error_callback_calls_ = 0; |
| 324 bool unexpected_success_callback_ = false; | 347 bool unexpected_success_callback_ = false; |
| 325 bool unexpected_error_callback_ = false; | 348 bool unexpected_error_callback_ = false; |
| 326 | 349 |
| 327 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; | 350 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; |
| 328 }; | 351 }; |
| 329 | 352 |
| 330 } // namespace device | 353 } // namespace device |
| 331 | 354 |
| 332 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ | 355 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ |
| OLD | NEW |