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

Commit 7dd130bf authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Fix HeadUpManagerImplTest

This test was failing when we enabled the promoted ui flag because the new behavior applies if *either* of the flags is enabled, but not both. The test wasn't updated with the implementation.

Change-Id: Idccd23f2a9c70a46c87462cd8e817e2110d3d963
Flag: com.android.systemui.status_bar_notification_chips
Flag: android.app.ui_rich_ongoing
Test: atest HeadsUpManagerImplTest
Fixes: 393592781
parent 92ae26dc
Loading
Loading
Loading
Loading
+21 −13
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder
import com.android.systemui.statusbar.notification.collection.provider.visualStabilityProvider
import com.android.systemui.statusbar.notification.collection.render.GroupMembershipManager
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.row.NotificationTestHelper
import com.android.systemui.statusbar.notification.shared.NotificationThrottleHun
@@ -678,25 +679,32 @@ class HeadsUpManagerImplTest(flags: FlagsParameterization) : SysuiTestCase() {
    }

    @Test
    @DisableFlags(StatusBarNotifChips.FLAG_NAME)
    fun testIsSticky_promotedAndExpanded_notifChipsFlagOff_true() {
        val notif = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build()
        notif.flags = FLAG_PROMOTED_ONGOING
        val notifEntry = HeadsUpManagerTestUtil.createEntry(/* id= */ 0, notif)
        val row = testHelper.createRow().apply { setPinnedStatus(PinnedStatus.PinnedBySystem) }
        notifEntry.row = row

        underTest.showNotification(notifEntry)
    @DisableFlags(StatusBarNotifChips.FLAG_NAME, PromotedNotificationUi.FLAG_NAME)
    fun testIsSticky_promotedAndExpanded_notifChipsFlagOff_promotedUiFlagOff_true() {
        assertThat(getIsSticky_promotedAndExpanded()).isTrue()
    }

        val headsUpEntry = underTest.getHeadsUpEntry(notifEntry.key)
        headsUpEntry!!.setExpanded(true)
    @Test
    @EnableFlags(StatusBarNotifChips.FLAG_NAME, PromotedNotificationUi.FLAG_NAME)
    fun testIsSticky_promotedAndExpanded_notifChipsFlagOn_promotedUiFlagOn_false() {
        assertThat(getIsSticky_promotedAndExpanded()).isFalse()
    }

        assertThat(underTest.isSticky(notifEntry.key)).isTrue()
    @Test
    @EnableFlags(PromotedNotificationUi.FLAG_NAME)
    @DisableFlags(StatusBarNotifChips.FLAG_NAME)
    fun testIsSticky_promotedAndExpanded_promotedUiFlagOn_false() {
        assertThat(getIsSticky_promotedAndExpanded()).isFalse()
    }

    @Test
    @EnableFlags(StatusBarNotifChips.FLAG_NAME)
    @DisableFlags(PromotedNotificationUi.FLAG_NAME)
    fun testIsSticky_promotedAndExpanded_notifChipsFlagOn_false() {
        assertThat(getIsSticky_promotedAndExpanded()).isFalse()
    }

    private fun getIsSticky_promotedAndExpanded(): Boolean {
        val notif = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build()
        notif.flags = FLAG_PROMOTED_ONGOING
        val notifEntry = HeadsUpManagerTestUtil.createEntry(/* id= */ 0, notif)
@@ -708,7 +716,7 @@ class HeadsUpManagerImplTest(flags: FlagsParameterization) : SysuiTestCase() {
        val headsUpEntry = underTest.getHeadsUpEntry(notifEntry.key)
        headsUpEntry!!.setExpanded(true)

        assertThat(underTest.isSticky(notifEntry.key)).isFalse()
        return underTest.isSticky(notifEntry.key)
    }

    @Test