Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1969)

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationManagerServiceLifecycleTest.java

Issue 2837283003: [Android] Log notification shown/blocked for all other notifications (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationManagerServiceLifecycleTest.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationManagerServiceLifecycleTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationManagerServiceLifecycleTest.java
index 3bef5c52e698133a6a6f5a34a268baedae45d97f..e61931762c42ff238fb49031f51a091f7f746465 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationManagerServiceLifecycleTest.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationManagerServiceLifecycleTest.java
@@ -8,6 +8,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyBoolean;
import static org.mockito.Mockito.anyInt;
@@ -31,6 +32,8 @@ import org.robolectric.annotation.Config;
import org.chromium.base.BaseChromiumApplication;
import org.chromium.chrome.browser.media.ui.MediaNotificationManager.ListenerService;
+import org.chromium.chrome.browser.notifications.ChannelDefinitions;
+import org.chromium.chrome.browser.notifications.NotificationUmaTracker;
import org.chromium.content_public.common.MediaMetadata;
import org.chromium.testing.local.LocalRobolectricTestRunner;
@@ -107,6 +110,7 @@ public class MediaNotificationManagerServiceLifecycleTest extends MediaNotificat
verifyNoMoreInteractions(getManager());
verify(mMockAppHooks, never()).startForegroundService(any(Intent.class));
verify(mMockContext, never()).startService(any(Intent.class));
+ verify(mMockUmaTracker, never()).onNotificationShown(anyInt(), anyString());
}
@Test
@@ -124,6 +128,7 @@ public class MediaNotificationManagerServiceLifecycleTest extends MediaNotificat
verifyNoMoreInteractions(getManager());
verify(mMockAppHooks, never()).startForegroundService(any(Intent.class));
verify(mMockContext, never()).startService(any(Intent.class));
+ verify(mMockUmaTracker, never()).onNotificationShown(anyInt(), anyString());
}
@Test
@@ -151,10 +156,11 @@ public class MediaNotificationManagerServiceLifecycleTest extends MediaNotificat
verify(getManager()).showNotification(newInfo);
verify(mMockAppHooks, never()).startForegroundService(any(Intent.class));
verify(mMockContext).startService(any(Intent.class));
+ verify(mMockUmaTracker, never()).onNotificationShown(anyInt(), anyString());
}
@Test
- public void testShowNotificationBeforeServiceCreatedUpdatesNotificationInfo() {
+ public void testShowNotificationBeforeServiceCreatedUpdatesNotificationInfoAndLogsUma() {
doCallRealMethod().when(getManager()).onServiceStarted(any(ListenerService.class));
doNothing().when(getManager()).updateNotification();
@@ -188,6 +194,9 @@ public class MediaNotificationManagerServiceLifecycleTest extends MediaNotificat
mMockContext.startService(getManager().createIntent());
order.verify(getManager(), times(1)).onServiceStarted(mService);
order.verify(getManager(), times(1)).updateNotification();
+ verify(mMockUmaTracker)
+ .onNotificationShown(
+ NotificationUmaTracker.MEDIA, ChannelDefinitions.CHANNEL_ID_MEDIA);
}
@Test

Powered by Google App Engine
This is Rietveld 408576698