FileDocCategorySizeDatePackage
MediaPlayerApiTest.javaAPI DocAndroid 1.5 API15323Wed May 06 22:42:00 BST 2009com.android.mediaframeworktest.functional

MediaPlayerApiTest

public class MediaPlayerApiTest extends android.test.ActivityInstrumentationTestCase
Junit / Instrumentation test case for the media player api

Fields Summary
private boolean
duratoinWithinTolerence
private String
TAG
android.content.Context
mContext
Constructors Summary
public MediaPlayerApiTest()

  
     
     super("com.android.mediaframeworktest", MediaFrameworkTest.class);
   
Methods Summary
protected voidsetUp()

      super.setUp();
   
  
public voidtestAMRGetCurrentPosition()

      boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.AMR);  
      assertTrue("AMR GetCurrentPosition", currentPosition);  
    
public voidtestAMRGetDuration()

      int duration = CodecTest.getDuration(MediaNames.AMR);  
      duratoinWithinTolerence = verifyDuration(duration, MediaNames.AMR_LENGTH);
      assertTrue("AMR getDuration", duratoinWithinTolerence);  
    
public voidtestAMRPause()

      boolean isPaused = CodecTest.pause(MediaNames.AMR);  
      assertTrue("AMR Pause", isPaused);  
    
public voidtestAMRSeekTo()

      boolean isLoop = CodecTest.seekTo(MediaNames.AMR);  
      assertTrue("AMR seekTo", isLoop);  
    
public voidtestAMRSeekToEnd()

      boolean isEnd = CodecTest.seekToEnd(MediaNames.AMR);  
      assertTrue("AMR seekToEnd", isEnd);  
    
public voidtestAMRSetLooping()

      boolean isLoop = CodecTest.setLooping(MediaNames.AMR);  
      assertTrue("AMR setLooping", isLoop);  
    
public voidtestGetThumbnail()

      boolean getThumbnail = CodecTest.getThumbnail(MediaNames.VIDEO_H264_AAC, MediaNames.GOLDEN_THUMBNAIL_OUTPUT);
      assertTrue("Get Thumbnail", getThumbnail);         
    
public voidtestIsLooping()

        boolean isLooping = CodecTest.isLooping(MediaNames.AMR);
        assertTrue("isLooping", isLooping);
    
public voidtestIsLoopingAfterReset()

        boolean isLooping = CodecTest.isLoopingAfterReset(MediaNames.AMR);
        assertTrue("isLooping after reset", isLooping);
    
public voidtestLargeVideoHeigth()

      int height = 0;
      height = CodecTest.videoHeight(MediaNames.VIDEO_LARGE_SIZE_3GP);
      Log.v(TAG, "Video height = " +  height);
      assertEquals("streaming video height", 240, height);           
    
public voidtestLargeVideoWidth()

      int width = 0;
      width = CodecTest.videoWidth(MediaNames.VIDEO_LARGE_SIZE_3GP);
      Log.v(TAG, "Video width = " +  width);
      assertEquals("streaming video width", 320, width);           
    
public voidtestLocalMp3PrepareAsyncCallback()

        boolean onPrepareSuccess = 
            CodecTest.prepareAsyncCallback(MediaNames.VIDEO_H263_AMR);
        assertTrue("LocalMp3prepareAsyncCallback", onPrepareSuccess);
    
public voidtestMIDIGetCurrentPosition()

      boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.MIDI);  
      assertTrue("MIDI GetCurrentPosition", currentPosition);  
    
public voidtestMIDIGetDuration()

      int duration = CodecTest.getDuration(MediaNames.MIDI);  
      duratoinWithinTolerence = verifyDuration(duration, MediaNames.MIDI_LENGTH);
      assertTrue("MIDI getDuration", duratoinWithinTolerence);  
    
public voidtestMIDIPause()

      boolean isPaused = CodecTest.pause(MediaNames.MIDI);  
      assertTrue("MIDI Pause", isPaused);  
    
