Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc1af5be authored by Yu Shan Emily Lau's avatar Yu Shan Emily Lau
Browse files

1) Add the wma / wmv profile reader.

2) Add the flag which check the wma/wmv enable properties. If the codec is not enable, then skip the wma / wmv related test cases.
3) Added a workaround which let the testcodecspecific test case continue even though there is a failure in the middle of the test. Besides, take out the remvoeFile for temporary usage.
parent cd263b5c
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -32,6 +32,29 @@ public class MediaProfileReader {
        return s;
    }

    public static boolean getWMAEnable() {
        // push all the property into one big table
        int wmaEnable = 1;
        wmaEnable = SystemProperties.getInt("ro.media.dec.aud.wma.enabled",
                wmaEnable);
        if (wmaEnable == 1) {
            return true;
        } else {
            return false;
        }
    }

    public static boolean getWMVEnable(){
        int wmvEnable = 1;
        wmvEnable = SystemProperties.getInt("ro.media.dec.vid.wmv.enabled",
                wmvEnable);
        if (wmvEnable == 1) {
            return true;
        } else {
            return false;
        }
    }

    public static void createVideoProfileTable() {
        // push all the property into one big table
        String encoderType = getVideoCodecProperty();
+36 −15
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ 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;
@@ -35,11 +36,15 @@ import java.io.File;
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 {
@@ -82,10 +87,12 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
    
    @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 {
@@ -123,9 +130,11 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
    
    @LargeTest
    public void testWMA9GetCurrentPosition() throws Exception {
        if (isWMAEnable) {
            boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.WMA9);
            assertTrue("WMA9 GetCurrentPosition", currentPosition);
        }
    }
    
    @LargeTest
    public void testAMRGetCurrentPosition() throws Exception {
@@ -160,9 +169,11 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
   
    @LargeTest
    public void testWMA9Pause() throws Exception {
        if (isWMAEnable) {
            boolean isPaused = CodecTest.pause(MediaNames.WMA9);
            assertTrue("WMA9 Pause", isPaused);
        }
    }
  
    @LargeTest
    public void testAMRPause() throws Exception {
@@ -269,9 +280,11 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
    
    @LargeTest
    public void testWMA9SeekTo() throws Exception {
        if (isWMAEnable) {
            boolean isLoop = CodecTest.seekTo(MediaNames.WMA9);
            assertTrue("WMA9 seekTo", isLoop);
        }
    }
    
    @LargeTest
    public void testAMRSeekTo() throws Exception {
@@ -309,9 +322,11 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
    @Suppress
    @LargeTest
    public void testWMA9SeekToEnd() throws Exception {
        if (isWMAEnable) {
            boolean isEnd = CodecTest.seekToEnd(MediaNames.WMA9);
            assertTrue("WMA9 seekToEnd", isEnd);
        }
    }
    
    @LargeTest
    public void testAMRSeekToEnd() throws Exception {
@@ -327,9 +342,11 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
    
    @LargeTest
    public void testWAVSeekToEnd() throws Exception {
        if (isWMVEnable) {
            boolean isEnd = CodecTest.seekToEnd(MediaNames.WAV);
            assertTrue("WAV seekToEnd", isEnd);
        }
    }  
    
    @MediumTest
    public void testLargeVideoHeigth() throws Exception {
@@ -385,9 +402,13 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
   
    @LargeTest
    public void testVideoWMVSeekTo() throws Exception {
        Log.v(TAG, "wmv not enable");
        if (isWMVEnable) {
            Log.v(TAG, "wmv enable");
            boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_WMV);
            assertTrue("WMV SeekTo", isSeek);
        }
    }
    
    @LargeTest
    public void testSoundRecord() throws Exception {
+12 −3
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ public class MediaRecorderTest extends ActivityInstrumentationTestCase<MediaFram
            validVideo = true;
        }
        Log.v(TAG, "width = " + mOutputVideoWidth + " height = " + mOutputVideoHeight + " Duration = " + mOutputDuration);
        removeFile(filePath);
        //removeFile(filePath);
        return validVideo;
    }
    
@@ -428,8 +428,9 @@ public class MediaRecorderTest extends ActivityInstrumentationTestCase<MediaFram
    }

    @LargeTest
    //est cases for the new codec
    //test cases for the new codec
    public void testDeviceSpecificCodec() throws Exception {
        int noOfFailure = 0;
        boolean recordSuccess = false;
        String deviceType = MediaProfileReader.getDeviceType();
        Log.v(TAG, "deviceType = " + deviceType);
@@ -450,10 +451,18 @@ public class MediaRecorderTest extends ActivityInstrumentationTestCase<MediaFram
                        } else {
                            recordSuccess = recordVideoWithPara(encoder[i], audio[j], "low");
                        }
                        assertTrue((encoder[i] + audio[j]), recordSuccess);
                        if (!recordSuccess){
                            Log.v(TAG, "testDeviceSpecificCodec failed");
                            Log.v(TAG, "Encoder = " + encoder[i] + "Audio Encoder = " + audio[j]);
                            noOfFailure++;
                        }
                       //assertTrue((encoder[i] + audio[j]), recordSuccess);
                    }
                }
            }
        }
        if (noOfFailure != 0){
            assertTrue("testDeviceSpecificCodec", false);
        }
    }
}