Merge "Do nothing when choosing file transfer when in accessory mode"

This commit is contained in:
TreeHugger Robot
2020-09-30 06:54:29 +00:00
committed by Android (Google) Code Review
2 changed files with 19 additions and 1 deletions

View File

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