Loading android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientStateMachineTest.java +28 −18 Original line number Diff line number Diff line Loading @@ -339,17 +339,21 @@ public class BassClientStateMachineTest { // Make bluetoothGatt non-null so state will transit mBassClientStateMachine.mBluetoothGatt = Mockito.mock( BassClientStateMachine.BluetoothGattTestableWrapper.class); mBassClientStateMachine.mBroadcastScanControlPoint = new BluetoothGattCharacteristic( mBassClientStateMachine.mBroadcastScanControlPoint = new BluetoothGattCharacteristic( BassConstants.BASS_BCAST_AUDIO_SCAN_CTRL_POINT, BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ); BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE | BluetoothGattCharacteristic.PROPERTY_WRITE, BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED); sendMessageAndVerifyTransition( mBassClientStateMachine.obtainMessage( READ_BASS_CHARACTERISTICS, new BluetoothGattCharacteristic(UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ)), new BluetoothGattCharacteristic( UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY, BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED)), BassClientStateMachine.ConnectedProcessing.class); sendMessageAndVerifyTransition( mBassClientStateMachine.obtainMessage(GATT_TXN_PROCESSED), Loading @@ -360,9 +364,11 @@ public class BassClientStateMachineTest { sendMessageAndVerifyTransition( mBassClientStateMachine.obtainMessage( READ_BASS_CHARACTERISTICS, new BluetoothGattCharacteristic(UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ)), new BluetoothGattCharacteristic( UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY, BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED)), BassClientStateMachine.ConnectedProcessing.class); sendMessageAndVerifyTransition( mBassClientStateMachine.obtainMessage(GATT_TXN_TIMEOUT), Loading Loading @@ -398,16 +404,20 @@ public class BassClientStateMachineTest { when(btGatt.getService(BassConstants.BASS_UUID)).thenReturn(gattService); List<BluetoothGattCharacteristic> characteristics = new ArrayList<>(); BluetoothGattCharacteristic scanControlPoint = new BluetoothGattCharacteristic( BluetoothGattCharacteristic scanControlPoint = new BluetoothGattCharacteristic( BassConstants.BASS_BCAST_AUDIO_SCAN_CTRL_POINT, BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ); BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE | BluetoothGattCharacteristic.PROPERTY_WRITE, BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED); characteristics.add(scanControlPoint); BluetoothGattCharacteristic bassCharacteristic = new BluetoothGattCharacteristic( BluetoothGattCharacteristic bassCharacteristic = new BluetoothGattCharacteristic( UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ); BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY, BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED); characteristics.add(bassCharacteristic); when(gattService.getCharacteristics()).thenReturn(characteristics); Loading Loading
android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientStateMachineTest.java +28 −18 Original line number Diff line number Diff line Loading @@ -339,17 +339,21 @@ public class BassClientStateMachineTest { // Make bluetoothGatt non-null so state will transit mBassClientStateMachine.mBluetoothGatt = Mockito.mock( BassClientStateMachine.BluetoothGattTestableWrapper.class); mBassClientStateMachine.mBroadcastScanControlPoint = new BluetoothGattCharacteristic( mBassClientStateMachine.mBroadcastScanControlPoint = new BluetoothGattCharacteristic( BassConstants.BASS_BCAST_AUDIO_SCAN_CTRL_POINT, BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ); BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE | BluetoothGattCharacteristic.PROPERTY_WRITE, BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED); sendMessageAndVerifyTransition( mBassClientStateMachine.obtainMessage( READ_BASS_CHARACTERISTICS, new BluetoothGattCharacteristic(UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ)), new BluetoothGattCharacteristic( UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY, BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED)), BassClientStateMachine.ConnectedProcessing.class); sendMessageAndVerifyTransition( mBassClientStateMachine.obtainMessage(GATT_TXN_PROCESSED), Loading @@ -360,9 +364,11 @@ public class BassClientStateMachineTest { sendMessageAndVerifyTransition( mBassClientStateMachine.obtainMessage( READ_BASS_CHARACTERISTICS, new BluetoothGattCharacteristic(UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ)), new BluetoothGattCharacteristic( UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY, BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED)), BassClientStateMachine.ConnectedProcessing.class); sendMessageAndVerifyTransition( mBassClientStateMachine.obtainMessage(GATT_TXN_TIMEOUT), Loading Loading @@ -398,16 +404,20 @@ public class BassClientStateMachineTest { when(btGatt.getService(BassConstants.BASS_UUID)).thenReturn(gattService); List<BluetoothGattCharacteristic> characteristics = new ArrayList<>(); BluetoothGattCharacteristic scanControlPoint = new BluetoothGattCharacteristic( BluetoothGattCharacteristic scanControlPoint = new BluetoothGattCharacteristic( BassConstants.BASS_BCAST_AUDIO_SCAN_CTRL_POINT, BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ); BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE | BluetoothGattCharacteristic.PROPERTY_WRITE, BluetoothGattCharacteristic.PERMISSION_WRITE_ENCRYPTED); characteristics.add(scanControlPoint); BluetoothGattCharacteristic bassCharacteristic = new BluetoothGattCharacteristic( BluetoothGattCharacteristic bassCharacteristic = new BluetoothGattCharacteristic( UUID.randomUUID(), BluetoothGattCharacteristic.PROPERTY_READ, BluetoothGattCharacteristic.PERMISSION_READ); BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY, BluetoothGattCharacteristic.PERMISSION_READ_ENCRYPTED); characteristics.add(bassCharacteristic); when(gattService.getCharacteristics()).thenReturn(characteristics); Loading