summaryrefslogtreecommitdiffstats
path: root/media/tests/MediaFrameworkTest
diff options
context:
space:
mode:
authorYu Shan Emily Lau <yslau@google.com>2009-09-21 21:13:36 -0700
committerYu Shan Emily Lau <yslau@google.com>2009-09-22 10:52:56 -0700
commitdc1af5befaa21e92c41dd6e173b2d6fb859cdd23 (patch)
treed7a7a6255a49251868d83640a206d4bf55316f53 /media/tests/MediaFrameworkTest
parentcd263b5c072703e80fe43e46baa831304441369b (diff)
downloadframeworks_base-dc1af5befaa21e92c41dd6e173b2d6fb859cdd23.zip
frameworks_base-dc1af5befaa21e92c41dd6e173b2d6fb859cdd23.tar.gz
frameworks_base-dc1af5befaa21e92c41dd6e173b2d6fb859cdd23.tar.bz2
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.
Diffstat (limited to 'media/tests/MediaFrameworkTest')
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java23
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java51
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java15
3 files changed, 71 insertions, 18 deletions
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
index 0401390..53afb1d 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
@@ -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();
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
index 30e2d6c..392d1d5 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
@@ -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,9 +87,11 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
@MediumTest
public void testWMA9GetDuration() throws Exception {
- int duration = CodecTest.getDuration(MediaNames.WMA9);
- duratoinWithinTolerence = verifyDuration(duration, MediaNames.WMA9_LENGTH);
- assertTrue("WMA9 getDuration", duratoinWithinTolerence);
+ if (isWMAEnable) {
+ int duration = CodecTest.getDuration(MediaNames.WMA9);
+ duratoinWithinTolerence = verifyDuration(duration, MediaNames.WMA9_LENGTH);
+ assertTrue("WMA9 getDuration", duratoinWithinTolerence);
+ }
}
@MediumTest
@@ -123,8 +130,10 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
@LargeTest
public void testWMA9GetCurrentPosition() throws Exception {
- boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.WMA9);
- assertTrue("WMA9 GetCurrentPosition", currentPosition);
+ if (isWMAEnable) {
+ boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.WMA9);
+ assertTrue("WMA9 GetCurrentPosition", currentPosition);
+ }
}
@LargeTest
@@ -160,8 +169,10 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
@LargeTest
public void testWMA9Pause() throws Exception {
- boolean isPaused = CodecTest.pause(MediaNames.WMA9);
- assertTrue("WMA9 Pause", isPaused);
+ if (isWMAEnable) {
+ boolean isPaused = CodecTest.pause(MediaNames.WMA9);
+ assertTrue("WMA9 Pause", isPaused);
+ }
}
@LargeTest
@@ -269,8 +280,10 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
@LargeTest
public void testWMA9SeekTo() throws Exception {
- boolean isLoop = CodecTest.seekTo(MediaNames.WMA9);
- assertTrue("WMA9 seekTo", isLoop);
+ if (isWMAEnable) {
+ boolean isLoop = CodecTest.seekTo(MediaNames.WMA9);
+ assertTrue("WMA9 seekTo", isLoop);
+ }
}
@LargeTest
@@ -309,8 +322,10 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
@Suppress
@LargeTest
public void testWMA9SeekToEnd() throws Exception {
- boolean isEnd = CodecTest.seekToEnd(MediaNames.WMA9);
- assertTrue("WMA9 seekToEnd", isEnd);
+ if (isWMAEnable) {
+ boolean isEnd = CodecTest.seekToEnd(MediaNames.WMA9);
+ assertTrue("WMA9 seekToEnd", isEnd);
+ }
}
@LargeTest
@@ -327,8 +342,10 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
@LargeTest
public void testWAVSeekToEnd() throws Exception {
- boolean isEnd = CodecTest.seekToEnd(MediaNames.WAV);
- assertTrue("WAV seekToEnd", isEnd);
+ if (isWMVEnable) {
+ boolean isEnd = CodecTest.seekToEnd(MediaNames.WAV);
+ assertTrue("WAV seekToEnd", isEnd);
+ }
}
@MediumTest
@@ -385,8 +402,12 @@ public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFra
@LargeTest
public void testVideoWMVSeekTo() throws Exception {
- boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_WMV);
- assertTrue("WMV SeekTo", isSeek);
+ 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
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
index b4d265d..690eff6 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
@@ -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);
+ }
}
}