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

MediaPlayerSetAudioStreamTypeStateUnitTest

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

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

param
stateErrors the MediaPlayerStateErrors to check against.

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

        player.setAudioStreamType(AudioManager.STREAM_MUSIC);
    
public voidtestSetAudioSystemType()

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

        return "setAudioStreamType()";