Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4e21751 authored by Iván Budnik's avatar Iván Budnik Committed by Android (Google) Code Review
Browse files

Merge "Remove fake package name from MediaOutputControllerTest" into main

parents 25cd8799 c797cb1c
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -98,8 +98,6 @@ import java.util.List;
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper(setAsMainLooper = true)
public class MediaOutputControllerTest extends SysuiTestCase {

    private static final String TEST_PACKAGE_NAME = "com.test.package.name";
    private static final String TEST_DEVICE_1_ID = "test_device_1_id";
    private static final String TEST_DEVICE_2_ID = "test_device_2_id";
    private static final String TEST_DEVICE_3_ID = "test_device_3_id";
@@ -167,6 +165,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
    final Notification mNotification = mock(Notification.class);

    private Context mSpyContext;
    private String mPackageName = null;
    private MediaOutputController mMediaOutputController;
    private LocalMediaManager mLocalMediaManager;
    private List<MediaController> mMediaControllers = new ArrayList<>();
@@ -177,12 +176,14 @@ public class MediaOutputControllerTest extends SysuiTestCase {

    @Before
    public void setUp() {
        mPackageName = mContext.getPackageName();

        MockitoAnnotations.initMocks(this);
        mContext.setMockPackageManager(mPackageManager);
        mSpyContext = spy(mContext);
        final UserHandle userHandle = mock(UserHandle.class);
        when(mUserTracker.getUserHandle()).thenReturn(userHandle);
        when(mSessionMediaController.getPackageName()).thenReturn(TEST_PACKAGE_NAME);
        when(mSessionMediaController.getPackageName()).thenReturn(mPackageName);
        when(mSessionMediaController.getPlaybackState()).thenReturn(mPlaybackState);
        mMediaControllers.add(mSessionMediaController);
        when(mMediaSessionManager.getActiveSessionsForUser(any(),
@@ -193,7 +194,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
        when(mLocalBluetoothManager.getCachedDeviceManager()).thenReturn(
                mCachedBluetoothDeviceManager);

        mMediaOutputController = new MediaOutputController(mSpyContext, TEST_PACKAGE_NAME,
        mMediaOutputController = new MediaOutputController(mSpyContext, mPackageName,
                mMediaSessionManager, mLocalBluetoothManager, mStarter,
                mNotifCollection, mDialogLaunchAnimator,
                mNearbyMediaDevicesManager, mAudioManager, mPowerExemptionManager,
@@ -231,7 +232,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
        when(mNotifCollection.getAllNotifs()).thenReturn(entryList);
        when(entry.getSbn()).thenReturn(sbn);
        when(sbn.getNotification()).thenReturn(mNotification);
        when(sbn.getPackageName()).thenReturn(TEST_PACKAGE_NAME);
        when(sbn.getPackageName()).thenReturn(mPackageName);
        mNotification.extras = bundle;
        when(bundle.getParcelable(Notification.EXTRA_MEDIA_SESSION,
                MediaSession.Token.class)).thenReturn(token);
@@ -339,8 +340,8 @@ public class MediaOutputControllerTest extends SysuiTestCase {
    public void tryToLaunchMediaApplication_intentNotNull_startActivity() {
        when(mDialogLaunchAnimator.createActivityLaunchController(any(View.class))).thenReturn(
                mController);
        Intent intent = new Intent(TEST_PACKAGE_NAME);
        doReturn(intent).when(mPackageManager).getLaunchIntentForPackage(TEST_PACKAGE_NAME);
        Intent intent = new Intent(mPackageName);
        doReturn(intent).when(mPackageManager).getLaunchIntentForPackage(mPackageName);
        mMediaOutputController.start(mCallback);

        mMediaOutputController.tryToLaunchMediaApplication(mDialogLaunchView);
@@ -355,7 +356,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
                mController);
        mMediaOutputController.start(mCallback);
        when(mLocalMediaManager.getLinkedItemComponentName()).thenReturn(
                new ComponentName(TEST_PACKAGE_NAME, ""));
                new ComponentName(mPackageName, ""));

        mMediaOutputController.tryToLaunchInAppRoutingIntent(TEST_DEVICE_1_ID, mDialogLaunchView);

@@ -891,7 +892,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
        when(mNotifCollection.getAllNotifs()).thenReturn(entryList);
        when(entry.getSbn()).thenReturn(sbn);
        when(sbn.getNotification()).thenReturn(notification);
        when(sbn.getPackageName()).thenReturn(TEST_PACKAGE_NAME);
        when(sbn.getPackageName()).thenReturn(mPackageName);
        when(notification.isMediaNotification()).thenReturn(true);
        when(notification.getLargeIcon()).thenReturn(null);

@@ -910,7 +911,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
        when(mNotifCollection.getAllNotifs()).thenReturn(entryList);
        when(entry.getSbn()).thenReturn(sbn);
        when(sbn.getNotification()).thenReturn(notification);
        when(sbn.getPackageName()).thenReturn(TEST_PACKAGE_NAME);
        when(sbn.getPackageName()).thenReturn(mPackageName);
        when(notification.isMediaNotification()).thenReturn(true);
        when(notification.getLargeIcon()).thenReturn(icon);

@@ -929,7 +930,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
        when(mNotifCollection.getAllNotifs()).thenReturn(entryList);
        when(entry.getSbn()).thenReturn(sbn);
        when(sbn.getNotification()).thenReturn(notification);
        when(sbn.getPackageName()).thenReturn(TEST_PACKAGE_NAME);
        when(sbn.getPackageName()).thenReturn(mPackageName);
        when(notification.isMediaNotification()).thenReturn(false);
        when(notification.getLargeIcon()).thenReturn(icon);

@@ -947,7 +948,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
        when(mNotifCollection.getAllNotifs()).thenReturn(entryList);
        when(entry.getSbn()).thenReturn(sbn);
        when(sbn.getNotification()).thenReturn(notification);
        when(sbn.getPackageName()).thenReturn(TEST_PACKAGE_NAME);
        when(sbn.getPackageName()).thenReturn(mPackageName);
        when(notification.isMediaNotification()).thenReturn(true);
        when(notification.getSmallIcon()).thenReturn(null);

@@ -966,7 +967,7 @@ public class MediaOutputControllerTest extends SysuiTestCase {
        when(mNotifCollection.getAllNotifs()).thenReturn(entryList);
        when(entry.getSbn()).thenReturn(sbn);
        when(sbn.getNotification()).thenReturn(notification);
        when(sbn.getPackageName()).thenReturn(TEST_PACKAGE_NAME);
        when(sbn.getPackageName()).thenReturn(mPackageName);
        when(notification.isMediaNotification()).thenReturn(true);
        when(notification.getSmallIcon()).thenReturn(icon);