Merge "Add condition to check case of accessory combinations"

This commit is contained in:
TreeHugger Robot
2020-11-10 07:54:26 +00:00
committed by Android (Google) Code Review
2 changed files with 32 additions and 3 deletions

View File

@@ -275,6 +275,18 @@ public class UsbDetailsFunctionsControllerTest {
UsbManager.FUNCTION_ACCESSORY);
}
@Test
public void onRadioButtonClicked_functionMtp_inAccessoryCombinationsMode_doNothing() {
final long function = UsbManager.FUNCTION_ACCESSORY | UsbManager.FUNCTION_AUDIO_SOURCE;
mRadioButtonPreference.setKey(UsbBackend.usbFunctionsToString(UsbManager.FUNCTION_MTP));
doReturn(UsbManager.FUNCTION_ACCESSORY).when(mUsbBackend).getCurrentFunctions();
mDetailsFunctionsController.mPreviousFunction = function;
mDetailsFunctionsController.onRadioButtonClicked(mRadioButtonPreference);
assertThat(mDetailsFunctionsController.mPreviousFunction).isEqualTo(function);
}
@Test
public void onRadioButtonClicked_clickSameButton_doNothing() {
mRadioButtonPreference.setKey(UsbBackend.usbFunctionsToString(UsbManager.FUNCTION_PTP));