Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/BundleEntryTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ class BundleEntryTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_adapter() { assertThat(underTest.entryAdapter.isGroupRoot).isTrue() fun getGroupRoot_adapter() { assertThat(underTest.entryAdapter.groupRoot).isEqualTo(underTest.entryAdapter) } @Test Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -542,7 +542,7 @@ public class NotificationEntryTest extends SysuiTestCase { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) public void isGroupRoot_adapter_groupSummary() { public void getGroupRoot_adapter_groupSummary() { ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); Notification notification = new Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) Loading @@ -562,12 +562,12 @@ public class NotificationEntryTest extends SysuiTestCase { .build(); entry.setRow(row); assertThat(entry.getEntryAdapter().isGroupRoot()).isFalse(); assertThat(entry.getEntryAdapter().getGroupRoot()).isNull(); } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) public void isGroupRoot_adapter_groupChild() { public void getGroupRoot_adapter_groupChild() { Notification notification = new Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) .setGroupSummary(true) Loading @@ -591,7 +591,7 @@ public class NotificationEntryTest extends SysuiTestCase { .setParent(groupEntry.build()) .build(); assertThat(entry.getEntryAdapter().isGroupRoot()).isFalse(); assertThat(entry.getEntryAdapter().getGroupRoot()).isEqualTo(parent.getEntryAdapter()); } @Test Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerTest.kt +37 −54 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.statusbar.notification.collection.render import android.os.Build import android.os.UserHandle import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.SetFlagsRule Loading @@ -30,12 +29,9 @@ import com.android.systemui.statusbar.notification.collection.GroupEntry import com.android.systemui.statusbar.notification.collection.GroupEntryBuilder import com.android.systemui.statusbar.notification.collection.ListEntry import com.android.systemui.statusbar.notification.collection.NotifPipeline import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder import com.android.systemui.statusbar.notification.collection.listbuilder.OnBeforeRenderListListener import com.android.systemui.statusbar.notification.collection.render.GroupExpansionManager.OnGroupExpansionChangeListener import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.NotificationTestHelper import com.android.systemui.statusbar.notification.shared.NotificationBundleUi import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.mock Loading @@ -59,39 +55,23 @@ class GroupExpansionManagerTest : SysuiTestCase() { private lateinit var underTest: GroupExpansionManagerImpl private lateinit var testHelper: NotificationTestHelper private val dumpManager: DumpManager = mock() private val groupMembershipManager: GroupMembershipManager = mock() private val pipeline: NotifPipeline = mock() private lateinit var beforeRenderListListener: OnBeforeRenderListListener private lateinit var summary1: NotificationEntry private lateinit var summary2: NotificationEntry private lateinit var entries: List<ListEntry> private fun notificationEntry(pkg: String, id: Int, parent: ExpandableNotificationRow?) = NotificationEntryBuilder().setPkg(pkg).setId(id).build().apply { row = testHelper.createRow().apply { setIsChildInGroup(true, parent) } } @Before fun setUp() { testHelper = NotificationTestHelper(mContext, mDependency) summary1 = testHelper.createRow().entry summary2 = testHelper.createRow().entry entries = private val summary1 = notificationSummaryEntry("foo", 1) private val summary2 = notificationSummaryEntry("bar", 1) private val entries = listOf<ListEntry>( GroupEntryBuilder() .setSummary(summary1) .setChildren( listOf( notificationEntry("foo", 2, summary1.row), notificationEntry("foo", 3, summary1.row), notificationEntry("foo", 4, summary1.row) notificationEntry("foo", 2), notificationEntry("foo", 3), notificationEntry("foo", 4) ) ) .build(), Loading @@ -99,18 +79,32 @@ class GroupExpansionManagerTest : SysuiTestCase() { .setSummary(summary2) .setChildren( listOf( notificationEntry("bar", 2, summary2.row), notificationEntry("bar", 3, summary2.row), notificationEntry("bar", 4, summary2.row) notificationEntry("bar", 2), notificationEntry("bar", 3), notificationEntry("bar", 4) ) ) .build(), notificationEntry("baz", 1, null) notificationEntry("baz", 1) ) private fun notificationEntry(pkg: String, id: Int) = NotificationEntryBuilder().setPkg(pkg).setId(id).build().apply { row = mock() } private fun notificationSummaryEntry(pkg: String, id: Int) = NotificationEntryBuilder().setPkg(pkg).setId(id).setParent(GroupEntry.ROOT_ENTRY).build() .apply { row = mock() } @Before fun setUp() { whenever(groupMembershipManager.getGroupSummary(summary1)).thenReturn(summary1) whenever(groupMembershipManager.getGroupSummary(summary2)).thenReturn(summary2) whenever(groupMembershipManager.getGroupRoot(summary1.entryAdapter)) .thenReturn(summary1.entryAdapter) whenever(groupMembershipManager.getGroupRoot(summary2.entryAdapter)) .thenReturn(summary2.entryAdapter) underTest = GroupExpansionManagerImpl(dumpManager, groupMembershipManager) } Loading Loading @@ -227,15 +221,4 @@ class GroupExpansionManagerTest : SysuiTestCase() { verify(listener).onGroupExpansionChange(summary1.row, false) verifyNoMoreInteractions(listener) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupExpanded() { underTest.setGroupExpanded(summary1.entryAdapter, true) assertThat(underTest.isGroupExpanded(summary1.entryAdapter)).isTrue(); assertThat(underTest.isGroupExpanded( (entries[0] as? GroupEntry)?.getChildren()?.get(0)?.entryAdapter)) .isTrue(); } } packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/GroupMembershipManagerTest.kt +29 −8 Original line number Diff line number Diff line Loading @@ -170,7 +170,28 @@ class GroupMembershipManagerTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isChildEntryAdapterInGroup_child() { fun isGroupRoot_topLevelEntry() { val entry = NotificationEntryBuilder().setParent(GroupEntry.ROOT_ENTRY).build() assertThat(underTest.isGroupRoot(entry.entryAdapter)).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_summary() { val groupKey = "group" val summary = NotificationEntryBuilder() .setGroup(mContext, groupKey) .setGroupSummary(mContext, true) .build() GroupEntryBuilder().setKey(groupKey).setSummary(summary).build() assertThat(underTest.isGroupRoot(summary.entryAdapter)).isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_child() { val groupKey = "group" val summary = NotificationEntryBuilder() Loading @@ -180,19 +201,19 @@ class GroupMembershipManagerTest : SysuiTestCase() { val entry = NotificationEntryBuilder().setGroup(mContext, groupKey).build() GroupEntryBuilder().setKey(groupKey).setSummary(summary).addChild(entry).build() assertThat(underTest.isChildInGroup(entry.entryAdapter)).isTrue() assertThat(underTest.isGroupRoot(entry.entryAdapter)).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_topLevelEntry() { fun getGroupRoot_topLevelEntry() { val entry = NotificationEntryBuilder().setParent(GroupEntry.ROOT_ENTRY).build() assertThat(underTest.isGroupRoot(entry.entryAdapter)).isFalse() assertThat(underTest.getGroupRoot(entry.entryAdapter)).isNull() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_summary() { fun getGroupRoot_summary() { val groupKey = "group" val summary = NotificationEntryBuilder() Loading @@ -201,12 +222,12 @@ class GroupMembershipManagerTest : SysuiTestCase() { .build() GroupEntryBuilder().setKey(groupKey).setSummary(summary).build() assertThat(underTest.isGroupRoot(summary.entryAdapter)).isTrue() assertThat(underTest.getGroupRoot(summary.entryAdapter)).isEqualTo(summary.entryAdapter) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_child() { fun getGroupRoot_child() { val groupKey = "group" val summary = NotificationEntryBuilder() Loading @@ -216,6 +237,6 @@ class GroupMembershipManagerTest : SysuiTestCase() { val entry = NotificationEntryBuilder().setGroup(mContext, groupKey).build() GroupEntryBuilder().setKey(groupKey).setSummary(summary).addChild(entry).build() assertThat(underTest.isGroupRoot(entry.entryAdapter)).isFalse() assertThat(underTest.getGroupRoot(entry.entryAdapter)).isEqualTo(summary.entryAdapter) } } packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.kt +8 −61 Original line number Diff line number Diff line Loading @@ -54,7 +54,6 @@ import com.android.systemui.statusbar.notification.interruption.VisualInterrupti import com.android.systemui.statusbar.notification.interruption.VisualInterruptionRefactor import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.shared.NotificationBundleUi import com.android.systemui.statusbar.notification.stack.notificationStackScrollLayoutController import com.android.systemui.statusbar.notification.visualInterruptionDecisionProvider import com.android.systemui.statusbar.notificationLockscreenUserManager Loading Loading @@ -294,7 +293,6 @@ class StatusBarNotificationPresenterTest : SysuiTestCase() { @Test @EnableSceneContainer @DisableFlags(NotificationBundleUi.FLAG_NAME) fun testExpandSensitiveNotification_onLockScreen_opensShade() = kosmos.runTest { // Given we are on the keyguard Loading @@ -305,35 +303,11 @@ class StatusBarNotificationPresenterTest : SysuiTestCase() { ) // When the user expands a sensitive Notification val row = createRow(createNotificationEntry()) val row = createRow() val entry = row.entry.apply { setSensitive(/* sensitive= */ true, /* deviceSensitive= */ true) } underTest.onExpandClicked(row.entry, mock(), /* nowExpanded= */ true) // Then we open the locked shade verify(kosmos.lockscreenShadeTransitionController) // Explicit parameters to avoid issues with Kotlin default arguments in Mockito .goToLockedShade(row, true) } @Test @EnableSceneContainer @EnableFlags(NotificationBundleUi.FLAG_NAME) fun testExpandSensitiveNotification_onLockScreen_opensShade_entryAdapter() = kosmos.runTest { // Given we are on the keyguard kosmos.sysuiStatusBarStateController.state = StatusBarState.KEYGUARD // And the device is locked kosmos.fakeAuthenticationRepository.setAuthenticationMethod( AuthenticationMethodModel.Pin ) // When the user expands a sensitive Notification val entry = createNotificationEntry() val row = createRow(entry) entry.setSensitive(/* sensitive= */ true, /* deviceSensitive= */ true) underTest.onExpandClicked(row, row.entryAdapter, /* nowExpanded= */ true) underTest.onExpandClicked(entry, mock(), /* nowExpanded= */ true) // Then we open the locked shade verify(kosmos.lockscreenShadeTransitionController) Loading @@ -343,7 +317,6 @@ class StatusBarNotificationPresenterTest : SysuiTestCase() { @Test @EnableSceneContainer @DisableFlags(NotificationBundleUi.FLAG_NAME) fun testExpandSensitiveNotification_onLockedShade_showsBouncer() = kosmos.runTest { // Given we are on the locked shade Loading @@ -355,7 +328,7 @@ class StatusBarNotificationPresenterTest : SysuiTestCase() { // When the user expands a sensitive Notification val entry = createRow(createNotificationEntry()).entry.apply { createRow().entry.apply { setSensitive(/* sensitive= */ true, /* deviceSensitive= */ true) } underTest.onExpandClicked(entry, mock(), /* nowExpanded= */ true) Loading @@ -364,29 +337,6 @@ class StatusBarNotificationPresenterTest : SysuiTestCase() { verify(kosmos.activityStarter).dismissKeyguardThenExecute(any(), eq(null), eq(false)) } @Test @EnableSceneContainer @EnableFlags(NotificationBundleUi.FLAG_NAME) fun testExpandSensitiveNotification_onLockedShade_showsBouncer_entryAdapter() = kosmos.runTest { // Given we are on the locked shade kosmos.sysuiStatusBarStateController.state = StatusBarState.SHADE_LOCKED // And the device is locked kosmos.fakeAuthenticationRepository.setAuthenticationMethod( AuthenticationMethodModel.Pin ) // When the user expands a sensitive Notification val entry = createNotificationEntry() val row = createRow(entry) entry.setSensitive(/* sensitive= */ true, /* deviceSensitive= */ true) underTest.onExpandClicked(row, row.entryAdapter, /* nowExpanded= */ true) // Then we show the bouncer verify(kosmos.activityStarter).dismissKeyguardThenExecute(any(), eq(null), eq(false)) } private fun createPresenter(): StatusBarNotificationPresenter { val initController: InitController = InitController() return StatusBarNotificationPresenter( Loading Loading @@ -448,13 +398,10 @@ class StatusBarNotificationPresenterTest : SysuiTestCase() { interruptSuppressor = suppressorCaptor.lastValue } private fun createRow(entry: NotificationEntry): ExpandableNotificationRow { private fun createRow(): ExpandableNotificationRow { val row: ExpandableNotificationRow = mock() if (NotificationBundleUi.isEnabled) { whenever(row.entryAdapter).thenReturn(entry.entryAdapter) } else { val entry: NotificationEntry = createNotificationEntry() whenever(row.entry).thenReturn(entry) } entry.row = row return row } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/BundleEntryTest.kt +2 −2 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ class BundleEntryTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_adapter() { assertThat(underTest.entryAdapter.isGroupRoot).isTrue() fun getGroupRoot_adapter() { assertThat(underTest.entryAdapter.groupRoot).isEqualTo(underTest.entryAdapter) } @Test Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -542,7 +542,7 @@ public class NotificationEntryTest extends SysuiTestCase { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) public void isGroupRoot_adapter_groupSummary() { public void getGroupRoot_adapter_groupSummary() { ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); Notification notification = new Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) Loading @@ -562,12 +562,12 @@ public class NotificationEntryTest extends SysuiTestCase { .build(); entry.setRow(row); assertThat(entry.getEntryAdapter().isGroupRoot()).isFalse(); assertThat(entry.getEntryAdapter().getGroupRoot()).isNull(); } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) public void isGroupRoot_adapter_groupChild() { public void getGroupRoot_adapter_groupChild() { Notification notification = new Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) .setGroupSummary(true) Loading @@ -591,7 +591,7 @@ public class NotificationEntryTest extends SysuiTestCase { .setParent(groupEntry.build()) .build(); assertThat(entry.getEntryAdapter().isGroupRoot()).isFalse(); assertThat(entry.getEntryAdapter().getGroupRoot()).isEqualTo(parent.getEntryAdapter()); } @Test Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerTest.kt +37 −54 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.systemui.statusbar.notification.collection.render import android.os.Build import android.os.UserHandle import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.SetFlagsRule Loading @@ -30,12 +29,9 @@ import com.android.systemui.statusbar.notification.collection.GroupEntry import com.android.systemui.statusbar.notification.collection.GroupEntryBuilder import com.android.systemui.statusbar.notification.collection.ListEntry import com.android.systemui.statusbar.notification.collection.NotifPipeline import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder import com.android.systemui.statusbar.notification.collection.listbuilder.OnBeforeRenderListListener import com.android.systemui.statusbar.notification.collection.render.GroupExpansionManager.OnGroupExpansionChangeListener import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.NotificationTestHelper import com.android.systemui.statusbar.notification.shared.NotificationBundleUi import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.mock Loading @@ -59,39 +55,23 @@ class GroupExpansionManagerTest : SysuiTestCase() { private lateinit var underTest: GroupExpansionManagerImpl private lateinit var testHelper: NotificationTestHelper private val dumpManager: DumpManager = mock() private val groupMembershipManager: GroupMembershipManager = mock() private val pipeline: NotifPipeline = mock() private lateinit var beforeRenderListListener: OnBeforeRenderListListener private lateinit var summary1: NotificationEntry private lateinit var summary2: NotificationEntry private lateinit var entries: List<ListEntry> private fun notificationEntry(pkg: String, id: Int, parent: ExpandableNotificationRow?) = NotificationEntryBuilder().setPkg(pkg).setId(id).build().apply { row = testHelper.createRow().apply { setIsChildInGroup(true, parent) } } @Before fun setUp() { testHelper = NotificationTestHelper(mContext, mDependency) summary1 = testHelper.createRow().entry summary2 = testHelper.createRow().entry entries = private val summary1 = notificationSummaryEntry("foo", 1) private val summary2 = notificationSummaryEntry("bar", 1) private val entries = listOf<ListEntry>( GroupEntryBuilder() .setSummary(summary1) .setChildren( listOf( notificationEntry("foo", 2, summary1.row), notificationEntry("foo", 3, summary1.row), notificationEntry("foo", 4, summary1.row) notificationEntry("foo", 2), notificationEntry("foo", 3), notificationEntry("foo", 4) ) ) .build(), Loading @@ -99,18 +79,32 @@ class GroupExpansionManagerTest : SysuiTestCase() { .setSummary(summary2) .setChildren( listOf( notificationEntry("bar", 2, summary2.row), notificationEntry("bar", 3, summary2.row), notificationEntry("bar", 4, summary2.row) notificationEntry("bar", 2), notificationEntry("bar", 3), notificationEntry("bar", 4) ) ) .build(), notificationEntry("baz", 1, null) notificationEntry("baz", 1) ) private fun notificationEntry(pkg: String, id: Int) = NotificationEntryBuilder().setPkg(pkg).setId(id).build().apply { row = mock() } private fun notificationSummaryEntry(pkg: String, id: Int) = NotificationEntryBuilder().setPkg(pkg).setId(id).setParent(GroupEntry.ROOT_ENTRY).build() .apply { row = mock() } @Before fun setUp() { whenever(groupMembershipManager.getGroupSummary(summary1)).thenReturn(summary1) whenever(groupMembershipManager.getGroupSummary(summary2)).thenReturn(summary2) whenever(groupMembershipManager.getGroupRoot(summary1.entryAdapter)) .thenReturn(summary1.entryAdapter) whenever(groupMembershipManager.getGroupRoot(summary2.entryAdapter)) .thenReturn(summary2.entryAdapter) underTest = GroupExpansionManagerImpl(dumpManager, groupMembershipManager) } Loading Loading @@ -227,15 +221,4 @@ class GroupExpansionManagerTest : SysuiTestCase() { verify(listener).onGroupExpansionChange(summary1.row, false) verifyNoMoreInteractions(listener) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupExpanded() { underTest.setGroupExpanded(summary1.entryAdapter, true) assertThat(underTest.isGroupExpanded(summary1.entryAdapter)).isTrue(); assertThat(underTest.isGroupExpanded( (entries[0] as? GroupEntry)?.getChildren()?.get(0)?.entryAdapter)) .isTrue(); } }
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/GroupMembershipManagerTest.kt +29 −8 Original line number Diff line number Diff line Loading @@ -170,7 +170,28 @@ class GroupMembershipManagerTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isChildEntryAdapterInGroup_child() { fun isGroupRoot_topLevelEntry() { val entry = NotificationEntryBuilder().setParent(GroupEntry.ROOT_ENTRY).build() assertThat(underTest.isGroupRoot(entry.entryAdapter)).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_summary() { val groupKey = "group" val summary = NotificationEntryBuilder() .setGroup(mContext, groupKey) .setGroupSummary(mContext, true) .build() GroupEntryBuilder().setKey(groupKey).setSummary(summary).build() assertThat(underTest.isGroupRoot(summary.entryAdapter)).isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_child() { val groupKey = "group" val summary = NotificationEntryBuilder() Loading @@ -180,19 +201,19 @@ class GroupMembershipManagerTest : SysuiTestCase() { val entry = NotificationEntryBuilder().setGroup(mContext, groupKey).build() GroupEntryBuilder().setKey(groupKey).setSummary(summary).addChild(entry).build() assertThat(underTest.isChildInGroup(entry.entryAdapter)).isTrue() assertThat(underTest.isGroupRoot(entry.entryAdapter)).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_topLevelEntry() { fun getGroupRoot_topLevelEntry() { val entry = NotificationEntryBuilder().setParent(GroupEntry.ROOT_ENTRY).build() assertThat(underTest.isGroupRoot(entry.entryAdapter)).isFalse() assertThat(underTest.getGroupRoot(entry.entryAdapter)).isNull() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_summary() { fun getGroupRoot_summary() { val groupKey = "group" val summary = NotificationEntryBuilder() Loading @@ -201,12 +222,12 @@ class GroupMembershipManagerTest : SysuiTestCase() { .build() GroupEntryBuilder().setKey(groupKey).setSummary(summary).build() assertThat(underTest.isGroupRoot(summary.entryAdapter)).isTrue() assertThat(underTest.getGroupRoot(summary.entryAdapter)).isEqualTo(summary.entryAdapter) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_child() { fun getGroupRoot_child() { val groupKey = "group" val summary = NotificationEntryBuilder() Loading @@ -216,6 +237,6 @@ class GroupMembershipManagerTest : SysuiTestCase() { val entry = NotificationEntryBuilder().setGroup(mContext, groupKey).build() GroupEntryBuilder().setKey(groupKey).setSummary(summary).addChild(entry).build() assertThat(underTest.isGroupRoot(entry.entryAdapter)).isFalse() assertThat(underTest.getGroupRoot(entry.entryAdapter)).isEqualTo(summary.entryAdapter) } }
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenterTest.kt +8 −61 Original line number Diff line number Diff line Loading @@ -54,7 +54,6 @@ import com.android.systemui.statusbar.notification.interruption.VisualInterrupti import com.android.systemui.statusbar.notification.interruption.VisualInterruptionRefactor import com.android.systemui.statusbar.notification.interruption.VisualInterruptionType import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.shared.NotificationBundleUi import com.android.systemui.statusbar.notification.stack.notificationStackScrollLayoutController import com.android.systemui.statusbar.notification.visualInterruptionDecisionProvider import com.android.systemui.statusbar.notificationLockscreenUserManager Loading Loading @@ -294,7 +293,6 @@ class StatusBarNotificationPresenterTest : SysuiTestCase() { @Test @EnableSceneContainer @DisableFlags(NotificationBundleUi.FLAG_NAME) fun testExpandSensitiveNotification_onLockScreen_opensShade() = kosmos.runTest { // Given we are on the keyguard Loading @@ -305,35 +303,11 @@ class StatusBarNotificationPresenterTest : SysuiTestCase() { ) // When the user expands a sensitive Notification val row = createRow(createNotificationEntry()) val row = createRow() val entry = row.entry.apply { setSensitive(/* sensitive= */ true, /* deviceSensitive= */ true) } underTest.onExpandClicked(row.entry, mock(), /* nowExpanded= */ true) // Then we open the locked shade verify(kosmos.lockscreenShadeTransitionController) // Explicit parameters to avoid issues with Kotlin default arguments in Mockito .goToLockedShade(row, true) } @Test @EnableSceneContainer @EnableFlags(NotificationBundleUi.FLAG_NAME) fun testExpandSensitiveNotification_onLockScreen_opensShade_entryAdapter() = kosmos.runTest { // Given we are on the keyguard kosmos.sysuiStatusBarStateController.state = StatusBarState.KEYGUARD // And the device is locked kosmos.fakeAuthenticationRepository.setAuthenticationMethod( AuthenticationMethodModel.Pin ) // When the user expands a sensitive Notification val entry = createNotificationEntry() val row = createRow(entry) entry.setSensitive(/* sensitive= */ true, /* deviceSensitive= */ true) underTest.onExpandClicked(row, row.entryAdapter, /* nowExpanded= */ true) underTest.onExpandClicked(entry, mock(), /* nowExpanded= */ true) // Then we open the locked shade verify(kosmos.lockscreenShadeTransitionController) Loading @@ -343,7 +317,6 @@ class StatusBarNotificationPresenterTest : SysuiTestCase() { @Test @EnableSceneContainer @DisableFlags(NotificationBundleUi.FLAG_NAME) fun testExpandSensitiveNotification_onLockedShade_showsBouncer() = kosmos.runTest { // Given we are on the locked shade Loading @@ -355,7 +328,7 @@ class StatusBarNotificationPresenterTest : SysuiTestCase() { // When the user expands a sensitive Notification val entry = createRow(createNotificationEntry()).entry.apply { createRow().entry.apply { setSensitive(/* sensitive= */ true, /* deviceSensitive= */ true) } underTest.onExpandClicked(entry, mock(), /* nowExpanded= */ true) Loading @@ -364,29 +337,6 @@ class StatusBarNotificationPresenterTest : SysuiTestCase() { verify(kosmos.activityStarter).dismissKeyguardThenExecute(any(), eq(null), eq(false)) } @Test @EnableSceneContainer @EnableFlags(NotificationBundleUi.FLAG_NAME) fun testExpandSensitiveNotification_onLockedShade_showsBouncer_entryAdapter() = kosmos.runTest { // Given we are on the locked shade kosmos.sysuiStatusBarStateController.state = StatusBarState.SHADE_LOCKED // And the device is locked kosmos.fakeAuthenticationRepository.setAuthenticationMethod( AuthenticationMethodModel.Pin ) // When the user expands a sensitive Notification val entry = createNotificationEntry() val row = createRow(entry) entry.setSensitive(/* sensitive= */ true, /* deviceSensitive= */ true) underTest.onExpandClicked(row, row.entryAdapter, /* nowExpanded= */ true) // Then we show the bouncer verify(kosmos.activityStarter).dismissKeyguardThenExecute(any(), eq(null), eq(false)) } private fun createPresenter(): StatusBarNotificationPresenter { val initController: InitController = InitController() return StatusBarNotificationPresenter( Loading Loading @@ -448,13 +398,10 @@ class StatusBarNotificationPresenterTest : SysuiTestCase() { interruptSuppressor = suppressorCaptor.lastValue } private fun createRow(entry: NotificationEntry): ExpandableNotificationRow { private fun createRow(): ExpandableNotificationRow { val row: ExpandableNotificationRow = mock() if (NotificationBundleUi.isEnabled) { whenever(row.entryAdapter).thenReturn(entry.entryAdapter) } else { val entry: NotificationEntry = createNotificationEntry() whenever(row.entry).thenReturn(entry) } entry.row = row return row } Loading