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

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

Issue 2816603002: Adding JUnit tests for MediaNotificationManager (Closed)
Patch Set: rebased 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/MediaNotificationTestShadowNotificationManager.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestShadowNotificationManager.java b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestShadowNotificationManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..d42c637be75495bf8913adfa0d7c9c813870e895
--- /dev/null
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTestShadowNotificationManager.java
@@ -0,0 +1,33 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.media.ui;
+
+import static org.mockito.Mockito.mock;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.shadows.ShadowNotificationManager;
+
+/**
+ * Dummy Robolectric shadow for Android NotificationManager for MediaNotification tests.
+ */
+@Implements(NotificationManager.class)
+public class MediaNotificationTestShadowNotificationManager extends ShadowNotificationManager {
+ public static final NotificationManager sMockObserver;
+
+ static {
+ sMockObserver = mock(NotificationManager.class);
+ }
+
+ @Implementation
+ @Override
+ public void notify(int id, Notification notification) {
+ sMockObserver.notify(id, notification);
+ super.notify(id, notification);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698