Loading core/tests/coretests/src/android/bluetooth/BluetoothStressTest.java +13 −6 Original line number Diff line number Diff line Loading @@ -80,12 +80,17 @@ public class BluetoothStressTest extends InstrumentationTestCase { } public void testPair() { int iterations = BluetoothTestRunner.sPairIterations; BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sHeadsetAddress); BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sPairAddress); mTestUtils.enable(adapter); mTestUtils.pair(adapter, device); for (int i = 0; i < iterations; i++) { mTestUtils.writeOutput("pair iteration " + (i + 1) + " of " + iterations); mTestUtils.pair(adapter, device, BluetoothTestRunner.sPairPasskey, BluetoothTestRunner.sPairPin); mTestUtils.unpair(adapter, device); } mTestUtils.disable(adapter); } Loading @@ -95,7 +100,8 @@ public class BluetoothStressTest extends InstrumentationTestCase { BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sA2dpAddress); mTestUtils.enable(adapter); mTestUtils.pair(adapter, device); mTestUtils.pair(adapter, device, BluetoothTestRunner.sPairPasskey, BluetoothTestRunner.sPairPin); for (int i = 0; i < iterations; i++) { mTestUtils.writeOutput("connectA2dp iteration " + (i + 1) + " of " + iterations); Loading @@ -113,7 +119,8 @@ public class BluetoothStressTest extends InstrumentationTestCase { BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sHeadsetAddress); mTestUtils.enable(adapter); mTestUtils.pair(adapter, device); mTestUtils.pair(adapter, device, BluetoothTestRunner.sPairPasskey, BluetoothTestRunner.sPairPin); for (int i = 0; i < iterations; i++) { mTestUtils.writeOutput("connectHeadset iteration " + (i + 1) + " of " + iterations); Loading core/tests/coretests/src/android/bluetooth/BluetoothTestRunner.java +33 −0 Original line number Diff line number Diff line Loading @@ -26,12 +26,17 @@ public class BluetoothTestRunner extends InstrumentationTestRunner { public static int sEnableIterations = 100; public static int sDiscoverableIterations = 1000; public static int sScanIterations = 1000; public static int sPairIterations = 100; public static int sConnectHeadsetIterations = 100; public static int sConnectA2dpIterations = 100; public static String sPairAddress = ""; public static String sHeadsetAddress = ""; public static String sA2dpAddress = ""; public static byte[] sPairPin = {'1', '2', '3', '4'}; public static int sPairPasskey = 123456; @Override public TestSuite getAllTests() { TestSuite suite = new InstrumentationTestSuite(this); Loading Loading @@ -75,6 +80,15 @@ public class BluetoothTestRunner extends InstrumentationTestRunner { } } val = arguments.getString("pair_iterations"); if (val != null) { try { sPairIterations = Integer.parseInt(val); } catch (NumberFormatException e) { // Invalid argument, fall back to default value } } val = arguments.getString("connect_a2dp_iterations"); if (val != null) { try { Loading @@ -93,6 +107,11 @@ public class BluetoothTestRunner extends InstrumentationTestRunner { } } val = arguments.getString("pair_address"); if (val != null) { sPairAddress = val; } val = arguments.getString("headset_address"); if (val != null) { sHeadsetAddress = val; Loading @@ -102,5 +121,19 @@ public class BluetoothTestRunner extends InstrumentationTestRunner { if (val != null) { sA2dpAddress = val; } val = arguments.getString("pair_pin"); if (val != null) { sPairPin = BluetoothDevice.convertPinToBytes(val); } val = arguments.getString("pair_passkey"); if (val != null) { try { sPairPasskey = Integer.parseInt(val); } catch (NumberFormatException e) { // Invalid argument, fall back to default value } } } } core/tests/coretests/src/android/bluetooth/BluetoothTestUtils.java +246 −151 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
core/tests/coretests/src/android/bluetooth/BluetoothStressTest.java +13 −6 Original line number Diff line number Diff line Loading @@ -80,12 +80,17 @@ public class BluetoothStressTest extends InstrumentationTestCase { } public void testPair() { int iterations = BluetoothTestRunner.sPairIterations; BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sHeadsetAddress); BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sPairAddress); mTestUtils.enable(adapter); mTestUtils.pair(adapter, device); for (int i = 0; i < iterations; i++) { mTestUtils.writeOutput("pair iteration " + (i + 1) + " of " + iterations); mTestUtils.pair(adapter, device, BluetoothTestRunner.sPairPasskey, BluetoothTestRunner.sPairPin); mTestUtils.unpair(adapter, device); } mTestUtils.disable(adapter); } Loading @@ -95,7 +100,8 @@ public class BluetoothStressTest extends InstrumentationTestCase { BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sA2dpAddress); mTestUtils.enable(adapter); mTestUtils.pair(adapter, device); mTestUtils.pair(adapter, device, BluetoothTestRunner.sPairPasskey, BluetoothTestRunner.sPairPin); for (int i = 0; i < iterations; i++) { mTestUtils.writeOutput("connectA2dp iteration " + (i + 1) + " of " + iterations); Loading @@ -113,7 +119,8 @@ public class BluetoothStressTest extends InstrumentationTestCase { BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sHeadsetAddress); mTestUtils.enable(adapter); mTestUtils.pair(adapter, device); mTestUtils.pair(adapter, device, BluetoothTestRunner.sPairPasskey, BluetoothTestRunner.sPairPin); for (int i = 0; i < iterations; i++) { mTestUtils.writeOutput("connectHeadset iteration " + (i + 1) + " of " + iterations); Loading
core/tests/coretests/src/android/bluetooth/BluetoothTestRunner.java +33 −0 Original line number Diff line number Diff line Loading @@ -26,12 +26,17 @@ public class BluetoothTestRunner extends InstrumentationTestRunner { public static int sEnableIterations = 100; public static int sDiscoverableIterations = 1000; public static int sScanIterations = 1000; public static int sPairIterations = 100; public static int sConnectHeadsetIterations = 100; public static int sConnectA2dpIterations = 100; public static String sPairAddress = ""; public static String sHeadsetAddress = ""; public static String sA2dpAddress = ""; public static byte[] sPairPin = {'1', '2', '3', '4'}; public static int sPairPasskey = 123456; @Override public TestSuite getAllTests() { TestSuite suite = new InstrumentationTestSuite(this); Loading Loading @@ -75,6 +80,15 @@ public class BluetoothTestRunner extends InstrumentationTestRunner { } } val = arguments.getString("pair_iterations"); if (val != null) { try { sPairIterations = Integer.parseInt(val); } catch (NumberFormatException e) { // Invalid argument, fall back to default value } } val = arguments.getString("connect_a2dp_iterations"); if (val != null) { try { Loading @@ -93,6 +107,11 @@ public class BluetoothTestRunner extends InstrumentationTestRunner { } } val = arguments.getString("pair_address"); if (val != null) { sPairAddress = val; } val = arguments.getString("headset_address"); if (val != null) { sHeadsetAddress = val; Loading @@ -102,5 +121,19 @@ public class BluetoothTestRunner extends InstrumentationTestRunner { if (val != null) { sA2dpAddress = val; } val = arguments.getString("pair_pin"); if (val != null) { sPairPin = BluetoothDevice.convertPinToBytes(val); } val = arguments.getString("pair_passkey"); if (val != null) { try { sPairPasskey = Integer.parseInt(val); } catch (NumberFormatException e) { // Invalid argument, fall back to default value } } } }
core/tests/coretests/src/android/bluetooth/BluetoothTestUtils.java +246 −151 File changed.Preview size limit exceeded, changes collapsed. Show changes