Fix test in RemoteVolumeGroupControllerTest
The failure was caused by ag/24081083. Bug: 292920056 Bug: 192657812 Test: atest RemoteVolumeGroupControllerTest Change-Id: Iac59b69dd49b4873a72081ae5776fc2f451bbb10
This commit is contained in:
@@ -31,6 +31,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageStats;
|
import android.content.pm.PackageStats;
|
||||||
|
import android.media.MediaRoute2Info;
|
||||||
import android.media.MediaRouter2Manager;
|
import android.media.MediaRouter2Manager;
|
||||||
import android.media.RoutingSessionInfo;
|
import android.media.RoutingSessionInfo;
|
||||||
import android.media.session.MediaSessionManager;
|
import android.media.session.MediaSessionManager;
|
||||||
@@ -83,6 +84,8 @@ public class RemoteVolumeGroupControllerTest {
|
|||||||
private SharedPreferences mSharedPreferences;
|
private SharedPreferences mSharedPreferences;
|
||||||
@Mock
|
@Mock
|
||||||
private MediaSessionManager mMediaSessionManager;
|
private MediaSessionManager mMediaSessionManager;
|
||||||
|
@Mock
|
||||||
|
private MediaRouter2Manager mRouterManager;
|
||||||
|
|
||||||
private final List<RoutingSessionInfo> mRoutingSessionInfos = new ArrayList<>();
|
private final List<RoutingSessionInfo> mRoutingSessionInfos = new ArrayList<>();
|
||||||
|
|
||||||
@@ -102,7 +105,7 @@ public class RemoteVolumeGroupControllerTest {
|
|||||||
Context.MEDIA_SESSION_SERVICE);
|
Context.MEDIA_SESSION_SERVICE);
|
||||||
mController = new RemoteVolumeGroupController(mContext, KEY_REMOTE_VOLUME_GROUP);
|
mController = new RemoteVolumeGroupController(mContext, KEY_REMOTE_VOLUME_GROUP);
|
||||||
mController.mLocalMediaManager = mLocalMediaManager;
|
mController.mLocalMediaManager = mLocalMediaManager;
|
||||||
mController.mRouterManager = mock(MediaRouter2Manager.class);
|
mController.mRouterManager = mRouterManager;
|
||||||
mPreferenceCategory = spy(new PreferenceCategory(mContext));
|
mPreferenceCategory = spy(new PreferenceCategory(mContext));
|
||||||
mPreferenceCategory.setKey(mController.getPreferenceKey());
|
mPreferenceCategory.setKey(mController.getPreferenceKey());
|
||||||
|
|
||||||
@@ -178,6 +181,10 @@ public class RemoteVolumeGroupControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void displayPreference_withActiveSession_checkSwitcherPreferenceTitle() {
|
public void displayPreference_withActiveSession_checkSwitcherPreferenceTitle() {
|
||||||
|
// Preference title needs media output to be enabled.
|
||||||
|
when(mRouterManager.getTransferableRoutes(TEST_PACKAGE_NAME)).thenReturn(List.of(mock(
|
||||||
|
MediaRoute2Info.class)));
|
||||||
|
|
||||||
initPackage();
|
initPackage();
|
||||||
mShadowPackageManager.addPackage(mPackageInfo, mPackageStats);
|
mShadowPackageManager.addPackage(mPackageInfo, mPackageStats);
|
||||||
mController.displayPreference(mScreen);
|
mController.displayPreference(mScreen);
|
||||||
|
|||||||
Reference in New Issue
Block a user