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

Unified Diff: content/public/android/java/src/org/chromium/content_public/browser/MediaSessionObserver.java

Issue 2831223002: [Media>UI] Migrate media notification tests to JUnit tests (Closed)
Patch Set: fixed tests 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
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTitleUpdatedTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content_public/browser/MediaSessionObserver.java
diff --git a/content/public/android/java/src/org/chromium/content_public/browser/MediaSessionObserver.java b/content/public/android/java/src/org/chromium/content_public/browser/MediaSessionObserver.java
index b6235e3ec13976be7f29a54d5454cbd7e41f8d19..83ecd407a7e7c281ede31c22b07a4921eab308c6 100644
--- a/content/public/android/java/src/org/chromium/content_public/browser/MediaSessionObserver.java
+++ b/content/public/android/java/src/org/chromium/content_public/browser/MediaSessionObserver.java
@@ -23,6 +23,13 @@ public abstract class MediaSessionObserver {
* Construct a MediaSessionObserver and start observing |mediaSession|.
*/
protected MediaSessionObserver(MediaSession mediaSession) {
+ // In tests, the MediaSession might be a mocked object which is not instance of
+ // MediaSessionImpl.
+ //
+ // TODO(mlamouri): move addObserver()/removeObserver() methods to the {@link MediaSession}
+ // class so that we don't need this type check?
+ if (!(mediaSession instanceof MediaSessionImpl)) return;
+
mMediaSession = (MediaSessionImpl) mediaSession;
mMediaSession.addObserver(this);
}
« no previous file with comments | « chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationTitleUpdatedTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698