use of android.app.people.ConversationChannel in project android_packages_apps_Settings by omnirom.
the class RecentConversationsPreferenceControllerTest method testCreatesChannel.
@Test
public void testCreatesChannel() {
ShortcutInfo si = mock(ShortcutInfo.class);
when(si.getId()).thenReturn("person");
when(si.getPackage()).thenReturn("pkg");
ConversationChannel ccw = new ConversationChannel(si, 6, new NotificationChannel("hi", "channel", 4), new NotificationChannelGroup("hi", "group"), 7, true);
Preference pref = mController.createConversationPref(new PreferenceCategory(mContext), ccw, 100);
try {
pref.performClick();
} catch (RuntimeException e) {
// expected since it tries to launch an activity
}
verify(mBackend).createConversationNotificationChannel(si.getPackage(), ccw.getUid(), ccw.getNotificationChannel(), si.getId());
}
use of android.app.people.ConversationChannel in project android_packages_apps_Settings by omnirom.
the class RecentConversationsPreferenceControllerTest method testNonremoveableConversation.
@Test
public void testNonremoveableConversation() throws Exception {
ShortcutInfo si = mock(ShortcutInfo.class);
when(si.getId()).thenReturn("person");
when(si.getPackage()).thenReturn("pkg");
ConversationChannel ccw = new ConversationChannel(si, 6, new NotificationChannel("hi", "channel", 4), new NotificationChannelGroup("hi", "group"), 7, true);
RecentConversationPreference pref = (RecentConversationPreference) mController.createConversationPref(new PreferenceCategory(mContext), ccw, 100);
assertThat(pref.hasClearListener()).isFalse();
}
use of android.app.people.ConversationChannel in project android_packages_apps_Settings by omnirom.
the class RecentConversationsPreferenceControllerTest method testPopulateList_onlyNonremoveableConversations.
@Test
public void testPopulateList_onlyNonremoveableConversations() {
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
PreferenceScreen ps = preferenceManager.createPreferenceScreen(mContext);
PreferenceCategory outerContainer = spy(new PreferenceCategory(mContext));
ps.addPreference(outerContainer);
ConversationChannel ccw = new ConversationChannel(mock(ShortcutInfo.class), 6, new NotificationChannel("hi", "hi", 4), new NotificationChannelGroup("hi", "hi"), 7, true);
ArrayList<ConversationChannel> list = new ArrayList<>();
list.add(ccw);
mController.populateList(list, outerContainer);
// one for the preference, none for 'clear all'
verify(outerContainer, times(1)).addPreference(any());
}
use of android.app.people.ConversationChannel in project android_packages_apps_Settings by omnirom.
the class RecentConversationsPreferenceControllerTest method populateConversations_blocked.
@Test
public void populateConversations_blocked() {
PreferenceCategory container = mock(PreferenceCategory.class);
ConversationChannel ccw = new ConversationChannel(mock(ShortcutInfo.class), 6, new NotificationChannel("hi", "hi", 4), new NotificationChannelGroup("hi", "hi"), 7, false);
ConversationChannel ccw2 = new ConversationChannel(mock(ShortcutInfo.class), 6, new NotificationChannel("hi", "hi", 0), new NotificationChannelGroup("hi", "hi"), 7, false);
NotificationChannelGroup blockedGroup = new NotificationChannelGroup("hi", "hi");
blockedGroup.setBlocked(true);
ConversationChannel ccw3 = new ConversationChannel(mock(ShortcutInfo.class), 6, new NotificationChannel("hi", "hi", 4), blockedGroup, 7, false);
ArrayList<ConversationChannel> list = new ArrayList<>();
list.add(ccw);
list.add(ccw2);
list.add(ccw3);
mController.populateConversations(list, container);
verify(container, times(1)).addPreference(any());
}
Aggregations