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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java

Issue 1066863004: Add unit tests for media.remote.AbstractMediaRouteController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments, test name, better add/removeMediaStateListener testing Created 5 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/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java
index 7fb0a749bff52aab5deac24d0343ccf3e8d5066b..d030963088027cb17e4c10cd02db806b0e84c8a6 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/remote/AbstractMediaRouteController.java
@@ -20,6 +20,7 @@
import org.chromium.base.ApplicationStatus;
import org.chromium.base.CommandLine;
+import org.chromium.base.VisibleForTesting;
import org.chromium.chrome.ChromeSwitches;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.media.remote.RemoteVideoInfo.PlayerState;
@@ -485,13 +486,8 @@ protected void stopWatchingRouteSelection() {
}
}
- protected void updateState(int state) {
- if (mDebug) {
- Log.d(TAG, "updateState oldState: " + this.mPlaybackState + " newState: " + state);
- }
-
- PlayerState oldState = this.mPlaybackState;
-
+ @VisibleForTesting
+ void setPlayerStateForMediaItemState(int state) {
PlayerState playerState = PlayerState.STOPPED;
switch (state) {
case MediaItemStatus.PLAYBACK_STATE_BUFFERING:
@@ -526,13 +522,22 @@ protected void updateState(int state) {
break;
}
- this.mPlaybackState = playerState;
+ mPlaybackState = playerState;
+ }
+
+ protected void updateState(int state) {
+ if (mDebug) {
+ Log.d(TAG, "updateState oldState: " + mPlaybackState + " newState: " + state);
+ }
+
+ PlayerState oldState = mPlaybackState;
+ setPlayerStateForMediaItemState(state);
for (UiListener listener : mUiListeners) {
- listener.onPlaybackStateChanged(oldState, playerState);
+ listener.onPlaybackStateChanged(oldState, mPlaybackState);
}
- if (mMediaStateListener != null) mMediaStateListener.onPlaybackStateChanged(playerState);
+ if (mMediaStateListener != null) mMediaStateListener.onPlaybackStateChanged(mPlaybackState);
if (oldState != mPlaybackState) {
// We need to persist our state in case we get killed.
« no previous file with comments | « chrome/android/BUILD.gn ('k') | chrome/android/java/src/org/chromium/chrome/browser/media/remote/MediaRouteController.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698