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

MediaPlayerStopStateUnitTest

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

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

param
stateErrors the MediaPlayerStateErrors to check against.


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

        player.stop();
    
public voidtestStop()

        mTestTemplate.runTestOnMethod(this);