public voidtestMIDIPrepareStopRelease()

      CodecTest.prepareStopRelease(MediaNames.MIDI);  
      assertTrue("MIDI prepareStopRelease", true);  
    
public voidtestMIDISeekTo()

      boolean isLoop = CodecTest.seekTo(MediaNames.MIDI);  
      assertTrue("MIDI seekTo", isLoop);  
    
public voidtestMIDISeekToEnd()

      boolean isEnd = CodecTest.seekToEnd(MediaNames.MIDI);  
      assertTrue("MIDI seekToEnd", isEnd);  
    
public voidtestMIDISetLooping()

      boolean isLoop = CodecTest.setLooping(MediaNames.MIDI);  
      assertTrue("MIDI setLooping", isLoop);  
    
public voidtestMP3CBRGetCurrentPosition()

      boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.MP3CBR);       
      assertTrue("MP3CBR GetCurrentPosition", currentPosition);  
    
public voidtestMP3CBRGetDuration()

      int duration = CodecTest.getDuration(MediaNames.MP3CBR);
      duratoinWithinTolerence = verifyDuration(duration, MediaNames.MP3CBR_LENGTH);
      assertTrue("MP3CBR getDuration", duratoinWithinTolerence);  
    
public voidtestMP3CBRPause()

      boolean isPaused = CodecTest.pause(MediaNames.MP3CBR);       
      assertTrue("MP3CBR Pause", isPaused);  
    
public voidtestMP3CBRPrepareStopRelease()

      CodecTest.prepareStopRelease(MediaNames.MP3CBR);       
      assertTrue("MP3CBR prepareStopRelease", true);  
    
public voidtestMP3CBRSeekBeforeStart()

      boolean seekBeforePlay = CodecTest.seektoBeforeStart(MediaNames.MP3CBR);       
      assertTrue("MP3CBR SeekBeforePlay", seekBeforePlay);  
    
public voidtestMP3CBRSeekTo()

      boolean isLoop = CodecTest.seekTo(MediaNames.MP3CBR);     
      assertTrue("MP3CBR seekTo", isLoop);  
    
public voidtestMP3CBRSeekToEnd()

      boolean isEnd = CodecTest.seekToEnd(MediaNames.MP3CBR);     
      assertTrue("MP3CBR seekToEnd", isEnd);  
    
public voidtestMP3CBRSetLooping()

      boolean isLoop = CodecTest.setLooping(MediaNames.MP3CBR);     
      assertTrue("MP3CBR setLooping", isLoop);  
    
public voidtestMP3VBRGetCurrentPosition()

      boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.MP3VBR);  
      assertTrue("MP3VBR GetCurrentPosition", currentPosition);  
    
public voidtestMP3VBRGetDuration()

      int duration = CodecTest.getDuration(MediaNames.MP3VBR);
      Log.v(TAG, "getDuration");
      duratoinWithinTolerence = verifyDuration(duration, MediaNames.MP3VBR_LENGTH);
      assertTrue("MP3VBR getDuration", duratoinWithinTolerence);  
    
public voidtestMP3VBRPause()

      boolean isPaused = CodecTest.pause(MediaNames.MP3VBR);  
      assertTrue("MP3VBR Pause", isPaused);  
    
public voidtestMP3VBRSeekTo()

      boolean isLoop = CodecTest.seekTo(MediaNames.MP3VBR);
      Log.v(TAG, "seekTo");
      assertTrue("MP3VBR seekTo", isLoop);  
    
public voidtestMP3VBRSeekToEnd()

      boolean isEnd = CodecTest.seekToEnd(MediaNames.MP3VBR);
      Log.v(TAG, "seekTo");
      assertTrue("MP3VBR seekToEnd", isEnd);  
    
