media/version-compat-tests/previous/service/src/androidTest/java/android/support/mediacompat/service/MediaSessionCompatCallbackTest.java
@Test
    @SmallTest
    public void testCreateSession() throws Exception {
        assertNotNull(mSession.getSessionToken());
        assertFalse("New session should not be active", mSession.isActive());

        // Verify by getting the controller and checking all its fields
        MediaControllerCompat controller = mSession.getController();
        assertNotNull(controller);

        final String errorMsg = "New session has unexpected configuration.";
        assertEquals(errorMsg, 0L, controller.getFlags());
        assertNull(errorMsg, controller.getExtras());
        assertNull(errorMsg, controller.getMetadata());
        assertEquals(errorMsg, getContext().getPackageName(), controller.getPackageName());
        assertNull(errorMsg, controller.getPlaybackState());
        assertNull(errorMsg, controller.getQueue());
        assertNull(errorMsg, controller.getQueueTitle());
        assertEquals(errorMsg, RatingCompat.RATING_NONE, controller.getRatingType());
        assertNull(errorMsg, controller.getSessionActivity());

        assertNotNull(controller.getSessionToken());
        assertNotNull(controller.getTransportControls());

        MediaControllerCompat.PlaybackInfo info = controller.getPlaybackInfo();
        assertNotNull(info);
        assertEquals(errorMsg, MediaControllerCompat.PlaybackInfo.PLAYBACK_TYPE_LOCAL,
                info.getPlaybackType());
        assertEquals(errorMsg, mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC),
                info.getCurrentVolume());
    }
/**
     * Tests that a session can be created and that all the fields are initialized correctly.
     */
Tests that a session can be created and that all the fields are initialized correctly.
Tests that a session can be created and that all the fields are initialized correctly .
@Test
    @SmallTest
    public void testCreateSession() throws Exception {
        assertNotNull(mSession.getSessionToken());
        assertFalse("New session should not be active", mSession.isActive());
        MediaControllerCompat controller = mSession.getController();
        assertNotNull(controller);
        final String errorMsg = "New session has unexpected configuration.";
        assertEquals(errorMsg, 0L, controller.getFlags());
        assertNull(errorMsg, controller.getExtras());
        assertNull(errorMsg, controller.getMetadata());
        assertEquals(errorMsg, getContext().getPackageName(), controller.getPackageName());
        assertNull(errorMsg, controller.getPlaybackState());
        assertNull(errorMsg, controller.getQueue());
        assertNull(errorMsg, controller.getQueueTitle());
        assertEquals(errorMsg, RatingCompat.RATING_NONE, controller.getRatingType());
        assertNull(errorMsg, controller.getSessionActivity());
        assertNotNull(controller.getSessionToken());
        assertNotNull(controller.getTransportControls());
        MediaControllerCompat.PlaybackInfo info = controller.getPlaybackInfo();
        assertNotNull(info);
        assertEquals(errorMsg, MediaControllerCompat.PlaybackInfo.PLAYBACK_TYPE_LOCAL,
                info.getPlaybackType());
        assertEquals(errorMsg, mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC),
                info.getCurrentVolume());
    }
@ Test @ SmallTest public void testCreateSession ( ) throws Exception { assertNotNull ( mSession . getSessionToken ( ) ) ; assertFalse ( "New session should not be active" , mSession . isActive ( ) ) ; MediaControllerCompat controller = mSession . getController ( ) ; assertNotNull ( controller ) ; final String errorMsg = "New session has unexpected configuration." ; assertEquals ( errorMsg , 0L , controller . getFlags ( ) ) ; assertNull ( errorMsg , controller . getExtras ( ) ) ; assertNull ( errorMsg , controller . getMetadata ( ) ) ; assertEquals ( errorMsg , getContext ( ) . getPackageName ( ) , controller . getPackageName ( ) ) ; assertNull ( errorMsg , controller . getPlaybackState ( ) ) ; assertNull ( errorMsg , controller . getQueue ( ) ) ; assertNull ( errorMsg , controller . getQueueTitle ( ) ) ; assertEquals ( errorMsg , RatingCompat . RATING_NONE , controller . getRatingType ( ) ) ; assertNull ( errorMsg , controller . getSessionActivity ( ) ) ; assertNotNull ( controller . getSessionToken ( ) ) ; assertNotNull ( controller . getTransportControls ( ) ) ; MediaControllerCompat . PlaybackInfo info = controller . getPlaybackInfo ( ) ; assertNotNull ( info ) ; assertEquals ( errorMsg , MediaControllerCompat . PlaybackInfo . PLAYBACK_TYPE_LOCAL , info . getPlaybackType ( ) ) ; assertEquals ( errorMsg , mAudioManager . getStreamVolume ( AudioManager . STREAM_MUSIC ) , info . getCurrentVolume ( ) ) ; }
Tests that a session can be created and that all the fields are initialized correctly.
Tests that a session can be created and that all the fields are initialized correctly .
// Verify by getting the controller and checking all its fields