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

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 Giovanni's review comments Created 4 years, 5 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 faeb71f0e3e0dcb412d6232710477dfa38bb8190..ee36dbac05a9adf2d96d322219796acc7a6f29fb 100644
--- a/device/bluetooth/test/bluetooth_test.cc
+++ b/device/bluetooth/test/bluetooth_test.cc
@@ -141,6 +141,25 @@ void BluetoothTestBase::NotifyCallback(
unexpected_success_callback_ = true;
}
+void BluetoothTestBase::StopNotifyCallback(
+ Call expected,
+ BluetoothGattNotifySession* notify_session) {
+ ++callback_count_;
+ for (ScopedVector<BluetoothGattNotifySession>::iterator i =
ortuno 2016/08/02 01:56:34 If you do this then you never get a chance to test
tommyt 2016/08/05 12:22:30 I have removed this and adjusted the unittests.
+ notify_sessions_.begin();
+ i != notify_sessions_.end(); ++i) {
+ if (*i == notify_session) {
+ notify_sessions_.erase(i);
+ break;
+ }
+ }
+
+ if (expected == Call::EXPECTED)
+ ++actual_success_callback_calls_;
+ else
+ unexpected_success_callback_ = true;
+}
+
void BluetoothTestBase::ReadValueCallback(Call expected,
const std::vector<uint8_t>& value) {
++callback_count_;
@@ -257,6 +276,15 @@ BluetoothTestBase::GetNotifyCallback(Call expected) {
weak_factory_.GetWeakPtr(), expected);
}
+base::Closure BluetoothTestBase::GetStopNotifyCallback(
+ Call expected,
+ BluetoothGattNotifySession* notify_session) {
+ if (expected == Call::EXPECTED)
+ ++expected_success_callback_calls_;
+ return base::Bind(&BluetoothTestBase::StopNotifyCallback,
+ weak_factory_.GetWeakPtr(), expected, notify_session);
+}
+
BluetoothRemoteGattCharacteristic::ValueCallback
BluetoothTestBase::GetReadValueCallback(Call expected) {
if (expected == Call::EXPECTED)

Powered by Google App Engine
This is Rietveld 408576698