summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSterling Huber <hubers@google.com>2022-03-30 22:22:51 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-03-30 22:22:51 +0000
commite8a4edb06f20c50862de63176822809d5d9d214e (patch)
treeca9163d49eb4b923de150978a49c2519b06f4af9
parent363ef1f45a7aa144cbf6cfcfa625127ebf0e75d0 (diff)
parent2afb5938b8233db384e6f5d6551d9de0fab878d3 (diff)
downloadcts-e8a4edb06f20c50862de63176822809d5d9d214e.tar.gz
STS revert Media tests am: 678518595c am: 2afb5938b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/cts/+/17509988 Change-Id: If9c1428ecd82d50e691a7d81a3984a24b4af86ac Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--tests/tests/security/src/android/security/cts/MediaMetadataRetrieverTest.java24
-rw-r--r--tests/tests/security/src/android/security/cts/MediaServerCrashTest.java29
2 files changed, 18 insertions, 35 deletions
diff --git a/tests/tests/security/src/android/security/cts/MediaMetadataRetrieverTest.java b/tests/tests/security/src/android/security/cts/MediaMetadataRetrieverTest.java
index 65eb132a359..ecf8accc933 100644
--- a/tests/tests/security/src/android/security/cts/MediaMetadataRetrieverTest.java
+++ b/tests/tests/security/src/android/security/cts/MediaMetadataRetrieverTest.java
@@ -22,31 +22,24 @@ import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
import android.media.MediaMetadataRetriever;
import android.platform.test.annotations.AsbSecurityTest;
-import com.android.sts.common.util.StsExtraBusinessLogicTestCase;
+import android.test.AndroidTestCase;
import java.io.IOException;
-import org.junit.Before;
-import org.junit.After;
-import static org.junit.Assert.*;
-
-import androidx.test.runner.AndroidJUnit4;
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
-@RunWith(AndroidJUnit4.class)
-public class MediaMetadataRetrieverTest extends StsExtraBusinessLogicTestCase {
+public class MediaMetadataRetrieverTest extends AndroidTestCase {
protected Resources mResources;
protected MediaMetadataRetriever mRetriever;
- @Before
- public void setUp() throws Exception {
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
mResources = getContext().getResources();
mRetriever = new MediaMetadataRetriever();
}
- @After
- public void tearDown() throws Exception {
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
mRetriever.release();
}
@@ -60,7 +53,6 @@ public class MediaMetadataRetrieverTest extends StsExtraBusinessLogicTestCase {
}
}
- @Test
@AsbSecurityTest(cveBugId = 24623447)
public void testID3v2EmbeddedPicture() {
setDataSourceFd(R.raw.id3v2_3_extended_header_overflow_padding);
diff --git a/tests/tests/security/src/android/security/cts/MediaServerCrashTest.java b/tests/tests/security/src/android/security/cts/MediaServerCrashTest.java
index 83ce8ff7af4..2d2e08453ca 100644
--- a/tests/tests/security/src/android/security/cts/MediaServerCrashTest.java
+++ b/tests/tests/security/src/android/security/cts/MediaServerCrashTest.java
@@ -24,7 +24,7 @@ import android.os.ConditionVariable;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.platform.test.annotations.AsbSecurityTest;
-import com.android.sts.common.util.StsExtraBusinessLogicTestCase;
+import android.test.AndroidTestCase;
import android.util.Log;
import com.android.compatibility.common.util.MediaUtils;
@@ -38,16 +38,7 @@ import java.io.RandomAccessFile;
import android.security.cts.R;
-import org.junit.Before;
-import org.junit.After;
-import static org.junit.Assert.*;
-
-import androidx.test.runner.AndroidJUnit4;
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
-@RunWith(AndroidJUnit4.class)
-public class MediaServerCrashTest extends StsExtraBusinessLogicTestCase {
+public class MediaServerCrashTest extends AndroidTestCase {
private static final String TAG = "MediaServerCrashTest";
private static final String MIMETYPE_DRM_MESSAGE = "application/vnd.oma.drm.message";
@@ -58,8 +49,9 @@ public class MediaServerCrashTest extends StsExtraBusinessLogicTestCase {
private final ConditionVariable mOnPrepareCalled = new ConditionVariable();
private final ConditionVariable mOnCompletionCalled = new ConditionVariable();
- @Before
- public void setUp() throws Exception {
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
mFlFilePath = new File(getContext().getFilesDir(), "temp.fl").getAbsolutePath();
mOnPrepareCalled.close();
@@ -91,12 +83,12 @@ public class MediaServerCrashTest extends StsExtraBusinessLogicTestCase {
});
}
- @After
- public void tearDown() throws Exception {
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
new File(mFlFilePath).delete();
}
- @Test
@AsbSecurityTest(cveBugId = 25070434)
public void testInvalidMidiNullPointerAccess() throws Exception {
testIfMediaServerDied(R.raw.midi_crash);
@@ -123,17 +115,16 @@ public class MediaServerCrashTest extends StsExtraBusinessLogicTestCase {
}
}
- @Test
@AsbSecurityTest(cveBugId = 25070434)
public void testDrmManagerClientReset() throws Exception {
checkIfMediaServerDiedForDrm(R.raw.drm_uaf);
}
private void checkIfMediaServerDiedForDrm(int res) throws Exception {
- AssetFileDescriptor afd = getInstrumentation().getContext().getResources().openRawResourceFd(res);
+ AssetFileDescriptor afd = mContext.getResources().openRawResourceFd(res);
FileInputStream dmStream = afd.createInputStream();
RandomAccessFile flFile = new RandomAccessFile(mFlFilePath, "rw");
- if (!MediaUtils.convertDmToFl(getInstrumentation().getContext(), dmStream, flFile)) {
+ if (!MediaUtils.convertDmToFl(mContext, dmStream, flFile)) {
Log.w(TAG, "Can not convert dm to fl, skip checkIfMediaServerDiedForDrm");
mMediaPlayer.release();
return;