FileDocCategorySizeDatePackage
BluetoothTestRunner.javaAPI DocAndroid 5.1 API7813Thu Mar 12 22:22:12 GMT 2015android.bluetooth

BluetoothTestRunner

public class BluetoothTestRunner extends android.test.InstrumentationTestRunner
Instrumentation test runner for Bluetooth tests.

To run:

{@code
adb shell am instrument \
[-e enable_iterations ] \
[-e discoverable_iterations ] \
[-e scan_iterations ] \
[-e enable_pan_iterations ] \
[-e pair_iterations ] \
[-e connect_a2dp_iterations ] \
[-e connect_headset_iterations ] \
[-e connect_input_iterations ] \
[-e connect_pan_iterations ] \
[-e start_stop_sco_iterations ] \
[-e pair_address 
] \ [-e headset_address
] \ [-e a2dp_address
] \ [-e input_address
] \ [-e pan_address
] \ [-e pair_pin ] \ [-e pair_passkey ] \ -w com.android.bluetooth.tests/android.bluetooth.BluetoothTestRunner }

Fields Summary
private static final String
TAG
public static int
sEnableIterations
public static int
sDiscoverableIterations
public static int
sScanIterations
public static int
sEnablePanIterations
public static int
sPairIterations
public static int
sConnectHeadsetIterations
public static int
sConnectA2dpIterations
public static int
sConnectInputIterations
public static int
sConnectPanIterations
public static int
sStartStopScoIterations
public static String
sDeviceAddress
public static byte[]
sDevicePairPin
public static int
sDevicePairPasskey
Constructors Summary
Methods Summary
public junit.framework.TestSuitegetAllTests()


    
       
        TestSuite suite = new InstrumentationTestSuite(this);
        suite.addTestSuite(BluetoothStressTest.class);
        return suite;
    
public java.lang.ClassLoadergetLoader()

        return BluetoothTestRunner.class.getClassLoader();
    
public voidonCreate(android.os.Bundle arguments)

        String val = arguments.getString("enable_iterations");
        if (val != null) {
            try {
                sEnableIterations = Integer.parseInt(val);
            } catch (NumberFormatException e) {
                // Invalid argument, fall back to default value
            }
        }

        val = arguments.getString("discoverable_iterations");
        if (val != null) {
            try {
                sDiscoverableIterations = Integer.parseInt(val);
            } catch (NumberFormatException e) {
                // Invalid argument, fall back to default value
            }
        }

        val = arguments.getString("scan_iterations");
        if (val != null) {
            try {
                sScanIterations = Integer.parseInt(val);
            } catch (NumberFormatException e) {
                // Invalid argument, fall back to default value
            }
        }

        val = arguments.getString("enable_pan_iterations");
        if (val != null) {
            try {
                sEnablePanIterations = Integer.parseInt(val);
            } catch (NumberFormatException e) {
                // Invalid argument, fall back to default value
            }
        }

        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 {
                sConnectA2dpIterations = Integer.parseInt(val);
            } catch (NumberFormatException e) {
                // Invalid argument, fall back to default value
            }
        }

        val = arguments.getString("connect_headset_iterations");
        if (val != null) {
            try {
                sConnectHeadsetIterations = Integer.parseInt(val);
            } catch (NumberFormatException e) {
                // Invalid argument, fall back to default value
            }
        }

        val = arguments.getString("connect_input_iterations");
        if (val != null) {
            try {
                sConnectInputIterations = Integer.parseInt(val);
            } catch (NumberFormatException e) {
                // Invalid argument, fall back to default value
            }
        }

        val = arguments.getString("connect_pan_iterations");
        if (val != null) {
            try {
                sConnectPanIterations = Integer.parseInt(val);
            } catch (NumberFormatException e) {
                // Invalid argument, fall back to default value
            }
        }

        val = arguments.getString("start_stop_sco_iterations");
        if (val != null) {
            try {
                sStartStopScoIterations = Integer.parseInt(val);
            } catch (NumberFormatException e) {
                // Invalid argument, fall back to default value
            }
        }

        val = arguments.getString("device_address");
        if (val != null) {
            sDeviceAddress = val;
        }

        val = arguments.getString("device_pair_pin");
        if (val != null) {
            byte[] pin = BluetoothDevice.convertPinToBytes(val);
            if (pin != null) {
                sDevicePairPin = pin;
            }
        }

        val = arguments.getString("device_pair_passkey");
        if (val != null) {
            try {
                sDevicePairPasskey = Integer.parseInt(val);
            } catch (NumberFormatException e) {
                // Invalid argument, fall back to default value
            }
        }

        Log.i(TAG, String.format("enable_iterations=%d", sEnableIterations));
        Log.i(TAG, String.format("discoverable_iterations=%d", sDiscoverableIterations));
        Log.i(TAG, String.format("scan_iterations=%d", sScanIterations));
        Log.i(TAG, String.format("pair_iterations=%d", sPairIterations));
        Log.i(TAG, String.format("connect_a2dp_iterations=%d", sConnectA2dpIterations));
        Log.i(TAG, String.format("connect_headset_iterations=%d", sConnectHeadsetIterations));
        Log.i(TAG, String.format("connect_input_iterations=%d", sConnectInputIterations));
        Log.i(TAG, String.format("connect_pan_iterations=%d", sConnectPanIterations));
        Log.i(TAG, String.format("start_stop_sco_iterations=%d", sStartStopScoIterations));
        Log.i(TAG, String.format("device_address=%s", sDeviceAddress));
        Log.i(TAG, String.format("device_pair_pin=%s", new String(sDevicePairPin)));
        Log.i(TAG, String.format("device_pair_passkey=%d", sDevicePairPasskey));

        // Call onCreate last since we want to set the static variables first.
        super.onCreate(arguments);