FileDocCategorySizeDatePackage
MediaPlayerStartStateUnitTest.javaAPI DocAndroid 1.5 API2516Wed May 06 22:42:00 BST 2009com.android.mediaframeworktest.unit

MediaPlayerStartStateUnitTest

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

Fields Summary
private MediaPlayerStateUnitTestTemplate
mTestTemplate
Constructors Summary
Methods Summary
public voidcheckStateErrors(MediaPlayerStateErrors stateErrors)
1. It is valid to call start() in the following states: {Prepared, Started, Paused, PlaybackComplted}. 2. It is invalid to call start() 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.errorInStartedState);
        assertTrue(!stateErrors.errorInStartedStateAfterPause);
        assertTrue(!stateErrors.errorInPausedState);
        assertTrue(!stateErrors.errorInPlaybackCompletedState);
        
        // Invalid states.
        assertTrue(!stateErrors.errorInIdleState);  // onError() won't be called
        assertTrue(stateErrors.errorInErrorState);
        assertTrue(stateErrors.errorInIdleStateAfterReset);
        assertTrue(stateErrors.errorInInitializedState);
        assertTrue(stateErrors.errorInStoppedState);
    
public voidinvokeMethodUnderTest(android.media.MediaPlayer player)

        player.start();
    
public voidtestStart()

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

        return "start()";