summaryrefslogtreecommitdiff
path: root/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapTest.java')
-rw-r--r--tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapTest.java59
1 files changed, 10 insertions, 49 deletions
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapTest.java
index e8fe8cd5f3e..382a2924d88 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapTest.java
@@ -49,8 +49,8 @@ public class BluetoothPbapTest extends AndroidTestCase {
private BluetoothPbap mBluetoothPbap;
private boolean mIsPbapSupported;
private boolean mIsProfileReady;
- private Condition mConditionProfileConnection;
- private ReentrantLock mProfileConnectionlock;
+ private Condition mConditionProfileIsConnected;
+ private ReentrantLock mProfileConnectedlock;
@Override
public void setUp() throws Exception {
@@ -70,8 +70,8 @@ public class BluetoothPbapTest extends AndroidTestCase {
mAdapter = manager.getAdapter();
assertTrue(BTAdapterUtils.enableAdapter(mAdapter, mContext));
- mProfileConnectionlock = new ReentrantLock();
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
+ mProfileConnectedlock = new ReentrantLock();
+ mConditionProfileIsConnected = mProfileConnectedlock.newCondition();
mIsProfileReady = false;
mBluetoothPbap = null;
@@ -97,18 +97,6 @@ public class BluetoothPbapTest extends AndroidTestCase {
mAdapter = null;
}
- public void test_closeProfileProxy() {
- if (!(mHasBluetooth && mIsPbapSupported)) return;
-
- assertTrue(waitForProfileConnect());
- assertNotNull(mBluetoothPbap);
- assertTrue(mIsProfileReady);
-
- mAdapter.closeProfileProxy(BluetoothProfile.PBAP, mBluetoothPbap);
- assertTrue(waitForProfileDisconnect());
- assertFalse(mIsProfileReady);
- }
-
public void test_getConnectedDevices() {
if (!(mHasBluetooth && mIsPbapSupported)) return;
@@ -177,11 +165,11 @@ public class BluetoothPbapTest extends AndroidTestCase {
}
private boolean waitForProfileConnect() {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
// Wait for the Adapter to be disabled
while (!mIsProfileReady) {
- if (!mConditionProfileConnection.await(
+ if (!mConditionProfileIsConnected.await(
PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
// Timeout
Log.e(TAG, "Timeout while waiting for Profile Connect");
@@ -191,55 +179,28 @@ public class BluetoothPbapTest extends AndroidTestCase {
} catch (InterruptedException e) {
Log.e(TAG, "waitForProfileConnect: interrupted");
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
return mIsProfileReady;
}
- private boolean waitForProfileDisconnect() {
- mConditionProfileConnection = mProfileConnectionlock.newCondition();
- mProfileConnectionlock.lock();
- try {
- while (mIsProfileReady) {
- if (!mConditionProfileConnection.await(
- PROXY_CONNECTION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
- // Timeout
- Log.e(TAG, "Timeout while waiting for Profile Disconnect");
- break;
- } // else spurious wakeups
- }
- } catch (InterruptedException e) {
- Log.e(TAG, "waitForProfileDisconnect: interrrupted");
- } finally {
- mProfileConnectionlock.unlock();
- }
- return !mIsProfileReady;
- }
-
private final class BluetoothPbapServiceListener implements
BluetoothProfile.ServiceListener {
@Override
public void onServiceConnected(int profile, BluetoothProfile proxy) {
- mProfileConnectionlock.lock();
+ mProfileConnectedlock.lock();
try {
mBluetoothPbap = (BluetoothPbap) proxy;
mIsProfileReady = true;
- mConditionProfileConnection.signal();
+ mConditionProfileIsConnected.signal();
} finally {
- mProfileConnectionlock.unlock();
+ mProfileConnectedlock.unlock();
}
}
@Override
public void onServiceDisconnected(int profile) {
- mProfileConnectionlock.lock();
- mIsProfileReady = false;
- try {
- mConditionProfileConnection.signal();
- } finally {
- mProfileConnectionlock.unlock();
- }
}
}
}