From 38b03a76616edffabb97f4131e268c701dffb00f Mon Sep 17 00:00:00 2001 From: James Dong Date: Mon, 2 Nov 2009 12:11:57 -0800 Subject: Add windows media support check in MediaMetadataRetrieverTest bug 2232274 --- .../unit/MediaMetadataRetrieverTest.java | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java index 9927eda..8750098 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java @@ -22,6 +22,7 @@ import android.graphics.Bitmap; import java.io.FileOutputStream; import android.test.AndroidTestCase; import com.android.mediaframeworktest.MediaNames; +import com.android.mediaframeworktest.MediaProfileReader; import android.test.suitebuilder.annotation.*; /** @@ -38,10 +39,19 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { public static void testAlbumArt() throws Exception { Log.v(TAG, "testAlbumArt starts."); MediaMetadataRetriever retriever = new MediaMetadataRetriever(); + MediaProfileReader reader = new MediaProfileReader(); + boolean supportWMA = reader.getWMAEnable(); + boolean supportWMV = reader.getWMVEnable(); retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY); for (int i = 0, n = MediaNames.ALBUMART_TEST_FILES.length; i < n; ++i) { try { Log.v(TAG, "File " + i + ": " + MediaNames.ALBUMART_TEST_FILES[i]); + if ((MediaNames.ALBUMART_TEST_FILES[i].endsWith(".wma") && !supportWMA) || + (MediaNames.ALBUMART_TEST_FILES[i].endsWith(".wmv") && !supportWMV) + ) { + Log.v(TAG, "windows media is not supported and thus we will skip the test for this file"); + continue; + } retriever.setDataSource(MediaNames.ALBUMART_TEST_FILES[i]); byte[] albumArt = retriever.extractAlbumArt(); @@ -64,11 +74,20 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { @LargeTest public static void testThumbnailCapture() throws Exception { MediaMetadataRetriever retriever = new MediaMetadataRetriever(); + MediaProfileReader reader = new MediaProfileReader(); + boolean supportWMA = reader.getWMAEnable(); + boolean supportWMV = reader.getWMVEnable(); Log.v(TAG, "Thumbnail processing starts"); long startedAt = System.currentTimeMillis(); for(int i = 0, n = MediaNames.THUMBNAIL_CAPTURE_TEST_FILES.length; i < n; ++i) { try { Log.v(TAG, "File " + i + ": " + MediaNames.THUMBNAIL_CAPTURE_TEST_FILES[i]); + if ((MediaNames.THUMBNAIL_CAPTURE_TEST_FILES[i].endsWith(".wma") && !supportWMA) || + (MediaNames.THUMBNAIL_CAPTURE_TEST_FILES[i].endsWith(".wmv") && !supportWMV) + ) { + Log.v(TAG, "windows media is not supported and thus we will skip the test for this file"); + continue; + } retriever.setDataSource(MediaNames.THUMBNAIL_CAPTURE_TEST_FILES[i]); Bitmap bitmap = retriever.captureFrame(); assertTrue(bitmap != null); @@ -91,10 +110,20 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { @LargeTest public static void testMetadataRetrieval() throws Exception { + MediaProfileReader reader = new MediaProfileReader(); + boolean supportWMA = reader.getWMAEnable(); + boolean supportWMV = reader.getWMVEnable(); MediaMetadataRetriever retriever = new MediaMetadataRetriever(); retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY); for(int i = 0, n = MediaNames.METADATA_RETRIEVAL_TEST_FILES.length; i < n; ++i) { try { + Log.v(TAG, "File " + i + ": " + MediaNames.METADATA_RETRIEVAL_TEST_FILES[i]); + if ((MediaNames.METADATA_RETRIEVAL_TEST_FILES[i].endsWith(".wma") && !supportWMA) || + (MediaNames.METADATA_RETRIEVAL_TEST_FILES[i].endsWith(".wmv") && !supportWMV) + ) { + Log.v(TAG, "windows media is not supported and thus we will skip the test for this file"); + continue; + } retriever.setDataSource(MediaNames.METADATA_RETRIEVAL_TEST_FILES[i]); extractAllSupportedMetadataValues(retriever); } catch(Exception e) { -- cgit v1.1