MediaPlayerApiTest.rar

  • PUDN用户
    了解作者
  • Unix_Linux
    开发工具
  • 4KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 3
    下载次数
  • 2014-08-07 20:15
    上传日期
Junit Instrumentation test case for the media player api.
MediaPlayerApiTest.rar
  • MediaPlayerApiTest.c
    16.7KB
  • define.h
    4.3KB
内容介绍
package com.android.mediaframeworktest.functional; import com.android.mediaframeworktest.MediaFrameworkTest; import com.android.mediaframeworktest.MediaNames; import com.android.mediaframeworktest.MediaProfileReader; import android.content.Context; import android.test.ActivityInstrumentationTestCase; import android.util.Log; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; import android.test.suitebuilder.annotation.Suppress; import java.io.File; /** * Junit / Instrumentation test case for the media player api */ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> { private boolean duratoinWithinTolerence = false; private String TAG = "MediaPlayerApiTest"; private boolean isWMAEnable = false; private boolean isWMVEnable = false; Context mContext; public MediaPlayerApiTest() { super("com.android.mediaframeworktest", MediaFrameworkTest.class); isWMAEnable = MediaProfileReader.getWMAEnable(); isWMVEnable = MediaProfileReader.getWMVEnable(); } protected void setUp() throws Exception { super.setUp(); } public boolean verifyDuration(int duration, int expectedDuration){ if ((duration > expectedDuration * 1.1) || (duration < expectedDuration * 0.9)) return false; else return true; } //Audio //Wait for PV bugs for MP3 duration @MediumTest public void testMP3CBRGetDuration() throws Exception { int duration = CodecTest.getDuration(MediaNames.MP3CBR); duratoinWithinTolerence = verifyDuration(duration, MediaNames.MP3CBR_LENGTH); assertTrue("MP3CBR getDuration", duratoinWithinTolerence); } @MediumTest public void testMP3VBRGetDuration() throws Exception { int duration = CodecTest.getDuration(MediaNames.MP3VBR); Log.v(TAG, "getDuration"); duratoinWithinTolerence = verifyDuration(duration, MediaNames.MP3VBR_LENGTH); assertTrue("MP3VBR getDuration", duratoinWithinTolerence); } @MediumTest public void testMIDIGetDuration() throws Exception { int duration = CodecTest.getDuration(MediaNames.MIDI); duratoinWithinTolerence = verifyDuration(duration, MediaNames.MIDI_LENGTH); assertTrue("MIDI getDuration", duratoinWithinTolerence); } @MediumTest public void testWMA9GetDuration() throws Exception { if (isWMAEnable) { int duration = CodecTest.getDuration(MediaNames.WMA9); duratoinWithinTolerence = verifyDuration(duration, MediaNames.WMA9_LENGTH); assertTrue("WMA9 getDuration", duratoinWithinTolerence); } } @MediumTest public void testAMRGetDuration() throws Exception { int duration = CodecTest.getDuration(MediaNames.AMR); duratoinWithinTolerence = verifyDuration(duration, MediaNames.AMR_LENGTH); assertTrue("AMR getDuration", duratoinWithinTolerence); } /* public void testOGGGetDuration() throws Exception { int duration = CodecTest.getDuration(MediaNames.OGG); duratoinWithinTolerence = verifyDuration(duration, MediaNames.OGG_LENGTH); assertTrue("OGG getDuration", duratoinWithinTolerence); }*/ //Test cases for GetCurrentPosition @LargeTest public void testMP3CBRGetCurrentPosition() throws Exception { boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.MP3CBR); assertTrue("MP3CBR GetCurrentPosition", currentPosition); } @LargeTest public void testMP3VBRGetCurrentPosition() throws Exception { boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.MP3VBR); assertTrue("MP3VBR GetCurrentPosition", currentPosition); } @LargeTest public void testMIDIGetCurrentPosition() throws Exception { boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.MIDI); assertTrue("MIDI GetCurrentPosition", currentPosition); } @LargeTest public void testWMA9GetCurrentPosition() throws Exception { if (isWMAEnable) { boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.WMA9); assertTrue("WMA9 GetCurrentPosition", currentPosition); } } @LargeTest public void testAMRGetCurrentPosition() throws Exception { boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.AMR); assertTrue("AMR GetCurrentPosition", currentPosition); } /* public void testOGGGetCurrentPosition() throws Exception { boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.OGG); assertTrue("OGG GetCurrentPosition", currentPosition); */ //Test cases for pause @LargeTest public void testMP3CBRPause() throws Exception { boolean isPaused = CodecTest.pause(MediaNames.MP3CBR); assertTrue("MP3CBR Pause", isPaused); } @LargeTest public void testMP3VBRPause() throws Exception { boolean isPaused = CodecTest.pause(MediaNames.MP3VBR); assertTrue("MP3VBR Pause", isPaused); } @LargeTest public void testMIDIPause() throws Exception { boolean isPaused = CodecTest.pause(MediaNames.MIDI); assertTrue("MIDI Pause", isPaused); } @LargeTest public void testWMA9Pause() throws Exception { if (isWMAEnable) { boolean isPaused = CodecTest.pause(MediaNames.WMA9); assertTrue("WMA9 Pause", isPaused); } } @LargeTest public void testAMRPause() throws Exception { boolean isPaused = CodecTest.pause(MediaNames.AMR); assertTrue("AMR Pause", isPaused); } /* public void testOGGPause() throws Exception { boolean isPaused = CodecTest.pause(MediaNames.OGG); assertTrue("OGG Pause", isPaused); }*/ @MediumTest public void testMP3CBRPrepareStopRelease() throws Exception { CodecTest.prepareStopRelease(MediaNames.MP3CBR); assertTrue("MP3CBR prepareStopRelease", true); } @MediumTest public void testMIDIPrepareStopRelease() throws Exception { CodecTest.prepareStopRelease(MediaNames.MIDI); assertTrue("MIDI prepareStopRelease", true); } //One test case for seek before start @MediumTest public void testMP3CBRSeekBeforeStart() throws Exception { boolean seekBeforePlay = CodecTest.seektoBeforeStart(MediaNames.MP3CBR); assertTrue("MP3CBR SeekBeforePlay", seekBeforePlay); } //Skip test - Bug# 1120249 /* public void testMP3CBRpreparePauseRelease() throws Exception { CodecTest.preparePauseRelease(MediaNames.MP3CBR); assertTrue("MP3CBR preparePauseRelease", true); } public void testMIDIpreparePauseRelease() throws Exception { CodecTest.preparePauseRelease(MediaNames.MIDI); assertTrue("MIDI preparePauseRelease", true); } */ //Test cases for setLooping @LargeTest public void testMP3CBRSetLooping() throws Exception { boolean isLoop = CodecTest.setLooping(MediaNames.MP3CBR); assertTrue("MP3CBR setLooping", isLoop); } @LargeTest public void testMP3VBRSetLooping() throws Exception { boolean isLoop = CodecTest.setLooping(MediaNames.MP3VBR); Log.v(TAG, "setLooping"); assertTrue("MP3VBR setLooping", isLoop); } @LargeTest public void testMIDISetLooping() throws Exception { boolean isLoop = CodecTest.setLooping(MediaNames.MIDI); assertTrue("MIDI setLooping", isLoop); } @LargeTest public void testWMA9SetLooping() throws Exception { if (isWMAEnable) { boolean isLoop = CodecTest.setLooping(MediaNames.WMA9); assertTrue("WMA9 setLooping", isLoop); } } @Lar
评论
    相关推荐
    • test.rar
      this is the test for windows form
    • test11.24.rar
      the new test of app written by html
    • test.rar
      test description is the best description
    • test.zip
      Ant colony algorithm is an intelligent algorithm very hot... first published in the research forum, we through the simulation test, found the program optimization efficiency and robustness are very good.
    • test5.zip
      test5 is the final test... maybe
    • test.rar
      start the test with navigation button
    • test.zip
      The function of simple implementation browser
    • test.zip
      test case for testing our MVG case in the supersonic flow at Ma=2.4, Re=5760
    • test.zip
      test for the verification of the account.
    • test.rar
      Follow along with this worked out example of a hypothesis test so that you can understand the process and procedure.