Search in sources :

Example 21 with RouteInfo

use of android.media.MediaRouter.RouteInfo in project robolectric by robolectric.

the class ShadowMediaRouterTest method testSelectBluetoothRoute_getsSetAsSelectedRoute.

@Test
public void testSelectBluetoothRoute_getsSetAsSelectedRoute() {
    // Although this isn't something faked out by the shadow we should ensure that the Bluetooth
    // route can be selected after it's been added.
    shadowOf(mediaRouter).addBluetoothRoute();
    RouteInfo bluetoothRoute = mediaRouter.getRouteAt(1);
    mediaRouter.selectRoute(ROUTE_TYPE_LIVE_AUDIO, bluetoothRoute);
    assertThat(mediaRouter.getSelectedRoute(ROUTE_TYPE_LIVE_AUDIO)).isEqualTo(bluetoothRoute);
}
Also used : RouteInfo(android.media.MediaRouter.RouteInfo) Test(org.junit.Test)

Example 22 with RouteInfo

use of android.media.MediaRouter.RouteInfo in project robolectric by robolectric.

the class ShadowMediaRouterTest method testAddBluetoothRoute_checkBluetoothRouteProperties_apiJbMr2.

@Test
@Config(minSdk = JELLY_BEAN_MR2)
public void testAddBluetoothRoute_checkBluetoothRouteProperties_apiJbMr2() {
    shadowOf(mediaRouter).addBluetoothRoute();
    RouteInfo bluetoothRoute = mediaRouter.getRouteAt(1);
    assertThat(bluetoothRoute.getDescription().toString()).isEqualTo("Bluetooth audio");
}
Also used : RouteInfo(android.media.MediaRouter.RouteInfo) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 23 with RouteInfo

use of android.media.MediaRouter.RouteInfo in project robolectric by robolectric.

the class ShadowMediaRouterTest method testIsBluetoothRouteSelected_bluetoothRouteSelectedForDifferentType_returnsFalse.

@Test
@Config(minSdk = JELLY_BEAN_MR1)
public void testIsBluetoothRouteSelected_bluetoothRouteSelectedForDifferentType_returnsFalse() {
    shadowOf(mediaRouter).addBluetoothRoute();
    RouteInfo bluetoothRoute = mediaRouter.getRouteAt(1);
    // Select the Bluetooth route for AUDIO and the default route for AUDIO.
    mediaRouter.selectRoute(ROUTE_TYPE_LIVE_AUDIO, bluetoothRoute);
    mediaRouter.selectRoute(ROUTE_TYPE_LIVE_VIDEO, getDefaultRoute());
    assertThat(shadowOf(mediaRouter).isBluetoothRouteSelected(ROUTE_TYPE_LIVE_VIDEO)).isFalse();
}
Also used : RouteInfo(android.media.MediaRouter.RouteInfo) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 24 with RouteInfo

use of android.media.MediaRouter.RouteInfo in project android_frameworks_base by ParanoidAndroid.

the class MediaRouteButton method updateRemoteIndicator.

void updateRemoteIndicator() {
    final RouteInfo selected = mRouter.getSelectedRoute(mRouteTypes);
    final boolean isRemote = selected != mRouter.getDefaultRoute();
    final boolean isConnecting = selected != null && selected.getStatusCode() == RouteInfo.STATUS_CONNECTING;
    boolean needsRefresh = false;
    if (mRemoteActive != isRemote) {
        mRemoteActive = isRemote;
        needsRefresh = true;
    }
    if (mIsConnecting != isConnecting) {
        mIsConnecting = isConnecting;
        needsRefresh = true;
    }
    if (needsRefresh) {
        refreshDrawableState();
    }
}
Also used : RouteInfo(android.media.MediaRouter.RouteInfo)

Example 25 with RouteInfo

use of android.media.MediaRouter.RouteInfo in project android_frameworks_base by AOSPA.

the class CastControllerImpl method startCasting.

@Override
public void startCasting(CastDevice device) {
    if (device == null || device.tag == null)
        return;
    final RouteInfo route = (RouteInfo) device.tag;
    if (DEBUG)
        Log.d(TAG, "startCasting: " + routeToString(route));
    mMediaRouter.selectRoute(ROUTE_TYPE_REMOTE_DISPLAY, route);
}
Also used : RouteInfo(android.media.MediaRouter.RouteInfo)

Aggregations

RouteInfo (android.media.MediaRouter.RouteInfo)33 Test (org.junit.Test)8 ArraySet (android.util.ArraySet)5 Config (org.robolectric.annotation.Config)3 RouteGroup (android.media.MediaRouter.RouteGroup)1 Display (android.view.Display)1 WindowManager (android.view.WindowManager)1