Merge "Guard against null input device in StylusDeviceUpdater" into udc-dev am: e78b1f377e
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/22894945 Change-Id: I01556c0442565babb72c2f879f109ee8e12ba277 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -26,6 +26,7 @@ import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -108,6 +109,15 @@ public class StylusDeviceUpdaterTest {
|
||||
any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onInputDeviceAdded_null_doesNothing() {
|
||||
doReturn(null).when(mInputManager).getInputDevice(0);
|
||||
mStylusDeviceUpdater.onInputDeviceAdded(0);
|
||||
|
||||
verify(mInputManager).getInputDevice(0);
|
||||
verifyNoMoreInteractions(mInputManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onInputDeviceAdded_internalStylus_registersBatteryListener() {
|
||||
mStylusDeviceUpdater.onInputDeviceAdded(1);
|
||||
@@ -124,6 +134,15 @@ public class StylusDeviceUpdaterTest {
|
||||
any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onInputDeviceChanged_null_doesNothing() {
|
||||
doReturn(null).when(mInputManager).getInputDevice(0);
|
||||
mStylusDeviceUpdater.onInputDeviceChanged(0);
|
||||
|
||||
verify(mInputManager).getInputDevice(0);
|
||||
verifyNoMoreInteractions(mInputManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void click_usiPreference_launchUsiDetailsPage() {
|
||||
doReturn(mSettingsActivity).when(mDashboardFragment).getContext();
|
||||
|
||||
Reference in New Issue
Block a user