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

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

Issue 1618273002: Call BluetoothGatt#close() after disconnecting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call parent class' TearDown Created 4 years, 11 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_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/test/bluetooth_test_android.cc
diff --git a/device/bluetooth/test/bluetooth_test_android.cc b/device/bluetooth/test/bluetooth_test_android.cc
index e23a83549ac28d2335792c175c007c43fbcdcb19..b31f5df1f0fcabbf4b78daa1b28bbd510a6a31c7 100644
--- a/device/bluetooth/test/bluetooth_test_android.cc
+++ b/device/bluetooth/test/bluetooth_test_android.cc
@@ -36,6 +36,15 @@ void BluetoothTestAndroid::SetUp() {
ASSERT_TRUE(RegisterNativesImpl(AttachCurrentThread()));
}
+void BluetoothTestAndroid::TearDown() {
+ BluetoothAdapter::DeviceList devices = adapter_->GetDevices();
+ for (auto& device : devices) {
+ DeleteDevice(device);
+ }
+ EXPECT_EQ(0, gatt_open_connections_);
+ BluetoothTestBase::TearDown();
+}
+
bool BluetoothTestAndroid::PlatformSupportsLowEnergy() {
return true;
}
@@ -289,6 +298,7 @@ void BluetoothTestAndroid::SimulateGattDescriptorWriteWillFailSynchronouslyOnce(
void BluetoothTestAndroid::OnFakeBluetoothDeviceConnectGattCalled(
JNIEnv* env,
const JavaParamRef<jobject>& caller) {
+ gatt_open_connections_++;
gatt_connection_attempts_++;
}
@@ -298,6 +308,15 @@ void BluetoothTestAndroid::OnFakeBluetoothGattDisconnect(
gatt_disconnection_attempts_++;
}
+void BluetoothTestAndroid::OnFakeBluetoothGattClose(
+ JNIEnv* env,
+ const JavaParamRef<jobject>& caller) {
+ gatt_open_connections_--;
+
+ // close implies disconnect
+ gatt_disconnection_attempts_++;
+}
+
void BluetoothTestAndroid::OnFakeBluetoothGattDiscoverServices(
JNIEnv* env,
const JavaParamRef<jobject>& caller) {
« no previous file with comments | « device/bluetooth/test/bluetooth_test_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698