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) { |