Merge "Notification settings updates" into pi-dev am: d7a1c39694
am: 88fa6fd0fb
Change-Id: I5771abecd37d732e11dbf9c7f1c31ac6b7993d6c
This commit is contained in:
@@ -109,6 +109,11 @@ public class HeaderPreferenceControllerTest {
|
||||
NotificationChannel channel = new NotificationChannel("cid", "cname", IMPORTANCE_NONE);
|
||||
mController.onResume(appRow, channel, group, null);
|
||||
assertEquals(channel.getName(), mController.getLabel());
|
||||
|
||||
NotificationChannel defaultChannel = new NotificationChannel(
|
||||
NotificationChannel.DEFAULT_CHANNEL_ID, "", IMPORTANCE_NONE);
|
||||
mController.onResume(appRow, defaultChannel, null, null);
|
||||
assertEquals(appRow.label, mController.getLabel());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -130,5 +135,10 @@ public class HeaderPreferenceControllerTest {
|
||||
mController.onResume(appRow, channel, null, null);
|
||||
assertFalse(mController.getSummary().toString().contains(group.getName()));
|
||||
assertTrue(mController.getSummary().toString().contains(appRow.label));
|
||||
|
||||
NotificationChannel defaultChannel = new NotificationChannel(
|
||||
NotificationChannel.DEFAULT_CHANNEL_ID, "", IMPORTANCE_NONE);
|
||||
mController.onResume(appRow, defaultChannel, null, null);
|
||||
assertEquals("", mController.getSummary());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,6 +294,30 @@ public class NotificationPreferenceControllerTest {
|
||||
assertTrue(mController.isChannelGroupBlockable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsDefaultChannel_noChannel() {
|
||||
mController.onResume(mock(NotificationBackend.AppRow.class), null, null, null);
|
||||
|
||||
assertFalse(mController.isDefaultChannel());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsDefaultChannel_nonDefaultChannel() {
|
||||
NotificationChannel channel = mock(NotificationChannel.class);
|
||||
mController.onResume(mock(NotificationBackend.AppRow.class), channel, null, null);
|
||||
|
||||
assertFalse(mController.isDefaultChannel());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsDefaultChannel() {
|
||||
NotificationChannel channel = mock(NotificationChannel.class);
|
||||
when(channel.getId()).thenReturn(NotificationChannel.DEFAULT_CHANNEL_ID);
|
||||
mController.onResume(mock(NotificationBackend.AppRow.class), channel, null, null);
|
||||
|
||||
assertTrue(mController.isDefaultChannel());
|
||||
}
|
||||
|
||||
private final class TestPreferenceController extends NotificationPreferenceController {
|
||||
|
||||
private TestPreferenceController(Context context, NotificationBackend backend) {
|
||||
|
||||
Reference in New Issue
Block a user