Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/StatusBarNotificationChipsInteractorTest.kt +17 −14 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifCh import com.android.systemui.statusbar.notification.data.model.activeNotificationModel import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat Loading Loading @@ -60,7 +61,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock<StatusBarIconView>(), isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading Loading @@ -90,7 +91,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = null, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -110,7 +111,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = icon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -133,17 +134,17 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif1", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), ), activeNotificationModel( key = "notif2", statusBarChipIcon = secondIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), ), activeNotificationModel( key = "notif3", statusBarChipIcon = mock<StatusBarIconView>(), isPromoted = false, promotedContent = null, ), ) ) Loading @@ -170,7 +171,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -183,7 +184,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = secondIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -196,7 +197,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = thirdIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -216,7 +217,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock(), isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -228,7 +229,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock(), isPromoted = false, promotedContent = null, ) ) ) Loading @@ -239,7 +240,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock(), isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -260,7 +261,8 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif|uid1", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif|uid1").build(), ) ) ) Loading @@ -274,7 +276,8 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif|uid2", statusBarChipIcon = secondIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif|uid2").build(), ) ) ) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelTest.kt +8 −6 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.systemui.statusbar.chips.ui.model.OngoingActivityChipModel import com.android.systemui.statusbar.notification.data.model.activeNotificationModel import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat Loading Loading @@ -75,7 +76,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = null, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -94,7 +95,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = icon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -117,17 +118,17 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif1", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), ), activeNotificationModel( key = "notif2", statusBarChipIcon = secondIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), ), activeNotificationModel( key = "notif3", statusBarChipIcon = mock<StatusBarIconView>(), isPromoted = false, promotedContent = null, ), ) ) Loading @@ -151,7 +152,8 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "clickTest", statusBarChipIcon = mock<StatusBarIconView>(), isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("clickTest").build(), ) ) ) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt +17 −9 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import com.android.systemui.statusbar.commandline.commandRegistry import com.android.systemui.statusbar.notification.data.model.activeNotificationModel import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.statusbar.phone.SystemUIDialog import com.android.systemui.statusbar.phone.ongoingcall.data.repository.ongoingCallRepository Loading Loading @@ -307,7 +308,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = icon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -328,12 +329,14 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = secondIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("secondNotif").build(), ), ) ) Loading @@ -355,17 +358,20 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = secondIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("secondNotif").build(), ), activeNotificationModel( key = "thirdNotif", statusBarChipIcon = thirdIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("thirdNotif").build(), ), ) ) Loading @@ -386,12 +392,14 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = mock<StatusBarIconView>(), isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("secondNotif").build(), ), ) ) Loading @@ -412,7 +420,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock<StatusBarIconView>(), isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/ActiveNotificationsInteractorTest.kt +22 −9 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.systemui.statusbar.notification.data.model.activeNotification import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.data.repository.setActiveNotifs import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.shared.CallType import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat Loading Loading @@ -169,8 +170,12 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() { testScope.runTest { val latest by collectLastValue(underTest.promotedOngoingNotifications) val promoted1 = activeNotificationModel(key = "notif1", isPromoted = true) val notPromoted2 = activeNotificationModel(key = "notif2", isPromoted = false) val promoted1 = activeNotificationModel( key = "notif1", promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), ) val notPromoted2 = activeNotificationModel(key = "notif2", promotedContent = null) activeNotificationListRepository.activeNotifications.value = ActiveNotificationsStore.Builder() Loading @@ -189,9 +194,9 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() { activeNotificationListRepository.activeNotifications.value = ActiveNotificationsStore.Builder() .apply { activeNotificationModel(key = "notif1", isPromoted = false) } .apply { activeNotificationModel(key = "notif2", isPromoted = false) } .apply { activeNotificationModel(key = "notif3", isPromoted = false) } .apply { activeNotificationModel(key = "notif1", promotedContent = null) } .apply { activeNotificationModel(key = "notif2", promotedContent = null) } .apply { activeNotificationModel(key = "notif3", promotedContent = null) } .build() assertThat(latest!!).isEmpty() Loading @@ -203,10 +208,18 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() { testScope.runTest { val latest by collectLastValue(underTest.promotedOngoingNotifications) val promoted1 = activeNotificationModel(key = "notif1", isPromoted = true) val notPromoted2 = activeNotificationModel(key = "notif2", isPromoted = false) val notPromoted3 = activeNotificationModel(key = "notif3", isPromoted = false) val promoted4 = activeNotificationModel(key = "notif4", isPromoted = true) val promoted1 = activeNotificationModel( key = "notif1", promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), ) val notPromoted2 = activeNotificationModel(key = "notif2", promotedContent = null) val notPromoted3 = activeNotificationModel(key = "notif3", promotedContent = null) val promoted4 = activeNotificationModel( key = "notif4", promotedContent = PromotedNotificationContentModel.Builder("notif4").build(), ) activeNotificationListRepository.activeNotifications.value = ActiveNotificationsStore.Builder() Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt +13 −16 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.statusbar.notification.domain.interactor import android.app.Notification import android.app.Notification.FLAG_PROMOTED_ONGOING import android.platform.test.annotations.EnableFlags import android.service.notification.StatusBarNotification import androidx.test.ext.junit.runners.AndroidJUnit4 Loading @@ -29,7 +28,7 @@ import com.android.systemui.statusbar.notification.collection.GroupEntry import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi import com.android.systemui.statusbar.notification.promoted.promotedNotificationsProvider import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.shared.byKey import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock Loading @@ -48,11 +47,7 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { private val notifsRepository = kosmos.activeNotificationListRepository private val notifsInteractor = kosmos.activeNotificationsInteractor private val underTest = RenderNotificationListInteractor( notifsRepository, sectionStyleProvider = mock(), promotedNotificationsProvider = kosmos.promotedNotificationsProvider, ) RenderNotificationListInteractor(notifsRepository, sectionStyleProvider = mock()) @Test fun setRenderedList_preservesOrdering() = Loading Loading @@ -127,12 +122,16 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { @Test @EnableFlags(PromotedNotificationUi.FLAG_NAME) fun setRenderList_setsPromotionStatus() = fun setRenderList_setsPromotionContent() = testScope.runTest { val actual by collectLastValue(notifsInteractor.topLevelRepresentativeNotifications) val notPromoted1 = mockNotificationEntry("key1", flag = null) val promoted2 = mockNotificationEntry("key2", flag = FLAG_PROMOTED_ONGOING) val notPromoted1 = mockNotificationEntry("key1", promotedContent = null) val promoted2 = mockNotificationEntry( "key2", promotedContent = PromotedNotificationContentModel.Builder("key2").build(), ) underTest.setRenderedList(listOf(notPromoted1, promoted2)) Loading @@ -140,22 +139,19 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { val first = actual!![0] assertThat(first.key).isEqualTo("key1") assertThat(first.isPromoted).isFalse() assertThat(first.promotedContent).isNull() val second = actual!![1] assertThat(second.key).isEqualTo("key2") assertThat(second.isPromoted).isTrue() assertThat(second.promotedContent).isNotNull() } private fun mockNotificationEntry( key: String, rank: Int = 0, flag: Int? = null, promotedContent: PromotedNotificationContentModel? = null, ): NotificationEntry { val nBuilder = Notification.Builder(context, "a") if (flag != null) { nBuilder.setFlag(flag, true) } val notification = nBuilder.build() val mockSbn = Loading @@ -169,6 +165,7 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { whenever(this.representativeEntry).thenReturn(this) whenever(this.ranking).thenReturn(RankingBuilder().setRank(rank).build()) whenever(this.sbn).thenReturn(mockSbn) whenever(this.promotedNotificationContentModel).thenReturn(promotedContent) } } } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/StatusBarNotificationChipsInteractorTest.kt +17 −14 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifCh import com.android.systemui.statusbar.notification.data.model.activeNotificationModel import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat Loading Loading @@ -60,7 +61,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock<StatusBarIconView>(), isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading Loading @@ -90,7 +91,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = null, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -110,7 +111,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = icon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -133,17 +134,17 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif1", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), ), activeNotificationModel( key = "notif2", statusBarChipIcon = secondIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), ), activeNotificationModel( key = "notif3", statusBarChipIcon = mock<StatusBarIconView>(), isPromoted = false, promotedContent = null, ), ) ) Loading @@ -170,7 +171,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -183,7 +184,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = secondIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -196,7 +197,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = thirdIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -216,7 +217,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock(), isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -228,7 +229,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock(), isPromoted = false, promotedContent = null, ) ) ) Loading @@ -239,7 +240,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock(), isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -260,7 +261,8 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif|uid1", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif|uid1").build(), ) ) ) Loading @@ -274,7 +276,8 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() { activeNotificationModel( key = "notif|uid2", statusBarChipIcon = secondIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif|uid2").build(), ) ) ) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelTest.kt +8 −6 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.systemui.statusbar.chips.ui.model.OngoingActivityChipModel import com.android.systemui.statusbar.notification.data.model.activeNotificationModel import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat Loading Loading @@ -75,7 +76,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = null, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -94,7 +95,7 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = icon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -117,17 +118,17 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif1", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), ), activeNotificationModel( key = "notif2", statusBarChipIcon = secondIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif2").build(), ), activeNotificationModel( key = "notif3", statusBarChipIcon = mock<StatusBarIconView>(), isPromoted = false, promotedContent = null, ), ) ) Loading @@ -151,7 +152,8 @@ class NotifChipsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "clickTest", statusBarChipIcon = mock<StatusBarIconView>(), isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("clickTest").build(), ) ) ) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt +17 −9 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import com.android.systemui.statusbar.commandline.commandRegistry import com.android.systemui.statusbar.notification.data.model.activeNotificationModel import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.statusbar.phone.SystemUIDialog import com.android.systemui.statusbar.phone.ongoingcall.data.repository.ongoingCallRepository Loading Loading @@ -307,7 +308,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = icon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading @@ -328,12 +329,14 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = secondIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("secondNotif").build(), ), ) ) Loading @@ -355,17 +358,20 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = secondIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("secondNotif").build(), ), activeNotificationModel( key = "thirdNotif", statusBarChipIcon = thirdIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("thirdNotif").build(), ), ) ) Loading @@ -386,12 +392,14 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "firstNotif", statusBarChipIcon = firstIcon, isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("firstNotif").build(), ), activeNotificationModel( key = "secondNotif", statusBarChipIcon = mock<StatusBarIconView>(), isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("secondNotif").build(), ), ) ) Loading @@ -412,7 +420,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() { activeNotificationModel( key = "notif", statusBarChipIcon = mock<StatusBarIconView>(), isPromoted = true, promotedContent = PromotedNotificationContentModel.Builder("notif").build(), ) ) ) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/ActiveNotificationsInteractorTest.kt +22 −9 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import com.android.systemui.statusbar.notification.data.model.activeNotification import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.data.repository.setActiveNotifs import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.shared.CallType import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat Loading Loading @@ -169,8 +170,12 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() { testScope.runTest { val latest by collectLastValue(underTest.promotedOngoingNotifications) val promoted1 = activeNotificationModel(key = "notif1", isPromoted = true) val notPromoted2 = activeNotificationModel(key = "notif2", isPromoted = false) val promoted1 = activeNotificationModel( key = "notif1", promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), ) val notPromoted2 = activeNotificationModel(key = "notif2", promotedContent = null) activeNotificationListRepository.activeNotifications.value = ActiveNotificationsStore.Builder() Loading @@ -189,9 +194,9 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() { activeNotificationListRepository.activeNotifications.value = ActiveNotificationsStore.Builder() .apply { activeNotificationModel(key = "notif1", isPromoted = false) } .apply { activeNotificationModel(key = "notif2", isPromoted = false) } .apply { activeNotificationModel(key = "notif3", isPromoted = false) } .apply { activeNotificationModel(key = "notif1", promotedContent = null) } .apply { activeNotificationModel(key = "notif2", promotedContent = null) } .apply { activeNotificationModel(key = "notif3", promotedContent = null) } .build() assertThat(latest!!).isEmpty() Loading @@ -203,10 +208,18 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() { testScope.runTest { val latest by collectLastValue(underTest.promotedOngoingNotifications) val promoted1 = activeNotificationModel(key = "notif1", isPromoted = true) val notPromoted2 = activeNotificationModel(key = "notif2", isPromoted = false) val notPromoted3 = activeNotificationModel(key = "notif3", isPromoted = false) val promoted4 = activeNotificationModel(key = "notif4", isPromoted = true) val promoted1 = activeNotificationModel( key = "notif1", promotedContent = PromotedNotificationContentModel.Builder("notif1").build(), ) val notPromoted2 = activeNotificationModel(key = "notif2", promotedContent = null) val notPromoted3 = activeNotificationModel(key = "notif3", promotedContent = null) val promoted4 = activeNotificationModel( key = "notif4", promotedContent = PromotedNotificationContentModel.Builder("notif4").build(), ) activeNotificationListRepository.activeNotifications.value = ActiveNotificationsStore.Builder() Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt +13 −16 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.statusbar.notification.domain.interactor import android.app.Notification import android.app.Notification.FLAG_PROMOTED_ONGOING import android.platform.test.annotations.EnableFlags import android.service.notification.StatusBarNotification import androidx.test.ext.junit.runners.AndroidJUnit4 Loading @@ -29,7 +28,7 @@ import com.android.systemui.statusbar.notification.collection.GroupEntry import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi import com.android.systemui.statusbar.notification.promoted.promotedNotificationsProvider import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.notification.shared.byKey import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock Loading @@ -48,11 +47,7 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { private val notifsRepository = kosmos.activeNotificationListRepository private val notifsInteractor = kosmos.activeNotificationsInteractor private val underTest = RenderNotificationListInteractor( notifsRepository, sectionStyleProvider = mock(), promotedNotificationsProvider = kosmos.promotedNotificationsProvider, ) RenderNotificationListInteractor(notifsRepository, sectionStyleProvider = mock()) @Test fun setRenderedList_preservesOrdering() = Loading Loading @@ -127,12 +122,16 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { @Test @EnableFlags(PromotedNotificationUi.FLAG_NAME) fun setRenderList_setsPromotionStatus() = fun setRenderList_setsPromotionContent() = testScope.runTest { val actual by collectLastValue(notifsInteractor.topLevelRepresentativeNotifications) val notPromoted1 = mockNotificationEntry("key1", flag = null) val promoted2 = mockNotificationEntry("key2", flag = FLAG_PROMOTED_ONGOING) val notPromoted1 = mockNotificationEntry("key1", promotedContent = null) val promoted2 = mockNotificationEntry( "key2", promotedContent = PromotedNotificationContentModel.Builder("key2").build(), ) underTest.setRenderedList(listOf(notPromoted1, promoted2)) Loading @@ -140,22 +139,19 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { val first = actual!![0] assertThat(first.key).isEqualTo("key1") assertThat(first.isPromoted).isFalse() assertThat(first.promotedContent).isNull() val second = actual!![1] assertThat(second.key).isEqualTo("key2") assertThat(second.isPromoted).isTrue() assertThat(second.promotedContent).isNotNull() } private fun mockNotificationEntry( key: String, rank: Int = 0, flag: Int? = null, promotedContent: PromotedNotificationContentModel? = null, ): NotificationEntry { val nBuilder = Notification.Builder(context, "a") if (flag != null) { nBuilder.setFlag(flag, true) } val notification = nBuilder.build() val mockSbn = Loading @@ -169,6 +165,7 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() { whenever(this.representativeEntry).thenReturn(this) whenever(this.ranking).thenReturn(RankingBuilder().setRank(rank).build()) whenever(this.sbn).thenReturn(mockSbn) whenever(this.promotedNotificationContentModel).thenReturn(promotedContent) } } } Loading