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

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

Issue 2051333004: Implement BluetoothGattNotifySession::Stop on Android, 2nd attempt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address new review comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/test/bluetooth_test.h ('k') | device/bluetooth/test/bluetooth_test_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « device/bluetooth/test/bluetooth_test.h ('k') | device/bluetooth/test/bluetooth_test_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698