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

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

Issue 2833583004: [Android] Log notification shown/blocked for all other notifications (Closed)
Patch Set: Verify media notifications not logged in other test cases 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 64f6105ce61f84fb11f34e56948c95fda9877a3d..d1a0282677bac7b69afbf551055b37f51ad8c5ec 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
@@ -152,10 +157,11 @@ public class MediaNotificationManagerServiceLifecycleTest extends MediaNotificat
verify(mMockAppHooks, never()).startForegroundService(any(Intent.class));
verify(mMockContext, never()).startService(any(Intent.class));
verify(getManager()).updateNotification();
+ verify(mMockUmaTracker, never()).onNotificationShown(anyInt(), anyString());
}
@Test
- public void testShowNotificationBeforeServiceCreatedUpdatesNotificationInfo() {
+ public void testShowNotificationBeforeServiceCreatedUpdatesNotificationInfoAndLogsUma() {
doCallRealMethod().when(getManager()).onServiceStarted(any(ListenerService.class));
doNothing().when(getManager()).updateNotification();
@@ -189,6 +195,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