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

Side by Side Diff: device/bluetooth/test/bluetooth_test.h

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

Powered by Google App Engine
This is Rietveld 408576698