Fixed test failures for notification comparator

Test: runtest systemui-notification
Change-Id: I16e6142c99553d541d09390142cd16bbdfa724d2
This commit is contained in:
Selim Cinek
2017-02-06 13:32:47 -08:00
parent 9363c69542
commit 3f146d0de2

View File

@@ -112,6 +112,7 @@ public class NotificationComparatorTest {
Notification n2 = new Notification.Builder(mContext)
.setCategory(Notification.CATEGORY_CALL)
.setFlag(Notification.FLAG_FOREGROUND_SERVICE, true)
.setColorized(true /* colorized */)
.build();
mRecordHighCall = new NotificationRecord(mContext, new StatusBarNotification(callPkg,
callPkg, 1, "highcall", callUid, callUid, n2,
@@ -186,10 +187,10 @@ public class NotificationComparatorTest {
final List<NotificationRecord> expected = new ArrayList<>();
expected.add(mRecordHighCall);
expected.add(mRecordDefaultMedia);
expected.add(mRecordStarredContact);
expected.add(mRecordContact);
expected.add(mRecordInlineReply);
expected.add(mRecordSms);
expected.add(mRecordStarredContact);
expected.add(mRecordContact);
expected.add(mRecordEmail);
expected.add(mRecordUrgent);
expected.add(mRecordCheater);
@@ -207,14 +208,19 @@ public class NotificationComparatorTest {
@Test
public void testMessaging() throws Exception {
NotificationComparator comp = new NotificationComparator(mContext);
assertTrue(comp.isImportantMessaging(mRecordStarredContact));
assertTrue(comp.isImportantMessaging(mRecordContact));
assertTrue(comp.isImportantMessaging(mRecordInlineReply));
assertTrue(comp.isImportantMessaging(mRecordSms));
assertFalse(comp.isImportantMessaging(mRecordEmail));
assertFalse(comp.isImportantMessaging(mRecordCheater));
}
@Test
public void testPeople() throws Exception {
NotificationComparator comp = new NotificationComparator(mContext);
assertTrue(comp.isImportantPeople(mRecordStarredContact));
assertTrue(comp.isImportantPeople(mRecordContact));
}
private NotificationChannel getDefaultChannel() {
return new NotificationChannel(NotificationChannel.DEFAULT_CHANNEL_ID, "name",
NotificationManager.IMPORTANCE_LOW);