Hide block pref on non-configurable channels

Test: robotests
Bug: 109875297
Change-Id: I164ae2e07d178db9e84746e5c59f0968e6c77eae
This commit is contained in:
Julia Reynolds
2018-06-07 15:45:41 -04:00
parent 90c770278e
commit 9e2ec5fa07
3 changed files with 32 additions and 3 deletions

View File

@@ -261,6 +261,34 @@ public class NotificationPreferenceControllerTest {
assertTrue(mController.isChannelBlockable());
}
@Test
public void testIsChannelBlockable_notConfigurable() {
String sameId = "apples";
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = false;
appRow.lockedChannelId = sameId;
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getId()).thenReturn(sameId);
when(channel.getImportance()).thenReturn(IMPORTANCE_DEFAULT);
mController.onResume(appRow, channel, null, null);
assertFalse(mController.isChannelBlockable());
}
@Test
public void testIsChannelBlockable_notConfigurableButBlocked() {
String sameId = "apples";
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.systemApp = false;
appRow.lockedChannelId = sameId;
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getId()).thenReturn(sameId);
when(channel.getImportance()).thenReturn(IMPORTANCE_NONE);
mController.onResume(appRow, channel, null, null);
assertTrue(mController.isChannelBlockable());
}
@Test
public void testIsChannelGroupBlockable_nonSystemBlockable() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();