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

MediaPlayerSetLoopingStateUnitTest

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

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

param
stateErrors the MediaPlayerStateErrors to check against.

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

        looping = !looping;  // Flip the looping mode.
        player.setLooping(looping);
    
public voidtestSetLooping()

        mTestTemplate.runTestOnMethod(this);