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

Commit 52756ccb authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Add test annotations for footer redesign

Flag: com.android.systemui.notifications_redesign_footer_view
Bug: 375010573
Bug: 376237971
Test: run these tests with the flag flipped on
Change-Id: Ia5635172eb84562d77521d6e6d8a48cf3df49218
parent 5e3b033c
Loading
Loading
Loading
Loading
+23 −14
Original line number Diff line number Diff line
@@ -45,23 +45,25 @@ import androidx.test.filters.SmallTest;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.res.R;
import com.android.systemui.statusbar.notification.footer.shared.FooterViewRefactor;
import com.android.systemui.statusbar.notification.footer.shared.NotifRedesignFooter;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.List;

import platform.test.runner.parameterized.ParameterizedAndroidJunit4;
import platform.test.runner.parameterized.Parameters;

import java.util.List;

@SmallTest
@RunWith(ParameterizedAndroidJunit4.class)
public class FooterViewTest extends SysuiTestCase {

    @Parameters(name = "{0}")
    public static List<FlagsParameterization> getFlags() {
        return FlagsParameterization.allCombinationsOf(FooterViewRefactor.FLAG_NAME);
        return FlagsParameterization.progressionOf(FooterViewRefactor.FLAG_NAME,
                NotifRedesignFooter.FLAG_NAME);
    }

    public FooterViewTest(FlagsParameterization flags) {
@@ -74,8 +76,13 @@ public class FooterViewTest extends SysuiTestCase {

    @Before
    public void setUp() {
        if (NotifRedesignFooter.isEnabled()) {
            mView = (FooterView) LayoutInflater.from(mSpyContext).inflate(
                    R.layout.status_bar_notification_footer_redesign, null, false);
        } else {
            mView = (FooterView) LayoutInflater.from(mSpyContext).inflate(
                    R.layout.status_bar_notification_footer, null, false);
        }
        mView.setAnimationDuration(0);
    }

@@ -92,13 +99,14 @@ public class FooterViewTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(NotifRedesignFooter.FLAG_NAME)
    public void setManageOnClick() {
        mView.setManageButtonClickListener(mock(View.OnClickListener.class));
        assertTrue(mView.findViewById(R.id.manage_text).hasOnClickListeners());
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void setHistoryShown() {
        mView.showHistory(true);
        assertTrue(mView.isHistoryShown());
@@ -107,7 +115,7 @@ public class FooterViewTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void setHistoryNotShown() {
        mView.showHistory(false);
        assertFalse(mView.isHistoryShown());
@@ -133,6 +141,7 @@ public class FooterViewTest extends SysuiTestCase {

    @Test
    @EnableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags(NotifRedesignFooter.FLAG_NAME)
    public void testSetManageOrHistoryButtonText_resourceOnlyFetchedOnce() {
        int resId = R.string.manage_notifications_history_text;
        mView.setManageOrHistoryButtonText(resId);
@@ -151,7 +160,7 @@ public class FooterViewTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testSetManageOrHistoryButtonText_expectsFlagEnabled() {
        clearInvocations(mSpyContext);
        int resId = R.string.manage_notifications_history_text;
@@ -161,6 +170,7 @@ public class FooterViewTest extends SysuiTestCase {

    @Test
    @EnableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags(NotifRedesignFooter.FLAG_NAME)
    public void testSetManageOrHistoryButtonDescription_resourceOnlyFetchedOnce() {
        int resId = R.string.manage_notifications_history_text;
        mView.setManageOrHistoryButtonDescription(resId);
@@ -179,7 +189,7 @@ public class FooterViewTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testSetManageOrHistoryButtonDescription_expectsFlagEnabled() {
        clearInvocations(mSpyContext);
        int resId = R.string.accessibility_clear_all;
@@ -207,7 +217,7 @@ public class FooterViewTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testSetClearAllButtonText_expectsFlagEnabled() {
        clearInvocations(mSpyContext);
        int resId = R.string.clear_all_notifications_text;
@@ -235,7 +245,7 @@ public class FooterViewTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testSetClearAllButtonDescription_expectsFlagEnabled() {
        clearInvocations(mSpyContext);
        int resId = R.string.accessibility_clear_all;
@@ -263,7 +273,7 @@ public class FooterViewTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testSetMessageString_expectsFlagEnabled() {
        clearInvocations(mSpyContext);
        int resId = R.string.unlock_to_see_notif_text;
@@ -288,7 +298,7 @@ public class FooterViewTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testSetMessageIcon_expectsFlagEnabled() {
        clearInvocations(mSpyContext);
        int resId = R.drawable.ic_friction_lock_closed;
@@ -310,4 +320,3 @@ public class FooterViewTest extends SysuiTestCase {
                .isEqualTo(View.GONE);
    }
}
+12 −11
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ import com.android.systemui.statusbar.notification.collection.render.GroupMember
import com.android.systemui.statusbar.notification.emptyshade.shared.ModesEmptyShadeFix;
import com.android.systemui.statusbar.notification.emptyshade.ui.view.EmptyShadeView;
import com.android.systemui.statusbar.notification.footer.shared.FooterViewRefactor;
import com.android.systemui.statusbar.notification.footer.shared.NotifRedesignFooter;
import com.android.systemui.statusbar.notification.footer.ui.view.FooterView;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableView;
@@ -559,7 +560,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void manageNotifications_visible() {
        FooterView view = mock(FooterView.class);
        mStackScroller.setFooterView(view);
@@ -572,7 +573,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void clearAll_visible() {
        FooterView view = mock(FooterView.class);
        mStackScroller.setFooterView(view);
@@ -585,7 +586,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testInflateFooterView() {
        mStackScroller.inflateFooterView();
        ArgumentCaptor<FooterView> captor = ArgumentCaptor.forClass(FooterView.class);
@@ -596,7 +597,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testUpdateFooter_noNotifications() {
        setBarStateForTest(StatusBarState.SHADE);
        mStackScroller.setCurrentUserSetup(true);
@@ -608,7 +609,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testUpdateFooter_remoteInput() {
        setBarStateForTest(StatusBarState.SHADE);
        mStackScroller.setCurrentUserSetup(true);
@@ -625,7 +626,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testUpdateFooter_withoutNotifications() {
        setBarStateForTest(StatusBarState.SHADE);
        mStackScroller.setCurrentUserSetup(true);
@@ -641,7 +642,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testUpdateFooter_oneClearableNotification() {
        setBarStateForTest(StatusBarState.SHADE);
        mStackScroller.setCurrentUserSetup(true);
@@ -657,7 +658,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testUpdateFooter_withoutHistory() {
        setBarStateForTest(StatusBarState.SHADE);
        mStackScroller.setCurrentUserSetup(true);
@@ -674,7 +675,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testUpdateFooter_oneClearableNotification_beforeUserSetup() {
        setBarStateForTest(StatusBarState.SHADE);
        mStackScroller.setCurrentUserSetup(false);
@@ -690,7 +691,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void testUpdateFooter_oneNonClearableNotification() {
        setBarStateForTest(StatusBarState.SHADE);
        mStackScroller.setCurrentUserSetup(true);
@@ -1181,7 +1182,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableFlags(FooterViewRefactor.FLAG_NAME)
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    public void hasFilteredOutSeenNotifs_updateFooter() {
        mStackScroller.setCurrentUserSetup(true);