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

Unified Diff: device/bluetooth/test/bluetooth_test.cc

Issue 1804093003: Add BluetoothGattCharacteristicTest::StartNotifySession_Reentrant unit test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/test/bluetooth_test.cc
diff --git a/device/bluetooth/test/bluetooth_test.cc b/device/bluetooth/test/bluetooth_test.cc
index 77ecddcd6521aaecd14262cea07eae5759311a14..dcfd43e3403381d905c64079ee83e6323f2c15f9 100644
--- a/device/bluetooth/test/bluetooth_test.cc
+++ b/device/bluetooth/test/bluetooth_test.cc
@@ -158,6 +158,22 @@ void BluetoothTestBase::GattErrorCallback(
unexpected_error_callback_ = true;
}
+void BluetoothTestBase::ReentrantStartNotifySessionErrorCallback(
+ Call expected,
+ BluetoothGattCharacteristic* characteristic,
+ BluetoothGattService::GattErrorCode error_code) {
+ ++error_callback_count_;
+ last_gatt_error_code_ = error_code;
+
+ if (expected == Call::EXPECTED)
+ ++actual_error_callback_calls_;
+ else
+ unexpected_error_callback_ = true;
+
+ characteristic->StartNotifySession(GetNotifyCallback(Call::EXPECTED),
+ GetGattErrorCallback(Call::NOT_EXPECTED));
+}
+
base::Closure BluetoothTestBase::GetCallback(Call expected) {
if (expected == Call::EXPECTED)
++expected_success_callback_calls_;
@@ -221,6 +237,17 @@ BluetoothTestBase::GetGattErrorCallback(Call expected) {
weak_factory_.GetWeakPtr(), expected);
}
+base::Callback<void(BluetoothGattService::GattErrorCode)>
+BluetoothTestBase::GetReentrantStartNotifySessionErrorCallback(
+ Call expected,
+ BluetoothGattCharacteristic* characteristic) {
+ if (expected == Call::EXPECTED)
+ ++expected_error_callback_calls_;
+ return base::Bind(
+ &BluetoothTestBase::ReentrantStartNotifySessionErrorCallback,
+ weak_factory_.GetWeakPtr(), expected, characteristic);
+}
+
void BluetoothTestBase::ResetEventCounts() {
last_connect_error_code_ = BluetoothDevice::ERROR_UNKNOWN;
callback_count_ = 0;

Powered by Google App Engine
This is Rietveld 408576698