Index: device/bluetooth/test/bluetooth_test.cc |
diff --git a/device/bluetooth/test/bluetooth_test.cc b/device/bluetooth/test/bluetooth_test.cc |
index faeb71f0e3e0dcb412d6232710477dfa38bb8190..408dc82851b37ffa6896e5638a8d65c895356f25 100644 |
--- a/device/bluetooth/test/bluetooth_test.cc |
+++ b/device/bluetooth/test/bluetooth_test.cc |
@@ -132,15 +132,43 @@ void BluetoothTestBase::GattConnectionCallback( |
void BluetoothTestBase::NotifyCallback( |
Call expected, |
std::unique_ptr<BluetoothGattNotifySession> notify_session) { |
+ notify_sessions_.push_back(notify_session.release()); |
+ |
++callback_count_; |
+ if (expected == Call::EXPECTED) |
+ ++actual_success_callback_calls_; |
+ else |
+ unexpected_success_callback_ = true; |
+} |
+ |
+void BluetoothTestBase::NotifyCheckForPrecedingCalls( |
+ int num_of_preceding_calls, |
+ std::unique_ptr<BluetoothGattNotifySession> notify_session) { |
+ EXPECT_EQ(num_of_preceding_calls, callback_count_); |
+ |
notify_sessions_.push_back(notify_session.release()); |
+ ++callback_count_; |
+ ++actual_success_callback_calls_; |
+} |
+ |
+void BluetoothTestBase::StopNotifyCallback(Call expected) { |
+ ++callback_count_; |
+ |
if (expected == Call::EXPECTED) |
++actual_success_callback_calls_; |
else |
unexpected_success_callback_ = true; |
} |
+void BluetoothTestBase::StopNotifyCheckForPrecedingCalls( |
+ int num_of_preceding_calls) { |
+ EXPECT_EQ(num_of_preceding_calls, callback_count_); |
+ |
+ ++callback_count_; |
+ ++actual_success_callback_calls_; |
+} |
+ |
void BluetoothTestBase::ReadValueCallback(Call expected, |
const std::vector<uint8_t>& value) { |
++callback_count_; |
@@ -257,6 +285,27 @@ BluetoothTestBase::GetNotifyCallback(Call expected) { |
weak_factory_.GetWeakPtr(), expected); |
} |
+BluetoothRemoteGattCharacteristic::NotifySessionCallback |
+BluetoothTestBase::GetNotifyCheckForPrecedingCalls(int num_of_preceding_calls) { |
+ ++expected_success_callback_calls_; |
+ return base::Bind(&BluetoothTestBase::NotifyCheckForPrecedingCalls, |
+ weak_factory_.GetWeakPtr(), num_of_preceding_calls); |
+} |
+ |
+base::Closure BluetoothTestBase::GetStopNotifyCallback(Call expected) { |
+ if (expected == Call::EXPECTED) |
+ ++expected_success_callback_calls_; |
+ return base::Bind(&BluetoothTestBase::StopNotifyCallback, |
+ weak_factory_.GetWeakPtr(), expected); |
+} |
+ |
+base::Closure BluetoothTestBase::GetStopNotifyCheckForPrecedingCalls( |
+ int num_of_preceding_calls) { |
+ ++expected_success_callback_calls_; |
+ return base::Bind(&BluetoothTestBase::StopNotifyCheckForPrecedingCalls, |
+ weak_factory_.GetWeakPtr(), num_of_preceding_calls); |
+} |
+ |
BluetoothRemoteGattCharacteristic::ValueCallback |
BluetoothTestBase::GetReadValueCallback(Call expected) { |
if (expected == Call::EXPECTED) |