public voidtestMP3VBRSetLooping()

      boolean isLoop = CodecTest.setLooping(MediaNames.MP3VBR);
      Log.v(TAG, "setLooping");
      assertTrue("MP3VBR setLooping", isLoop);  
    
public voidtestMidiResources()

      boolean midiResources = CodecTest.resourcesPlayback(MediaFrameworkTest.midiafd,180000);
      assertTrue("Play midi from resources", midiResources);         
    
public voidtestMp3Resources()

      boolean mp3Resources = CodecTest.resourcesPlayback(MediaFrameworkTest.mp3afd,25000);
      assertTrue("Play mp3 from resources", mp3Resources);         
    
public voidtestPrepareAsyncReset()

      boolean isReset = CodecTest.prepareAsyncReset(MediaNames.STREAM_LARGE_MP3);
      assertTrue("PrepareAsync Reset", isReset);         
    
public voidtestSoundRecord()

      boolean isRecordered = CodecTest.mediaRecorderRecord(MediaNames.RECORDER_OUTPUT);
      assertTrue("Recorder", isRecordered);         
    
public voidtestStreamPrepareAsyncCallback()

        boolean onPrepareSuccess = 
            CodecTest.prepareAsyncCallback(MediaNames.STREAM_H264_480_360_1411k);
        assertTrue("StreamH264PrepareAsyncCallback", onPrepareSuccess);
    
public voidtestVideoH263AACSeekTo()

      boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_H263_AAC);
      assertTrue("H263AAC SeekTo", isSeek);         
    
public voidtestVideoH263AMRSeekTo()

      boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_H263_AMR);
      assertTrue("H263AMR SeekTo", isSeek);         
    
public voidtestVideoH264AACSeekTo()

      boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_H264_AAC);
      assertTrue("H264AAC SeekTo", isSeek);         
    
public voidtestVideoH264AMRSeekTo()

      boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_H264_AMR);
      assertTrue("H264AMR SeekTo", isSeek);         
    
public voidtestVideoLong3gpSeekTo()

      boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_LONG_3GP);
      assertTrue("Local 3gp SeekTo", isSeek);         
    
public voidtestVideoMP4SeekTo()

      boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_MP4);
      assertTrue("Local MP4 SeekTo", isSeek);          
    
public voidtestVideoWMVSeekTo()

      boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_WMV);
      assertTrue("WMV SeekTo", isSeek);         
    
public voidtestWAVSeekToEnd()

      boolean isEnd = CodecTest.seekToEnd(MediaNames.WAV);  
      assertTrue("WAV seekToEnd", isEnd);  
    
public voidtestWMA9GetCurrentPosition()

      boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.WMA9);  
      assertTrue("WMA9 GetCurrentPosition", currentPosition);  
    
public voidtestWMA9GetDuration()

      int duration = CodecTest.getDuration(MediaNames.WMA9); 
      duratoinWithinTolerence = verifyDuration(duration, MediaNames.WMA9_LENGTH);
      assertTrue("WMA9 getDuration", duratoinWithinTolerence);  
    
public voidtestWMA9Pause()

      boolean isPaused = CodecTest.pause(MediaNames.WMA9);  
      assertTrue("WMA9 Pause", isPaused);  
    
public voidtestWMA9SeekTo()

      boolean isLoop = CodecTest.seekTo(MediaNames.WMA9);  
      assertTrue("WMA9 seekTo", isLoop);  
    
public voidtestWMA9SeekToEnd()

      boolean isEnd = CodecTest.seekToEnd(MediaNames.WMA9);  
      assertTrue("WMA9 seekToEnd", isEnd);  
    
public voidtestWMA9SetLooping()

      boolean isLoop = CodecTest.setLooping(MediaNames.WMA9);  
      assertTrue("WMA9 setLooping", isLoop);  
    
public booleanverifyDuration(int duration, int expectedDuration)

      if ((duration > expectedDuration * 1.1) || (duration < expectedDuration * 0.9))
         return false;
      else
        return true;