Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71cf33ab authored by Jacqueline Bronger's avatar Jacqueline Bronger
Browse files

Ignore select SystemUI tests on TV.

Ignores tests that fail due to the components not being present on TV.

Bug: 289884403
Test: atest BiometricNotificationDialogFactoryTest
Test: atest StackScrollAlgorithmTest
Test: atest VolumeDialogImplTest
Change-Id: I7d75af70e742a11e1d8895b714ebd9b54f3cbf3b
parent 31a00a3a
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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;
@@ -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);

@@ -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);

@@ -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);

@@ -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);

+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
@@ -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
@@ -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
@@ -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)
+23 −3
Original line number Diff line number Diff line
@@ -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,
@@ -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++) {
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;