FileDocCategorySizeDatePackage
MediaPlayerSeekToStateUnitTest.javaAPI DocAndroid 5.1 API2489Thu Mar 12 22:22:30 GMT 2015com.android.mediaframeworktest.unit

MediaPlayerSeekToStateUnitTest

public class MediaPlayerSeekToStateUnitTest extends android.test.AndroidTestCase implements MediaPlayerMethodUnderTest
Unit test class to test the set of valid and invalid states that MediaPlayer.seekTo() method can be called.

Fields Summary
private MediaPlayerStateUnitTestTemplate
mTestTemplate
Constructors Summary
Methods Summary
public voidcheckStateErrors(MediaPlayerStateErrors stateErrors)
1. It is valid to call seekTo() in the following states: {Prepared, Started, Paused, PlaybackComplted}. 2. It is invalid to call seekTo() in the following states: {Idle, Initialized, Stopped, Error}

param
stateErrors the MediaPlayerStateErrors to check against.

 
                                                        
        
        // Valid states.
        assertTrue(!stateErrors.errorInPreparedState);
        assertTrue(!stateErrors.errorInPreparedStateAfterStop);
        assertTrue(!stateErrors.errorInStartedStateAfterPause);
        assertTrue(!stateErrors.errorInPausedState);
        assertTrue(!stateErrors.errorInPlaybackCompletedState);

        // Invalid states.
        assertTrue(stateErrors.errorInIdleState);
        assertTrue(stateErrors.errorInIdleStateAfterReset);
        assertTrue(stateErrors.errorInInitializedState);
        assertTrue(stateErrors.errorInStoppedState);
        assertTrue(stateErrors.errorInErrorState);
        assertTrue(!stateErrors.errorInStartedState);
    
public voidinvokeMethodUnderTest(android.media.MediaPlayer player)

        player.seekTo(0);
    
public voidtestSeekTo()

        mTestTemplate.runTestOnMethod(this);
    
public java.lang.StringtoString()

        return "seekTo()";