diff options
author | James Dong <jdong@google.com> | 2010-11-29 11:57:27 -0800 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-11-29 12:59:39 -0800 |
commit | 7411c1b8364ad1340c20f1da546e307c2d330e63 (patch) | |
tree | 75d8bacf324f41375150b61211f1dbaffbbe6229 /media | |
parent | 4f1a1aa39be92f9088f9d204a8fffebe1e364c37 (diff) | |
download | frameworks_base-7411c1b8364ad1340c20f1da546e307c2d330e63.zip frameworks_base-7411c1b8364ad1340c20f1da546e307c2d330e63.tar.gz frameworks_base-7411c1b8364ad1340c20f1da546e307c2d330e63.tar.bz2 |
Renable the captureFrame unit tests
o We need to make sure that
/sdcard/media_api/metadata rwx to the test app
before tests
Change-Id: Iaa2d58bb2d380bf7e93ec71f77c4c769d65b1d85
Diffstat (limited to 'media')
-rw-r--r-- | media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java | 33 |
1 files changed, 11 insertions, 22 deletions
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 7174e2b..484f6e7 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java @@ -25,11 +25,6 @@ import com.android.mediaframeworktest.MediaNames; import com.android.mediaframeworktest.MediaProfileReader; import android.test.suitebuilder.annotation.*; -/** - * WARNING: - * Currently, captureFrame() does not work, due to hardware access permission problem. - * We are currently only testing the metadata/album art retrieval features. - */ public class MediaMetadataRetrieverTest extends AndroidTestCase { private static final String TAG = "MediaMetadataRetrieverTest"; @@ -101,6 +96,7 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { } catch (Exception e) { Log.e(TAG, "Fails to convert the bitmap to a JPEG file for " + MediaNames.THUMBNAIL_CAPTURE_TEST_FILES[i]); hasFailed = true; + Log.e(TAG, e.toString()); } } catch(Exception e) { Log.e(TAG, "Fails to setDataSource for file " + MediaNames.THUMBNAIL_CAPTURE_TEST_FILES[i]); @@ -148,11 +144,8 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { public static void testBasicNormalMethodCallSequence() throws Exception { boolean hasFailed = false; MediaMetadataRetriever retriever = new MediaMetadataRetriever(); - retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY); try { retriever.setDataSource(MediaNames.TEST_PATH_1); - /* - * captureFrame() fails due to lack of permission to access hardware decoder devices Bitmap bitmap = retriever.captureFrame(); assertTrue(bitmap != null); try { @@ -162,7 +155,6 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { } catch (Exception e) { throw new Exception("Fails to convert the bitmap to a JPEG file for " + MediaNames.TEST_PATH_1, e); } - */ extractAllSupportedMetadataValues(retriever); } catch(Exception e) { Log.e(TAG, "Fails to setDataSource for " + MediaNames.TEST_PATH_1, e); @@ -251,17 +243,14 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { assertTrue(!hasFailed); } - // Due to the lack of permission to access hardware decoder, any calls - // attempting to capture a frame will fail. These are commented out for now - // until we find a solution to this access permission problem. @MediumTest public static void testIntendedUsage() { // By default, capture frame and retrieve metadata MediaMetadataRetriever retriever = new MediaMetadataRetriever(); boolean hasFailed = false; - // retriever.setDataSource(MediaNames.TEST_PATH_1); - // assertTrue(retriever.captureFrame() != null); - // assertTrue(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS) != null); + retriever.setDataSource(MediaNames.TEST_PATH_1); + assertTrue(retriever.captureFrame() != null); + assertTrue(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS) != null); // Do not capture frame or retrieve metadata retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY & MediaMetadataRetriever.MODE_GET_METADATA_ONLY); @@ -276,9 +265,9 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { } // Capture frame only - // retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY); - // retriever.setDataSource(MediaNames.TEST_PATH_1); - // assertTrue(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS) == null); + retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY); + retriever.setDataSource(MediaNames.TEST_PATH_1); + assertTrue(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS) == null); // Retriever metadata only retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY); @@ -289,10 +278,10 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { } // Capture frame and retrieve metadata - // retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY | MediaMetadataRetriever.MODE_GET_METADATA_ONLY); - // retriever.setDataSource(MediaNames.TEST_PATH_1); - // assertTrue(retriever.captureFrame() != null); - // assertTrue(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS) != null); + retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY | MediaMetadataRetriever.MODE_GET_METADATA_ONLY); + retriever.setDataSource(MediaNames.TEST_PATH_1); + assertTrue(retriever.captureFrame() != null); + assertTrue(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS) != null); retriever.release(); assertTrue(!hasFailed); } |