diff options
| author | 2011-11-28 14:26:39 -0800 | |
|---|---|---|
| committer | 2011-11-28 14:26:39 -0800 | |
| commit | 70a1ee38b24a7c8dfc789db024bdf54f277ddba3 (patch) | |
| tree | 4b18dabce8eda414c01a0ea9ddacaeb8c88ac3ae | |
| parent | be1b5ce498a68e28d47a167495f47787d6461e88 (diff) | |
| parent | 500afb87a7a8b5928ef1a5196bdfd0bcc2b87e4a (diff) | |
am 500afb87: Merge "Fix SCO start stop tests." into ics-mr1
* commit '500afb87a7a8b5928ef1a5196bdfd0bcc2b87e4a':
Fix SCO start stop tests.
3 files changed, 14 insertions, 1 deletions
diff --git a/core/tests/bluetoothtests/AndroidManifest.xml b/core/tests/bluetoothtests/AndroidManifest.xml index 58f158ce410f..60b6dc18f0c4 100644 --- a/core/tests/bluetoothtests/AndroidManifest.xml +++ b/core/tests/bluetoothtests/AndroidManifest.xml @@ -19,6 +19,8 @@ <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> + <uses-permission android:name="android.permission.BROADCAST_STICKY" /> + <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_SETTINGS" /> <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> diff --git a/core/tests/bluetoothtests/src/android/bluetooth/BluetoothStressTest.java b/core/tests/bluetoothtests/src/android/bluetooth/BluetoothStressTest.java index abd7d9af224a..755e7c4504c8 100644 --- a/core/tests/bluetoothtests/src/android/bluetooth/BluetoothStressTest.java +++ b/core/tests/bluetoothtests/src/android/bluetooth/BluetoothStressTest.java @@ -32,6 +32,8 @@ import android.test.InstrumentationTestCase; public class BluetoothStressTest extends InstrumentationTestCase { private static final String TAG = "BluetoothStressTest"; private static final String OUTPUT_FILE = "BluetoothStressTestOutput.txt"; + /** The amount of time to sleep between issuing start/stop SCO in ms. */ + private static final long SCO_SLEEP_TIME = 2 * 1000; private BluetoothTestUtils mTestUtils; @@ -380,11 +382,20 @@ public class BluetoothStressTest extends InstrumentationTestCase { for (int i = 0; i < iterations; i++) { mTestUtils.writeOutput("startStopSco iteration " + (i + 1) + " of " + iterations); mTestUtils.startSco(adapter, device); + sleep(SCO_SLEEP_TIME); mTestUtils.stopSco(adapter, device); + sleep(SCO_SLEEP_TIME); } mTestUtils.disconnectProfile(adapter, device, BluetoothProfile.HEADSET, null); mTestUtils.unpair(adapter, device); mTestUtils.disable(adapter); } + + private void sleep(long time) { + try { + Thread.sleep(time); + } catch (InterruptedException e) { + } + } } diff --git a/core/tests/bluetoothtests/src/android/bluetooth/BluetoothTestUtils.java b/core/tests/bluetoothtests/src/android/bluetooth/BluetoothTestUtils.java index 42e5cd17f2a7..4858be8c2a8e 100644 --- a/core/tests/bluetoothtests/src/android/bluetooth/BluetoothTestUtils.java +++ b/core/tests/bluetoothtests/src/android/bluetooth/BluetoothTestUtils.java @@ -1425,7 +1425,7 @@ public class BluetoothTestUtils extends Assert { } private StartStopScoReceiver getStartStopScoReceiver(int expectedFlags) { - String[] actions = {AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED}; + String[] actions = {AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED}; StartStopScoReceiver receiver = new StartStopScoReceiver(expectedFlags); addReceiver(receiver, actions); return receiver; |