Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/BiometricNotificationDialogFactoryTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.biometrics; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assume.assumeTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.never; Loading @@ -28,6 +29,7 @@ import static org.mockito.Mockito.when; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.hardware.biometrics.BiometricSourceType; import android.hardware.face.FaceManager; import android.hardware.fingerprint.FingerprintManager; Loading Loading @@ -86,6 +88,9 @@ public class BiometricNotificationDialogFactoryTest extends SysuiTestCase { @Test public void testFingerprintReEnrollDialog_onRemovalSucceeded() { assumeTrue(getContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)); mDialogFactory.createReenrollDialog(mContextSpy, mDialog, BiometricSourceType.FINGERPRINT); Loading @@ -109,6 +114,9 @@ public class BiometricNotificationDialogFactoryTest extends SysuiTestCase { @Test public void testFingerprintReEnrollDialog_onRemovalError() { assumeTrue(getContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)); mDialogFactory.createReenrollDialog(mContextSpy, mDialog, BiometricSourceType.FINGERPRINT); Loading @@ -130,6 +138,9 @@ public class BiometricNotificationDialogFactoryTest extends SysuiTestCase { @Test public void testFaceReEnrollDialog_onRemovalSucceeded() { assumeTrue(getContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_FACE)); mDialogFactory.createReenrollDialog(mContextSpy, mDialog, BiometricSourceType.FACE); Loading @@ -153,6 +164,9 @@ public class BiometricNotificationDialogFactoryTest extends SysuiTestCase { @Test public void testFaceReEnrollDialog_onRemovalError() { assumeTrue(getContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_FACE)); mDialogFactory.createReenrollDialog(mContextSpy, mDialog, BiometricSourceType.FACE); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +8 −0 Original line number Diff line number Diff line package com.android.systemui.statusbar.notification.stack import android.annotation.DimenRes import android.content.pm.PackageManager import android.widget.FrameLayout import androidx.test.filters.SmallTest import com.android.keyguard.BouncerPanelExpansionCalculator.aboutToShowBouncerProgress Loading @@ -21,6 +22,7 @@ import com.google.common.truth.Truth.assertThat import junit.framework.Assert.assertEquals import junit.framework.Assert.assertFalse import junit.framework.Assert.assertTrue import org.junit.Assume import org.junit.Before import org.junit.Rule import org.junit.Test Loading Loading @@ -66,6 +68,8 @@ class StackScrollAlgorithmTest : SysuiTestCase() { @Before fun setUp() { Assume.assumeFalse(isTv()) whenever(notificationShelf.viewState).thenReturn(ExpandableViewState()) whenever(notificationRow.viewState).thenReturn(ExpandableViewState()) ambientState.isSmallScreen = true Loading @@ -73,6 +77,10 @@ class StackScrollAlgorithmTest : SysuiTestCase() { hostView.addView(notificationRow) } private fun isTv(): Boolean { return context.packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK) } @Test fun resetViewStates_defaultHun_yTranslationIsInset() { whenever(notificationRow.isPinned).thenReturn(true) Loading packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java +23 −3 Original line number Diff line number Diff line Loading @@ -177,9 +177,13 @@ public class VolumeDialogImplTest extends SysuiTestCase { mActiveRinger = mDialog.getDialogView().findViewById( R.id.volume_new_ringer_active_icon_container); mDrawerContainer = mDialog.getDialogView().findViewById(R.id.volume_drawer_container); // Drawer is not always available, e.g. on TVs if (mDrawerContainer != null) { mDrawerVibrate = mDrawerContainer.findViewById(R.id.volume_drawer_vibrate); mDrawerMute = mDrawerContainer.findViewById(R.id.volume_drawer_mute); mDrawerNormal = mDrawerContainer.findViewById(R.id.volume_drawer_normal); } mODICaptionsIcon = mDialog.getDialogView().findViewById(R.id.odi_captions_icon); Prefs.putInt(mContext, Loading @@ -189,6 +193,10 @@ public class VolumeDialogImplTest extends SysuiTestCase { Prefs.putBoolean(mContext, Prefs.Key.HAS_SEEN_ODI_CAPTIONS_TOOLTIP, false); } private void assumeHasDrawer() { assumeNotNull("Layout does not contain drawer", mDrawerContainer); } private State createShellState() { State state = new VolumeDialogController.State(); for (int i = AudioManager.STREAM_VOICE_CALL; i <= AudioManager.STREAM_ACCESSIBILITY; i++) { Loading Loading @@ -360,6 +368,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { @Test public void testSelectVibrateFromDrawer() { assumeHasDrawer(); mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false); final State initialUnsetState = new State(); initialUnsetState.ringerModeInternal = AudioManager.RINGER_MODE_NORMAL; Loading @@ -375,6 +385,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { @Test public void testSelectVibrateFromDrawer_OnewayAPI_On() { assumeHasDrawer(); mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, true); final State initialUnsetState = new State(); initialUnsetState.ringerModeInternal = RINGER_MODE_NORMAL; Loading @@ -390,6 +402,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { @Test public void testSelectMuteFromDrawer() { assumeHasDrawer(); mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false); final State initialUnsetState = new State(); initialUnsetState.ringerModeInternal = AudioManager.RINGER_MODE_NORMAL; Loading @@ -405,6 +419,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { @Test public void testSelectMuteFromDrawer_OnewayAPI_On() { assumeHasDrawer(); mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, true); final State initialUnsetState = new State(); initialUnsetState.ringerModeInternal = RINGER_MODE_NORMAL; Loading @@ -420,6 +436,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { @Test public void testSelectNormalFromDrawer() { assumeHasDrawer(); mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false); final State initialUnsetState = new State(); initialUnsetState.ringerModeInternal = AudioManager.RINGER_MODE_VIBRATE; Loading @@ -435,6 +453,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { @Test public void testSelectNormalFromDrawer_OnewayAPI_On() { assumeHasDrawer(); mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, true); final State initialUnsetState = new State(); initialUnsetState.ringerModeInternal = AudioManager.RINGER_MODE_VIBRATE; Loading Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/BiometricNotificationDialogFactoryTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.biometrics; import static com.google.common.truth.Truth.assertThat; import static org.junit.Assume.assumeTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.never; Loading @@ -28,6 +29,7 @@ import static org.mockito.Mockito.when; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.hardware.biometrics.BiometricSourceType; import android.hardware.face.FaceManager; import android.hardware.fingerprint.FingerprintManager; Loading Loading @@ -86,6 +88,9 @@ public class BiometricNotificationDialogFactoryTest extends SysuiTestCase { @Test public void testFingerprintReEnrollDialog_onRemovalSucceeded() { assumeTrue(getContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)); mDialogFactory.createReenrollDialog(mContextSpy, mDialog, BiometricSourceType.FINGERPRINT); Loading @@ -109,6 +114,9 @@ public class BiometricNotificationDialogFactoryTest extends SysuiTestCase { @Test public void testFingerprintReEnrollDialog_onRemovalError() { assumeTrue(getContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)); mDialogFactory.createReenrollDialog(mContextSpy, mDialog, BiometricSourceType.FINGERPRINT); Loading @@ -130,6 +138,9 @@ public class BiometricNotificationDialogFactoryTest extends SysuiTestCase { @Test public void testFaceReEnrollDialog_onRemovalSucceeded() { assumeTrue(getContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_FACE)); mDialogFactory.createReenrollDialog(mContextSpy, mDialog, BiometricSourceType.FACE); Loading @@ -153,6 +164,9 @@ public class BiometricNotificationDialogFactoryTest extends SysuiTestCase { @Test public void testFaceReEnrollDialog_onRemovalError() { assumeTrue(getContext().getPackageManager() .hasSystemFeature(PackageManager.FEATURE_FACE)); mDialogFactory.createReenrollDialog(mContextSpy, mDialog, BiometricSourceType.FACE); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +8 −0 Original line number Diff line number Diff line package com.android.systemui.statusbar.notification.stack import android.annotation.DimenRes import android.content.pm.PackageManager import android.widget.FrameLayout import androidx.test.filters.SmallTest import com.android.keyguard.BouncerPanelExpansionCalculator.aboutToShowBouncerProgress Loading @@ -21,6 +22,7 @@ import com.google.common.truth.Truth.assertThat import junit.framework.Assert.assertEquals import junit.framework.Assert.assertFalse import junit.framework.Assert.assertTrue import org.junit.Assume import org.junit.Before import org.junit.Rule import org.junit.Test Loading Loading @@ -66,6 +68,8 @@ class StackScrollAlgorithmTest : SysuiTestCase() { @Before fun setUp() { Assume.assumeFalse(isTv()) whenever(notificationShelf.viewState).thenReturn(ExpandableViewState()) whenever(notificationRow.viewState).thenReturn(ExpandableViewState()) ambientState.isSmallScreen = true Loading @@ -73,6 +77,10 @@ class StackScrollAlgorithmTest : SysuiTestCase() { hostView.addView(notificationRow) } private fun isTv(): Boolean { return context.packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK) } @Test fun resetViewStates_defaultHun_yTranslationIsInset() { whenever(notificationRow.isPinned).thenReturn(true) Loading
packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java +23 −3 Original line number Diff line number Diff line Loading @@ -177,9 +177,13 @@ public class VolumeDialogImplTest extends SysuiTestCase { mActiveRinger = mDialog.getDialogView().findViewById( R.id.volume_new_ringer_active_icon_container); mDrawerContainer = mDialog.getDialogView().findViewById(R.id.volume_drawer_container); // Drawer is not always available, e.g. on TVs if (mDrawerContainer != null) { mDrawerVibrate = mDrawerContainer.findViewById(R.id.volume_drawer_vibrate); mDrawerMute = mDrawerContainer.findViewById(R.id.volume_drawer_mute); mDrawerNormal = mDrawerContainer.findViewById(R.id.volume_drawer_normal); } mODICaptionsIcon = mDialog.getDialogView().findViewById(R.id.odi_captions_icon); Prefs.putInt(mContext, Loading @@ -189,6 +193,10 @@ public class VolumeDialogImplTest extends SysuiTestCase { Prefs.putBoolean(mContext, Prefs.Key.HAS_SEEN_ODI_CAPTIONS_TOOLTIP, false); } private void assumeHasDrawer() { assumeNotNull("Layout does not contain drawer", mDrawerContainer); } private State createShellState() { State state = new VolumeDialogController.State(); for (int i = AudioManager.STREAM_VOICE_CALL; i <= AudioManager.STREAM_ACCESSIBILITY; i++) { Loading Loading @@ -360,6 +368,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { @Test public void testSelectVibrateFromDrawer() { assumeHasDrawer(); mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false); final State initialUnsetState = new State(); initialUnsetState.ringerModeInternal = AudioManager.RINGER_MODE_NORMAL; Loading @@ -375,6 +385,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { @Test public void testSelectVibrateFromDrawer_OnewayAPI_On() { assumeHasDrawer(); mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, true); final State initialUnsetState = new State(); initialUnsetState.ringerModeInternal = RINGER_MODE_NORMAL; Loading @@ -390,6 +402,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { @Test public void testSelectMuteFromDrawer() { assumeHasDrawer(); mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false); final State initialUnsetState = new State(); initialUnsetState.ringerModeInternal = AudioManager.RINGER_MODE_NORMAL; Loading @@ -405,6 +419,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { @Test public void testSelectMuteFromDrawer_OnewayAPI_On() { assumeHasDrawer(); mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, true); final State initialUnsetState = new State(); initialUnsetState.ringerModeInternal = RINGER_MODE_NORMAL; Loading @@ -420,6 +436,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { @Test public void testSelectNormalFromDrawer() { assumeHasDrawer(); mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false); final State initialUnsetState = new State(); initialUnsetState.ringerModeInternal = AudioManager.RINGER_MODE_VIBRATE; Loading @@ -435,6 +453,8 @@ public class VolumeDialogImplTest extends SysuiTestCase { @Test public void testSelectNormalFromDrawer_OnewayAPI_On() { assumeHasDrawer(); mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, true); final State initialUnsetState = new State(); initialUnsetState.ringerModeInternal = AudioManager.RINGER_MODE_VIBRATE; Loading