Merge "Migrate MediaMetadataRetrieverTest to JUnit4" into main
This commit is contained in:
commit
7e44fa6c44
@ -44,7 +44,6 @@ public class MediaFrameworkUnitTestRunner extends InstrumentationTestRunner {
|
||||
@Override
|
||||
public TestSuite getAllTests() {
|
||||
TestSuite suite = new InstrumentationTestSuite(this);
|
||||
addMediaMetadataRetrieverStateUnitTests(suite);
|
||||
addMediaRecorderStateUnitTests(suite);
|
||||
addMediaPlayerStateUnitTests(suite);
|
||||
addMediaScannerUnitTests(suite);
|
||||
@ -69,11 +68,6 @@ public class MediaFrameworkUnitTestRunner extends InstrumentationTestRunner {
|
||||
suite.addTestSuite(ImageReaderTest.class);
|
||||
}
|
||||
|
||||
// Running all unit tests checking the state machine may be time-consuming.
|
||||
private void addMediaMetadataRetrieverStateUnitTests(TestSuite suite) {
|
||||
suite.addTestSuite(MediaMetadataRetrieverTest.class);
|
||||
}
|
||||
|
||||
// Running all unit tests checking the state machine may be time-consuming.
|
||||
private void addMediaRecorderStateUnitTests(TestSuite suite) {
|
||||
suite.addTestSuite(MediaRecorderPrepareStateUnitTest.class);
|
||||
|
@ -16,26 +16,34 @@
|
||||
|
||||
package com.android.mediaframeworktest.unit;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.test.AndroidTestCase;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
import android.test.suitebuilder.annotation.MediumTest;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.mediaframeworktest.MediaNames;
|
||||
import com.android.mediaframeworktest.MediaProfileReader;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MediaMetadataRetrieverTest extends AndroidTestCase {
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class MediaMetadataRetrieverTest {
|
||||
|
||||
private static final String TAG = "MediaMetadataRetrieverTest";
|
||||
|
||||
// Test album art extraction.
|
||||
@MediumTest
|
||||
public static void testGetEmbeddedPicture() throws Exception {
|
||||
@Test
|
||||
public void testGetEmbeddedPicture() throws Exception {
|
||||
Log.v(TAG, "testGetEmbeddedPicture starts.");
|
||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||
boolean supportWMA = MediaProfileReader.getWMAEnable();
|
||||
@ -78,7 +86,8 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase {
|
||||
|
||||
// Test frame capture
|
||||
@LargeTest
|
||||
public static void testThumbnailCapture() throws Exception {
|
||||
@Test
|
||||
public void testThumbnailCapture() throws Exception {
|
||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||
boolean supportWMA = MediaProfileReader.getWMAEnable();
|
||||
boolean supportWMV = MediaProfileReader.getWMVEnable();
|
||||
@ -134,7 +143,8 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase {
|
||||
}
|
||||
|
||||
@LargeTest
|
||||
public static void testMetadataRetrieval() throws Exception {
|
||||
@Test
|
||||
public void testMetadataRetrieval() throws Exception {
|
||||
boolean supportWMA = MediaProfileReader.getWMAEnable();
|
||||
boolean supportWMV = MediaProfileReader.getWMVEnable();
|
||||
boolean hasFailed = false;
|
||||
@ -169,7 +179,8 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase {
|
||||
// If the specified call order and valid media file is used, no exception
|
||||
// should be thrown.
|
||||
@MediumTest
|
||||
public static void testBasicNormalMethodCallSequence() throws Exception {
|
||||
@Test
|
||||
public void testBasicNormalMethodCallSequence() throws Exception {
|
||||
boolean hasFailed = false;
|
||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||
try {
|
||||
@ -197,7 +208,8 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase {
|
||||
// If setDataSource() has not been called, both getFrameAtTime() and extractMetadata() must
|
||||
// return null.
|
||||
@MediumTest
|
||||
public static void testBasicAbnormalMethodCallSequence() {
|
||||
@Test
|
||||
public void testBasicAbnormalMethodCallSequence() {
|
||||
boolean hasFailed = false;
|
||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||
if (retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM) != null) {
|
||||
@ -213,7 +225,8 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase {
|
||||
|
||||
// Test setDataSource()
|
||||
@MediumTest
|
||||
public static void testSetDataSource() throws IOException {
|
||||
@Test
|
||||
public void testSetDataSource() throws IOException {
|
||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||
boolean hasFailed = false;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user