use of android.app.usage.UsageEvents.Event in project android_packages_apps_Settings by omnirom.
the class AppStateNotificationBridgeTest method testGetAggregatedUsageEvents_onlyNotificationEvents.
@Test
public void testGetAggregatedUsageEvents_onlyNotificationEvents() throws Exception {
List<Event> events = new ArrayList<>();
Event good = new Event();
good.mEventType = Event.NOTIFICATION_INTERRUPTION;
good.mPackage = PKG1;
good.mTimeStamp = 1;
events.add(good);
Event bad = new Event();
bad.mEventType = Event.CHOOSER_ACTION;
bad.mPackage = PKG1;
bad.mTimeStamp = 2;
events.add(bad);
UsageEvents usageEvents = getUsageEvents(events);
when(mUsageStats.queryEventsForUser(anyLong(), anyLong(), anyInt(), anyString())).thenReturn(usageEvents);
Map<String, NotificationsSentState> map = mBridge.getAggregatedUsageEvents();
assertThat(map.get(AppStateNotificationBridge.getKey(0, PKG1)).sentCount).isEqualTo(1);
}
Aggregations