use of android.service.notification.ConversationChannelWrapper in project android_packages_apps_Settings by omnirom.
the class ConversationListPreferenceControllerTest method populateConversations.
@Test
public void populateConversations() {
PreferenceCategory container = mock(PreferenceCategory.class);
ConversationChannelWrapper ccw = new ConversationChannelWrapper();
ccw.setNotificationChannel(mock(NotificationChannel.class));
ccw.setPkg("pkg");
ccw.setUid(1);
ccw.setShortcutInfo(mock(ShortcutInfo.class));
ConversationChannelWrapper ccwDemoted = new ConversationChannelWrapper();
NotificationChannel demoted = new NotificationChannel("a", "a", 2);
demoted.setDemoted(true);
ccwDemoted.setNotificationChannel(demoted);
ccwDemoted.setPkg("pkg");
ccwDemoted.setUid(1);
ccwDemoted.setShortcutInfo(mock(ShortcutInfo.class));
ArrayList<ConversationChannelWrapper> list = new ArrayList<>();
list.add(ccw);
list.add(ccwDemoted);
mController.populateConversations(list, container);
verify(container, times(1)).addPreference(any());
}
use of android.service.notification.ConversationChannelWrapper in project android_packages_apps_Settings by omnirom.
the class ConversationListPreferenceControllerTest method testPopulateList_validConversations.
@Test
public void testPopulateList_validConversations() {
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
PreferenceScreen ps = preferenceManager.createPreferenceScreen(mContext);
PreferenceCategory outerContainer = spy(new PreferenceCategory(mContext));
ps.addPreference(outerContainer);
ConversationChannelWrapper ccw = new ConversationChannelWrapper();
ccw.setNotificationChannel(mock(NotificationChannel.class));
ccw.setPkg("pkg");
ccw.setUid(1);
ccw.setShortcutInfo(mock(ShortcutInfo.class));
ArrayList<ConversationChannelWrapper> list = new ArrayList<>();
list.add(ccw);
mController.populateList(list, outerContainer);
verify(outerContainer, times(1)).addPreference(any());
}
use of android.service.notification.ConversationChannelWrapper in project android_packages_apps_Settings by omnirom.
the class ConversationListPreferenceControllerTest method getTitle_withShortcut.
@Test
public void getTitle_withShortcut() {
ConversationChannelWrapper ccw = new ConversationChannelWrapper();
NotificationChannel channel = new NotificationChannel("a", "child", 2);
ccw.setNotificationChannel(channel);
ccw.setPkg("pkg");
ccw.setUid(1);
ShortcutInfo si = mock(ShortcutInfo.class);
when(si.getLabel()).thenReturn("conversation name");
ccw.setShortcutInfo(si);
ccw.setGroupLabel("group");
ccw.setParentChannelLabel("parent");
assertThat(mController.getTitle(ccw).toString()).isEqualTo(si.getLabel());
}
use of android.service.notification.ConversationChannelWrapper in project android_packages_apps_Settings by omnirom.
the class ConversationListPreferenceControllerTest method getSummary_noGroup.
@Test
public void getSummary_noGroup() {
ConversationChannelWrapper ccw = new ConversationChannelWrapper();
NotificationChannel channel = new NotificationChannel("a", "child", 2);
ccw.setNotificationChannel(channel);
ccw.setPkg("pkg");
ccw.setUid(1);
ccw.setShortcutInfo(mock(ShortcutInfo.class));
ccw.setParentChannelLabel("parent");
assertThat(mController.getSummary(ccw).toString()).isEqualTo(ccw.getParentChannelLabel());
}
use of android.service.notification.ConversationChannelWrapper in project android_packages_apps_Settings by omnirom.
the class ConversationListPreferenceControllerTest method getTitle_noShortcut.
@Test
public void getTitle_noShortcut() {
ConversationChannelWrapper ccw = new ConversationChannelWrapper();
NotificationChannel channel = new NotificationChannel("a", "child", 2);
ccw.setNotificationChannel(channel);
ccw.setPkg("pkg");
ccw.setUid(1);
ccw.setParentChannelLabel("parent");
assertThat(mController.getTitle(ccw).toString()).isEqualTo(ccw.getNotificationChannel().getName());
}
Aggregations