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

MediaPlayerGetCurrentPositionStateUnitTest

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

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

param
stateErrors the MediaPlayerStateErrors to check against.

 
                                                        
        
        // Valid states.
        assertTrue(!stateErrors.errorInInitializedState);
        assertTrue(!stateErrors.errorInPreparedState);
        assertTrue(!stateErrors.errorInPreparedStateAfterStop);
        assertTrue(!stateErrors.errorInStartedState);
        assertTrue(!stateErrors.errorInStartedStateAfterPause);
        assertTrue(!stateErrors.errorInPausedState);
        assertTrue(!stateErrors.errorInStoppedState);
        assertTrue(!stateErrors.errorInPlaybackCompletedState);
        
        // Invalid states.
        assertTrue(stateErrors.errorInErrorState);
        assertTrue(stateErrors.errorInIdleStateAfterReset);
        assertTrue(stateErrors.errorInIdleState);
    
public voidinvokeMethodUnderTest(android.media.MediaPlayer player)

        player.getCurrentPosition();
    
public voidtestGetCurrentPosition()

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

        return "getCurrentPosition()";