diff options
author | Yu Shan Emily Lau <yslau@google.com> | 2011-02-15 16:45:08 -0800 |
---|---|---|
committer | James Dong <jdong@google.com> | 2011-02-16 12:24:34 -0800 |
commit | 85305f04d52e921de0452a1efef01175b1bbac3c (patch) | |
tree | 9a8f887bda7d3894b706aa3882af9846e712ce9b /media/tests | |
parent | 439f5c6b39fe648da835d4c86dfcffed0f46dd94 (diff) | |
download | frameworks_base-85305f04d52e921de0452a1efef01175b1bbac3c.zip frameworks_base-85305f04d52e921de0452a1efef01175b1bbac3c.tar.gz frameworks_base-85305f04d52e921de0452a1efef01175b1bbac3c.tar.bz2 |
Change the media player stress test to repor the total number of failure and the total number of info.
Register the surface callback in the test application bug# 2909064
Change-Id: I3420b5bc81e276b50f612c126ed5fc1f4f16c08c
Diffstat (limited to 'media/tests')
4 files changed, 60 insertions, 40 deletions
diff --git a/media/tests/MediaFrameworkTest/AndroidManifest.xml b/media/tests/MediaFrameworkTest/AndroidManifest.xml index c9d2628b..dd5e026 100644 --- a/media/tests/MediaFrameworkTest/AndroidManifest.xml +++ b/media/tests/MediaFrameworkTest/AndroidManifest.xml @@ -22,6 +22,8 @@ <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> + <uses-permission android:name="android.permission.WAKE_LOCK" /> + <application> <uses-library android:name="android.test.runner" /> <activity android:label="@string/app_name" diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTest.java index 41f0e22..79fd2cb 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTest.java @@ -24,6 +24,7 @@ import android.graphics.Color; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; +import android.os.PowerManager; import android.provider.Downloads; import android.util.Log; import android.util.Log; @@ -48,7 +49,7 @@ import java.io.FileDescriptor; import java.net.InetAddress; -public class MediaFrameworkTest extends Activity { +public class MediaFrameworkTest extends Activity implements SurfaceHolder.Callback { //public static Surface video_sf; public static SurfaceView mSurfaceView; @@ -63,11 +64,13 @@ public class MediaFrameworkTest extends Activity { public static Bitmap mDestBitmap; public static ImageView mOverlayView; - + private SurfaceHolder mSurfaceHolder = null; + private String TAG = "MediaFrameworkTest"; + private PowerManager.WakeLock mWakeLock = null; + public MediaFrameworkTest() { } - /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { @@ -76,7 +79,9 @@ public class MediaFrameworkTest extends Activity { mSurfaceView = (SurfaceView)findViewById(R.id.surface_view); mOverlayView = (ImageView)findViewById(R.id.overlay_layer); ViewGroup.LayoutParams lp = mSurfaceView.getLayoutParams(); - mSurfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + mSurfaceHolder = mSurfaceView.getHolder(); + mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + mSurfaceHolder.addCallback(this); //Get the midi fd midiafd = this.getResources().openRawResourceFd(R.raw.testmidi); @@ -86,8 +91,31 @@ public class MediaFrameworkTest extends Activity { mOverlayView.setLayoutParams(lp); mDestBitmap = Bitmap.createBitmap((int)640, (int)480, Bitmap.Config.ARGB_8888); mOverlayView.setImageBitmap(mDestBitmap); + + //Acquire the full wake lock to keep the device up + PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE); + mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "MediaFrameworkTest"); + mWakeLock.acquire(); } - + + public void onStop(Bundle icicle) { + mWakeLock.release(); + } + + public void surfaceDestroyed(SurfaceHolder holder) { + //Can do nothing in here. The test case will fail if the surface destroyed. + Log.v(TAG, "Test application surface destroyed"); + mSurfaceHolder = null; + } + + public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { + //Do nothing in here. Just print out the log + Log.v(TAG, "Test application surface changed"); + } + + public void surfaceCreated(SurfaceHolder holder) { + } + public void startPlayback(String filename){ String mimetype = "audio/mpeg"; Uri path = Uri.parse(filename); diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CodecTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CodecTest.java index cad7e53..4470740 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CodecTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CodecTest.java @@ -60,11 +60,11 @@ public class CodecTest { private static boolean onPrepareSuccess = false; public static boolean onCompleteSuccess = false; public static boolean mPlaybackError = false; - public static boolean mIsMediaInfoUnknown = false; - public static boolean mIsMediaInfoVideoTrackLagging = false; - public static boolean mIsMediaInfoBadInterleaving = false; - public static boolean mIsMediaInfoNotSeekable = false; - public static boolean mIsMediaInfoMetdataUpdate = false; + public static int mMediaInfoUnknownCount = 0; + public static int mMediaInfoVideoTrackLaggingCount = 0; + public static int mMediaInfoBadInterleavingCount = 0; + public static int mMediaInfoNotSeekableCount = 0; + public static int mMediaInfoMetdataUpdateCount = 0; public static String printCpuInfo(){ String cm = "dumpsys cpuinfo"; @@ -765,19 +765,19 @@ public class CodecTest { public boolean onInfo(MediaPlayer mp, int what, int extra) { switch (what){ case MediaPlayer.MEDIA_INFO_UNKNOWN: - mIsMediaInfoUnknown = true; + mMediaInfoUnknownCount++; break; case MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING: - mIsMediaInfoVideoTrackLagging = true; + mMediaInfoVideoTrackLaggingCount++; break; case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING: - mIsMediaInfoBadInterleaving = true; + mMediaInfoBadInterleavingCount++; break; case MediaPlayer.MEDIA_INFO_NOT_SEEKABLE: - mIsMediaInfoNotSeekable = true; + mMediaInfoNotSeekableCount++; break; case MediaPlayer.MEDIA_INFO_METADATA_UPDATE: - mIsMediaInfoMetdataUpdate = true; + mMediaInfoMetdataUpdateCount++; break; } return true; @@ -791,11 +791,11 @@ public class CodecTest { int nextPosition = 0; int waittime = 0; onCompleteSuccess = false; - mIsMediaInfoUnknown = false; - mIsMediaInfoVideoTrackLagging = false; - mIsMediaInfoBadInterleaving = false; - mIsMediaInfoNotSeekable = false; - mIsMediaInfoMetdataUpdate = false; + mMediaInfoUnknownCount = 0; + mMediaInfoVideoTrackLaggingCount = 0; + mMediaInfoBadInterleavingCount = 0; + mMediaInfoNotSeekableCount = 0; + mMediaInfoMetdataUpdateCount = 0; mPlaybackError = false; String testResult; diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaPlayerStressTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaPlayerStressTest.java index b694d16..20e2936 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaPlayerStressTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaPlayerStressTest.java @@ -65,11 +65,11 @@ public class MediaPlayerStressTest extends InstrumentationTestCase { output.write("File Name: " + filename); output.write(" Complete: " + CodecTest.onCompleteSuccess); output.write(" Error: " + CodecTest.mPlaybackError); - output.write(" Unknown Info: " + CodecTest.mIsMediaInfoUnknown); - output.write(" Track Lagging: " + CodecTest.mIsMediaInfoVideoTrackLagging); - output.write(" BadInterleaving: " + CodecTest.mIsMediaInfoBadInterleaving); - output.write(" Not Seekable: " + CodecTest.mIsMediaInfoNotSeekable); - output.write(" Info Meta data update: " + CodecTest.mIsMediaInfoMetdataUpdate); + output.write(" Unknown Info: " + CodecTest.mMediaInfoUnknownCount); + output.write(" Track Lagging: " + CodecTest.mMediaInfoVideoTrackLaggingCount); + output.write(" BadInterleaving: " + CodecTest.mMediaInfoBadInterleavingCount); + output.write(" Not Seekable: " + CodecTest.mMediaInfoNotSeekableCount); + output.write(" Info Meta data update: " + CodecTest.mMediaInfoMetdataUpdateCount); output.write("\n"); } @@ -92,21 +92,11 @@ public class MediaPlayerStressTest extends InstrumentationTestCase { else if (CodecTest.mPlaybackError){ mTotalPlaybackError++; } - else if (CodecTest.mIsMediaInfoUnknown){ - mTotalInfoUnknown++; - } - else if (CodecTest.mIsMediaInfoVideoTrackLagging){ - mTotalVideoTrackLagging++; - } - else if (CodecTest.mIsMediaInfoBadInterleaving){ - mTotalBadInterleaving++; - } - else if (CodecTest.mIsMediaInfoNotSeekable){ - mTotalNotSeekable++; - } - else if (CodecTest.mIsMediaInfoMetdataUpdate){ - mTotalMetaDataUpdate++; - } + mTotalInfoUnknown += CodecTest.mMediaInfoUnknownCount; + mTotalVideoTrackLagging += CodecTest.mMediaInfoVideoTrackLaggingCount; + mTotalBadInterleaving += CodecTest.mMediaInfoBadInterleavingCount; + mTotalNotSeekable += CodecTest.mMediaInfoNotSeekableCount; + mTotalMetaDataUpdate += CodecTest.mMediaInfoMetdataUpdateCount; } //Test that will start the playback for all the videos |