From 46200d722adccfa93c693325861522807e845225 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Tue, 1 Feb 2022 02:31:00 +0000 Subject: [PATCH] Use explicit `when` for legacy group alert tests Test: atest NotificationGroupManagerLegacyTest Bug: 215672545 Change-Id: I53ac658bf26bd8dae51979025f95e410e3fcb059 --- .../NotificationGroupManagerLegacyTest.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerLegacyTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerLegacyTest.java index 5d7b15424fec1..d002cebe5cb1c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerLegacyTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationGroupManagerLegacyTest.java @@ -250,15 +250,17 @@ public class NotificationGroupManagerLegacyTest extends SysuiTestCase { @Notification.GroupAlertBehavior int priorityGroupAlert, @Notification.GroupAlertBehavior int siblingGroupAlert, boolean expectAlertOverride) { + long when = 10000; // Create entries in an order so that the priority entry can be deemed the newest child. NotificationEntry[] siblings = new NotificationEntry[numSiblings]; for (int i = 0; i < numSiblings; i++) { - siblings[i] = mGroupTestHelper.createChildNotification(siblingGroupAlert, i, "sibling"); + siblings[i] = mGroupTestHelper + .createChildNotification(siblingGroupAlert, i, "sibling", ++when); } NotificationEntry priorityEntry = - mGroupTestHelper.createChildNotification(priorityGroupAlert, 0, "priority"); + mGroupTestHelper.createChildNotification(priorityGroupAlert, 0, "priority", ++when); NotificationEntry summaryEntry = - mGroupTestHelper.createSummaryNotification(summaryGroupAlert, 0, "summary"); + mGroupTestHelper.createSummaryNotification(summaryGroupAlert, 0, "summary", ++when); // The priority entry is an important conversation. when(mPeopleNotificationIdentifier.getPeopleNotificationType(eq(priorityEntry))) @@ -322,17 +324,19 @@ public class NotificationGroupManagerLegacyTest extends SysuiTestCase { @Test public void testAlertOverrideWhenUpdatingSummaryAtEnd() { + long when = 10000; int numSiblings = 2; int groupAlert = Notification.GROUP_ALERT_SUMMARY; // Create entries in an order so that the priority entry can be deemed the newest child. NotificationEntry[] siblings = new NotificationEntry[numSiblings]; for (int i = 0; i < numSiblings; i++) { - siblings[i] = mGroupTestHelper.createChildNotification(groupAlert, i, "sibling"); + siblings[i] = + mGroupTestHelper.createChildNotification(groupAlert, i, "sibling", ++when); } NotificationEntry priorityEntry = - mGroupTestHelper.createChildNotification(groupAlert, 0, "priority"); + mGroupTestHelper.createChildNotification(groupAlert, 0, "priority", ++when); NotificationEntry summaryEntry = - mGroupTestHelper.createSummaryNotification(groupAlert, 0, "summary"); + mGroupTestHelper.createSummaryNotification(groupAlert, 0, "summary", ++when); // The priority entry is an important conversation. when(mPeopleNotificationIdentifier.getPeopleNotificationType(eq(priorityEntry)))