summaryrefslogtreecommitdiffstats
path: root/media/tests/MediaFrameworkTest/src/com
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:28:45 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:28:45 -0800
commitd83a98f4ce9cfa908f5c54bbd70f03eec07e7553 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /media/tests/MediaFrameworkTest/src/com
parent076357b8567458d4b6dfdcf839ef751634cd2bfb (diff)
downloadframeworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.zip
frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.tar.gz
frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.tar.bz2
auto import from //depot/cupcake/@135843
Diffstat (limited to 'media/tests/MediaFrameworkTest/src/com')
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkPerfTestRunner.java51
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTest.java149
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java61
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkUnitTestRunner.java91
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java497
-rwxr-xr-xmedia/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaRecorderStressTestRunner.java38
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java260
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CodecTest.java577
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioTrackTest.java176
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java255
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java433
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java339
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/SimTonesTest.java73
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/TonesAutoTest.java180
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java159
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java198
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java242
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetCurrentPositionStateUnitTest.java68
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetDurationStateUnitTest.java68
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetVideoHeightStateUnitTest.java68
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetVideoWidthStateUnitTest.java68
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerIsPlayingStateUnitTest.java68
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerMethodUnderTest.java27
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerPauseStateUnitTest.java68
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerResetStateUnitTest.java68
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSeekToStateUnitTest.java68
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetAudioStreamTypeStateUnitTest.java69
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetLoopingStateUnitTest.java65
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetVolumeStateUnitTest.java68
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStartStateUnitTest.java69
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStateErrors.java47
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStateUnitTestTemplate.java506
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStopStateUnitTest.java63
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderMethodUnderTest.java27
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderPrepareStateUnitTest.java71
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderResetStateUnitTest.java66
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetAudioEncoderStateUnitTest.java66
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetAudioSourceStateUnitTest.java66
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetOutputFileStateUnitTest.java63
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetOutputFormatStateUnitTest.java66
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStartStateUnitTest.java66
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStateErrors.java40
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStateUnitTestTemplate.java340
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStopStateUnitTest.java66
44 files changed, 0 insertions, 6174 deletions
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkPerfTestRunner.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkPerfTestRunner.java
deleted file mode 100755
index eaaa798..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkPerfTestRunner.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest;
-
-import com.android.mediaframeworktest.performance.MediaPlayerPerformance;
-
-import junit.framework.TestSuite;
-
-import android.test.InstrumentationTestRunner;
-import android.test.InstrumentationTestSuite;
-
-
-/**
- * Instrumentation Test Runner for all MediaPlayer tests.
- *
- * Running all tests:
- *
- * adb shell am instrument \
- * -w com.android.smstests.MediaPlayerInstrumentationTestRunner
- */
-
-public class MediaFrameworkPerfTestRunner extends InstrumentationTestRunner {
-
-
- @Override
- public TestSuite getAllTests() {
- TestSuite suite = new InstrumentationTestSuite(this);
- suite.addTestSuite(MediaPlayerPerformance.class);
- return suite;
- }
-
- @Override
- public ClassLoader getLoader() {
- return MediaFrameworkTestRunner.class.getClassLoader();
- }
-}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTest.java
deleted file mode 100644
index e65cf41..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.AssetFileDescriptor;
-import android.graphics.Color;
-import android.media.MediaPlayer;
-import android.net.Uri;
-import android.os.Bundle;
-import android.provider.Downloads;
-import android.util.Log;
-import android.util.Log;
-import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.View.OnClickListener;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.MediaController;
-import android.widget.VideoView;
-import com.android.mediaframeworktest.MediaNames;
-
-import java.io.File;
-import java.io.FileDescriptor;
-
-
-public class MediaFrameworkTest extends Activity {
-
- //public static Surface video_sf;
- public static SurfaceView mSurfaceView;
- private MediaController mMediaController;
- private String urlpath;
- private MediaPlayer mpmidi;
- private MediaPlayer mpmp3;
- private String testfilepath = "/sdcard/awb.awb";
-
- public static AssetFileDescriptor midiafd;
- public static AssetFileDescriptor mp3afd;
-
-
- public MediaFrameworkTest() {
- }
-
-
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.surface_view);
- mSurfaceView = (SurfaceView)findViewById(R.id.surface_view);
- ViewGroup.LayoutParams lp = mSurfaceView.getLayoutParams();
- lp.width = 320;
- lp.height = 240;
- mSurfaceView.setLayoutParams(lp);
- mSurfaceView.getHolder().setFixedSize(320, 240);
- mSurfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
-
- //Get the midi fd
- midiafd = this.getResources().openRawResourceFd(R.raw.testmidi);
-
- //Get the mp3 fd
- mp3afd = this.getResources().openRawResourceFd(R.raw.testmp3);
- }
-
- public void startPlayback(String filename){
- String mimetype = "audio/mpeg";
- Uri path = Uri.parse(filename);
- Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setDataAndType(path, mimetype);
- startActivity(intent);
- }
-
- @Override public boolean onKeyDown(int keyCode, KeyEvent event) {
- switch (keyCode) {
- case KeyEvent.KEYCODE_0:
- MediaPlayer mp = new MediaPlayer();
- try{
- mp.setDataSource(MediaNames.VIDEO_RTSP3GP);
- Log.v("emily","awb " + testfilepath);
- mp.setDisplay(mSurfaceView.getHolder());
- mp.prepare();
- mp.start();
- }catch (Exception e){}
- break;
-
- //start the music player intent with the test URL from PV
- case KeyEvent.KEYCODE_1:
- startPlayback(MediaNames.STREAM_MP3_1);
- break;
-
- case KeyEvent.KEYCODE_2:
- startPlayback(MediaNames.STREAM_MP3_2);
- break;
-
- case KeyEvent.KEYCODE_3:
- startPlayback(MediaNames.STREAM_MP3_3);
- break;
-
- case KeyEvent.KEYCODE_4:
- startPlayback(MediaNames.STREAM_MP3_4);
- break;
-
- case KeyEvent.KEYCODE_5:
- startPlayback(MediaNames.STREAM_MP3_5);
- break;
-
- case KeyEvent.KEYCODE_6:
- startPlayback(MediaNames.STREAM_MP3_6);
- break;
-
- case KeyEvent.KEYCODE_7:
- startPlayback(MediaNames.STREAM_MP3_7);
- break;
-
- case KeyEvent.KEYCODE_8:
- startPlayback(MediaNames.STREAM_MP3_8);
- break;
-
- case KeyEvent.KEYCODE_9:
- startPlayback(MediaNames.STREAM_MP3_9);
- break;
-
-
-
- }
- return super.onKeyDown(keyCode, event);
-
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
deleted file mode 100755
index 453a165..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest;
-
-import com.android.mediaframeworktest.functional.MediaPlayerApiTest;
-import com.android.mediaframeworktest.functional.SimTonesTest;
-import com.android.mediaframeworktest.functional.MediaMetadataTest;
-import com.android.mediaframeworktest.functional.CameraTest;
-import com.android.mediaframeworktest.functional.MediaRecorderTest;
-import com.android.mediaframeworktest.functional.MediaAudioTrackTest;
-
-import junit.framework.TestSuite;
-
-import android.test.InstrumentationTestRunner;
-import android.test.InstrumentationTestSuite;
-
-
-/**
- * Instrumentation Test Runner for all MediaPlayer tests.
- *
- * Running all tests:
- *
- * adb shell am instrument \
- * -w com.android.smstests.MediaPlayerInstrumentationTestRunner
- */
-
-public class MediaFrameworkTestRunner extends InstrumentationTestRunner {
-
-
- @Override
- public TestSuite getAllTests() {
- TestSuite suite = new InstrumentationTestSuite(this);
- suite.addTestSuite(MediaPlayerApiTest.class);
- suite.addTestSuite(SimTonesTest.class);
- suite.addTestSuite(MediaMetadataTest.class);
- // suite.addTestSuite(CameraTest.class);
- suite.addTestSuite(MediaRecorderTest.class);
- suite.addTestSuite(MediaAudioTrackTest.class);
- return suite;
- }
-
- @Override
- public ClassLoader getLoader() {
- return MediaFrameworkTestRunner.class.getClassLoader();
- }
-}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkUnitTestRunner.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkUnitTestRunner.java
deleted file mode 100755
index 81d59da..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkUnitTestRunner.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest;
-
-import android.test.InstrumentationTestRunner;
-import android.test.InstrumentationTestSuite;
-import com.android.mediaframeworktest.unit.*;
-
-import junit.framework.TestSuite;
-
-/**
- * Instrumentation Test Runner for all media framework unit tests.
- *
- * Make sure that MediaFrameworkUnitTestRunner has been added to
- * AndroidManifest.xml file, and then "make -j4 mediaframeworktest; adb sync"
- * to build and upload mediaframeworktest to the phone or emulator.
- *
- * Example on running all unit tests for a single class:
- * adb shell am instrument -e class \
- * com.android.mediaframeworktest.unit.MediaMetadataRetrieverUnitTest \
- * -w com.android.mediaframeworktest/.MediaFrameworkUnitTestRunner
- *
- * Example on running all unit tests for the media framework:
- * adb shell am instrument \
- * -w com.android.mediaframeworktest/.MediaFrameworkUnitTestRunner
- */
-
-public class MediaFrameworkUnitTestRunner extends InstrumentationTestRunner {
-
- @Override
- public TestSuite getAllTests() {
- TestSuite suite = new InstrumentationTestSuite(this);
- addMediaMetadataRetrieverStateUnitTests(suite);
- addMediaRecorderStateUnitTests(suite);
- addMediaPlayerStateUnitTests(suite);
- return suite;
- }
-
- @Override
- public ClassLoader getLoader() {
- return MediaFrameworkUnitTestRunner.class.getClassLoader();
- }
-
- // 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);
- suite.addTestSuite(MediaRecorderResetStateUnitTest.class);
- suite.addTestSuite(MediaRecorderSetAudioEncoderStateUnitTest.class);
- suite.addTestSuite(MediaRecorderSetAudioSourceStateUnitTest.class);
- suite.addTestSuite(MediaRecorderSetOutputFileStateUnitTest.class);
- suite.addTestSuite(MediaRecorderSetOutputFormatStateUnitTest.class);
- suite.addTestSuite(MediaRecorderStartStateUnitTest.class);
- suite.addTestSuite(MediaRecorderStopStateUnitTest.class);
- }
-
- // Running all unit tests checking the state machine may be time-consuming.
- private void addMediaPlayerStateUnitTests(TestSuite suite) {
- suite.addTestSuite(MediaPlayerGetDurationStateUnitTest.class);
- suite.addTestSuite(MediaPlayerSeekToStateUnitTest.class);
- suite.addTestSuite(MediaPlayerGetCurrentPositionStateUnitTest.class);
- suite.addTestSuite(MediaPlayerGetVideoWidthStateUnitTest.class);
- suite.addTestSuite(MediaPlayerGetVideoHeightStateUnitTest.class);
- suite.addTestSuite(MediaPlayerIsPlayingStateUnitTest.class);
- suite.addTestSuite(MediaPlayerResetStateUnitTest.class);
- suite.addTestSuite(MediaPlayerPauseStateUnitTest.class);
- suite.addTestSuite(MediaPlayerStartStateUnitTest.class);
- suite.addTestSuite(MediaPlayerStopStateUnitTest.class);
- suite.addTestSuite(MediaPlayerSetLoopingStateUnitTest.class);
- suite.addTestSuite(MediaPlayerSetAudioStreamTypeStateUnitTest.class);
- suite.addTestSuite(MediaPlayerSetVolumeStateUnitTest.class);
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java
deleted file mode 100755
index 5e9c488..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaNames.java
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest;
-
-/**
- *
- * This class has the names of the all the activity name and variables
- * in the instrumentation test.
- *
- */
-public class MediaNames {
-
- //Audio files
- public static final String MP3CBR = "/sdcard/media_api/music/MP3CBR.mp3";
- public static final String MP3VBR = "/sdcard/media_api/music/MP3VBR.mp3";
- public static final String SHORTMP3 = "/sdcard/media_api/music/SHORTMP3.mp3";
- public static final String MIDI = "/sdcard/media_api/music/MIDI.mid";
- public static final String WMA9 = "/sdcard/media_api/music/WMA9.wma";
- public static final String WMA10 = "/sdcard/media_api/music/WMA10.wma";
- public static final String WAV = "/sdcard/media_api/music/complicated_wav.wav";
- public static final String AMR = "/sdcard/media_api/music/AMRNB.amr";
- public static final String OGG = "/sdcard/media_api/music/Mists_of_Time-4T.ogg";
- public static final String OGGSHORT = "/sdcard/media_api/music/Skippy.ogg";
-
- public static final int MP3CBR_LENGTH = 231116;
- public static final int MP3VBR_LENGTH = 126407;
- public static final int SHORTMP3_LENGTH = 286;
- public static final int MIDI_LENGTH = 210528;
- public static final int WMA9_LENGTH = 126559;
- public static final int WMA10_LENGTH = 126559;
- public static final int AMR_LENGTH = 126540;
- public static final int OGG_LENGTH = 40000;
- public static final int SEEK_TIME = 10000;
-
- public static final long PAUSE_WAIT_TIME = 3000;
- public static final long WAIT_TIME = 2000;
- public static final long WAIT_LONG = 4000;
-
- //Streaming Video
- public static final String VIDEO_HTTP3GP = "http://pvs.pv.com/jj/lipsync0.3gp";
- public static final String VIDEO_RTSP3GP = "rtsp://63.241.31.203/public/jj/md.3gp";
- public static final String VIDEO_RTSP3GP2 = "rtsp://pvs.pv.com/public/live_dvd1.3gp";
- public static final String VIDEO_RTSP3GP3 =
- "rtsp://ehug.rtsp-youtube.l.google.com/" +
- "Ci4LENy73wIaJQmeRVCJq4HuQBMYDSANFEIJbXYtZ29vZ2xlSARSB2RldGFpbHMM/0/0/0/video.3gp";
- //public static final String VIDEO_RTSP3GP = "rtsp://193.159.241.21/sp/alizee05.3gp";
-
- //local video
- public static final String VIDEO_MP4 = "/sdcard/media_api/video/gingerkids.MP4";
- public static final String VIDEO_LONG_3GP = "/sdcard/media_api/video/radiohead.3gp";
- public static final String VIDEO_SHORT_3GP = "/sdcard/media_api/video/short.3gp";
- public static final String VIDEO_LARGE_SIZE_3GP = "/sdcard/media_api/video/border_large.3gp";
- public static final String VIDEO_H263_AAC = "/sdcard/media_api/video/H263_AAC.3gp";
- public static final String VIDEO_H263_AMR = "/sdcard/media_api/video/H263_AMR.3gp";
- public static final String VIDEO_H264_AAC = "/sdcard/media_api/video/H264_AAC.3gp";
- public static final String VIDEO_H264_AMR = "/sdcard/media_api/video/H264_AMR.3gp";
- public static final String VIDEO_WMV = "/sdcard/media_api/video/bugs.wmv";
- public static final String VIDEO_HIGHRES_H263 = "/sdcard/media_api/video/h263_qcif_30fps.3gp";
- public static final String VIDEO_HIGHRES_MP4 = "/sdcard/media_api/video/mpeg4_qvga_24fps.3gp";
-
- //ringtone
- public static final String ringtone = "/sdcard/media_api/ringtones/F1_NewVoicemail.mp3";
-
- //streaming mp3
- public static final String STREAM_LARGE_MP3 =
- "http://wms.pv.com:7070/MediaDownloadContent/mp3/BuenaVista_04_Pueblo_Nuevo.mp3";
- public static final String STREAM_SMALL_MP3 =
- "http://wms.pv.com:7070/MediaDownloadContent/mp3/ID3V2_TestFile.mp3";
- public static final String STREAM_REGULAR_MP3 =
- "http://wms.pv.com:7070/MediaDownloadContent/mp3/ElectricCosmo.mp3";
-
- //streaming mp3
- public static final String STREAM_MP3_1 =
- "http://wms.pv.com:7070/MediaDownloadContent/mp3/chadthi_jawani_128kbps.mp3";
- public static final String STREAM_MP3_2 =
- "http://wms.pv.com:7070/MediaDownloadContent/mp3/dualStereo.mp3";
- public static final String STREAM_MP3_3 =
- "http://wms.pv.com:7070/mediadownloadcontent/UserUploads/15%20Keep%20Holding%20On.mp3";
- public static final String STREAM_MP3_4 =
- "http://wms.pv.com:7070/mediadownloadcontent/UserUploads/1%20-%20Apologize.mp3";
- public static final String STREAM_MP3_5 =
- "http://wms.pv.com:7070/mediadownloadcontent/UserUploads/" +
- "03%20You're%20Gonna%20Miss%20This.mp3";
- public static final String STREAM_MP3_6 =
- "http://wms.pv.com:7070/mediadownloadcontent/UserUploads" +
- "/02%20Looney%20Tunes%20%C3%82%C2%B7%20Light%20Cavalry%20Overture%20(LP%20Version).mp3";
- public static final String STREAM_MP3_7 =
- "http://wms.pv.com:7070/mediadownloadcontent/UserUploads" +
- "/01%20Love%20Song%20(Album%20Version).mp3";
- public static final String STREAM_MP3_8 =
- "http://wms.pv.com:7070/MediaDownloadContent/UserUploads/1%20-%20Apologize.mp3";
- public static final String STREAM_MP3_9 =
- "http://wms.pv.com:7070/MediaDownloadContent/UserUploads" +
- "/1%20-%20Smile%20(Explicit%20Version).mp3";
- public static final String STREAM_MP3_10 =
- "http://wms.pv.com:7070/MediaDownloadContent/UserUploads/beefcake.mp3";
-
- //Sonivox
- public static String MIDIFILES[] = {
- "/sdcard/media_api/music/Leadsol.mxmf",
- "/sdcard/media_api/music/abba.imy", "/sdcard/media_api/music/ants.mid",
- "/sdcard/media_api/music/greensleeves.rtttl", "/sdcard/media_api/music/test.ota"};
-
- //Performance measurement
- public static String[] WAVFILES = {
- "/sdcard/media_api/music_perf/WAV/M1F1-AlawWE-AFsp.wav",
- "/sdcard/media_api/music_perf/WAV/M1F1-float64-AFsp.wav",
- "/sdcard/media_api/music_perf/WAV/song.wav",
- "/sdcard/media_api/music_perf/WAV/WAVEtest.wav",
- "/sdcard/media_api/music_perf/WAV/WAVEtest_out.wav",
- "/sdcard/media_api/music_perf/WAV/test_out.wav"};
-
- public static String[] AMRNBFILES = {
- "/sdcard/media_api/music_perf/AMR/AI_AMR-NB_5.9kbps_6.24kbps_8khz_mono_NMC.amr",
- "/sdcard/media_api/music_perf/AMR/AI_AMR-NB_5.15kbps_5.46kbps_8khz_mono_NMC.amr",
- "/sdcard/media_api/music_perf/AMR/AI_AMR-NB_7.4kbps_7.80kbps_8khz_mono_NMC.amr",
- "/sdcard/media_api/music_perf/AMR/AI_AMR-NB_7.95kbps_9.6kbps_8khz_mono_NMC.amr",
- "/sdcard/media_api/music_perf/AMR/AI_AMR-NB_10.2kbps_10.48kbps_8khz_mono_NMC.amr"};
-
- public static String[] AMRWBFILES = {
- "/sdcard/media_api/music_perf/AMRWB/NIN_AMR-WB_15.85kbps_16kbps.amr",
- "/sdcard/media_api/music_perf/AMRWB/NIN_AMR-WB_18.25kbps_18kbps.amr",
- "/sdcard/media_api/music_perf/AMRWB/NIN_AMR-WB_19.85kbps_20kbps.amr",
- "/sdcard/media_api/music_perf/AMRWB/NIN_AMR-WB_23.05kbps_23kbps.amr",
- "/sdcard/media_api/music_perf/AMRWB/NIN_AMR-WB_23.85kbps_24kbps.amr",
- "/sdcard/media_api/music_perf/AMRWB/PD_AMR-WB_19.85kbps_20kbps.amr",
- "/sdcard/media_api/music_perf/AMRWB/PD_AMR-WB_23.05kbps_23kbps.amr",
- "/sdcard/media_api/music_perf/AMRWB/PD_AMR-WB_23.85kbps_24kbps.amr",
- "/sdcard/media_api/music_perf/AMRWB/WC_AMR-WB_23.05kbps_23kbps.amr",
- "/sdcard/media_api/music_perf/AMRWB/WC_AMR-WB_23.85kbps_24kbps.amr", };
-
- public static String[] MP3FILES = {
- "/sdcard/media_api/music_perf/MP3/NIN_56kbps_32khz_stereo_VBR_MCA.MP3",
- "/sdcard/media_api/music_perf/MP3/NIN_80kbps_32khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/NIN_80kbps_44.1khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/NIN_80kbps_48khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/NIN_112kbps_32khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/NIN_112kbps_44.1khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/NIN_112kbps_48khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/NIN_192kbps_32khz_mono_CBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/NIN_192kbps_44.1khz_mono_CBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/NIN_192kbps_48khz_mono_CBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/NIN_256kbps_44.1khz_mono_CBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/NIN_256kbps_48khz_mono_CBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/PD_112kbps_32khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/PD_112kbps_44.1khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/PD_112kbps_48khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/PD_192kbps_32khz_mono_CBR_DPA.mp3",
- "/sdcard/media_api/music_perf/MP3/PD_256kbps_44.1khz_mono_CBR_DPA.mp3",
- "/sdcard/media_api/music_perf/MP3/PD_256kbps_48khz_mono_CBR_MCA.mp3",
- "/sdcard/media_api/music_perf/MP3/WC_256kbps_44.1khz_mono_CBR_DPA.mp3",
- "/sdcard/media_api/music_perf/MP3/WC_256kbps_48khz_mono_CBR_DPA.mp3",
- "/sdcard/media_api/music_perf/regular_album_photo/Apologize.mp3",
- "/sdcard/media_api/music_perf/regular_album_photo/Because_Of_You.mp3",
- "/sdcard/media_api/music_perf/regular_album_photo/Complicated.mp3",
- "/sdcard/media_api/music_perf/regular_album_photo/Glamorous.mp3",
- "/sdcard/media_api/music_perf/regular_album_photo/Im_With_You.mp3",
- "/sdcard/media_api/music_perf/regular_album_photo/Smile.mp3",
- "/sdcard/media_api/music_perf/regular_album_photo/Suddenly_I_See.mp3",
- "/sdcard/media_api/music_perf/regular_album_photo/When You Say Nothing At All.mp3",
- "/sdcard/media_api/music_perf/regular_album_photo/my_happy_ending.mp3"};
-
- public static String[] AACFILES = {
- "/sdcard/media_api/music_perf/AAC/AI_AAC_24kbps_12khz_Mono_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/AI_AAC_56kbps_22.05khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/AI_AAC_56kbps_32khz_Stereo_CBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/AI_AAC_56kbps_44.1khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/AI_AAC_80kbps_32khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/AI_AAC_80kbps_32khz_Stereo_CBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/NIN_AAC_56kbps_22.05khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/NIN_AAC_56kbps_32khz_Stereo_CBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/NIN_AAC_56kbps_44.1khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/NIN_AAC_80kbps_32khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/NIN_AAC_80kbps_32khz_Stereo_CBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/PD_AAC_56kbps_22.05khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/PD_AAC_56kbps_32khz_Stereo_CBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/PD_AAC_56kbps_44.1khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/PD_AAC_80kbps_32khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/PD_AAC_80kbps_32khz_Stereo_CBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/PV_AAC_56kbps_22.05khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/PV_AAC_56kbps_32khz_Stereo_CBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/PV_AAC_56kbps_44.1khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/PV_AAC_80kbps_32khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/PV_AAC_80kbps_32khz_Stereo_CBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/WC_AAC_56kbps_22.05khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/WC_AAC_56kbps_32khz_Stereo_CBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/WC_AAC_56kbps_44.1khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/WC_AAC_80kbps_32khz_Stereo_1pCBR_SSE.mp4",
- "/sdcard/media_api/music_perf/AAC/WC_AAC_80kbps_32khz_Stereo_CBR_SSE.mp4",
- };
-
- public static String[] VIDEOFILES = { "/sdcard/media_api/video_perf/AI_CTO_Mpeg4_32kbps_10fps_SQCIF_128x96+AAC_8kbps_8khz_mono_QTE.mp4",
- "/sdcard/media_api/video_perf/AI_CTO_Mpeg4_32kbps_12fps_SQCIF_128x96+AAC_8kbps_8khz_mono_QTE.mp4",
- "/sdcard/media_api/video_perf/AI_CTO_Mpeg4_32kbps_15fps_SQCIF_128x96+AAC_8kbps_8khz_mono_QTE.mp4",
- "/sdcard/media_api/video_perf/AI_CTO_Mpeg4_32kbps_5fps_SQCIF_128x96+AAC_8kbps_8khz_mono_QTE.mp4",
- "/sdcard/media_api/video_perf/AI_CTO_Mpeg4_32kbps_5fps_SQCIF_128x96+AAC_8kbps_8khz_mono_SSE.mp4",
- "/sdcard/media_api/video_perf/AI_CTO_Mpeg4_32kbps_7.5fps_SQCIF_128x96+AAC_8kbps_8khz_mono_QTE.mp4",
- "/sdcard/media_api/video_perf/AI_WMV_1024kbps_20fps_QCIF_176x144_noaudio_SSE.wmv",
- "/sdcard/media_api/video_perf/AI_WMV_1024kbps_25fps_QCIF_176x144_noaudio_SSE.wmv",
- "/sdcard/media_api/video_perf/Chicken.wmv",
- "/sdcard/media_api/video_perf/MP_qcif_15fps_100kbps_48kHz_192kbps_30secs.wmv",
- "/sdcard/media_api/video_perf/NIN_CTO_H264_123kbps_5fps_QCIF_176x144+AMR_12.2kbps_8khz_mono_QTE.3gp",
- "/sdcard/media_api/video_perf/NIN_CTO_H264_96kbps_10.2fps_QCIF_176x144+AMR_12.2kbps_8khz_mono_QTE.3gp",
- "/sdcard/media_api/video_perf/NIN_CTO_H264_96kbps_12fps_QCIF_176x144+AMR_12.2kbps_8khz_mono_QTE.3gp",
- "/sdcard/media_api/video_perf/NIN_CTO_H264_96kbps_15fps_QCIF_176x144+AMR_12.2kbps_8khz_mono_QTE.3gp",
- "/sdcard/media_api/video_perf/NIN_CTO_Mpeg4_123kbps_15fps_QCIF_176x144+AAC_32kbps_22khz_mono_SSE.3gp",
- "/sdcard/media_api/video_perf/NIN_CTO_Mpeg4_123kbps_7.5fps_QCIF_176x144+AAC_32kbps_22khz_stereo_SSE.3gp",
- "/sdcard/media_api/video_perf/NIN_CTO_Mpeg4_128kbps_10fps_QCIF_176x144+AAC+_32kbps_48khz_stereo_SSE.3gp",
- "/sdcard/media_api/video_perf/NIN_CTO_Mpeg4_128kbps_12fps_QCIF_176x144+AAC+_32kbps_48khz_stereo_SSE.3gp",
- "/sdcard/media_api/video_perf/NIN_CTO_Mpeg4_128kbps_15fps_QCIF_176x144+AAC+_32kbps_48khz_stereo_SSE.3gp",
- "/sdcard/media_api/video_perf/NIN_CTO_Mpeg4_128kbps_5fps_QCIF_176x144+AAC+_32kbps_48khz_stereo_SSE.3gp",
- "/sdcard/media_api/video_perf/NIN_CTO_Mpeg4_128kbps_7.5fps_QCIF_176x144+AAC+_32kbps_48khz_stereo_SSE.3gp",
- "/sdcard/media_api/video_perf/NIN_H263_128kbps_10fps_QCIF_174x144_noaudio_SSE.mp4",
- "/sdcard/media_api/video_perf/NIN_H263_128kbps_15fps_QCIF_174x144_noaudio_SSE.mp4",
- "/sdcard/media_api/video_perf/NIN_H263_48kbps_10fps_QCIF_174x144_noaudio_SSE.3gp",
- "/sdcard/media_api/video_perf/NIN_H263_48kbps_12fps_QCIF_174x144_noaudio_SSE.3gp",
- "/sdcard/media_api/video_perf/NIN_H264_123kbps_15fps_QCIF_176x144+AAC_32kbps_22khz_stereo_SSE.3gp",
- "/sdcard/media_api/video_perf/NIN_H264_123kbps_7.5fps_QCIF_176x144+AAC_32kbps_22khz_stereo_SSE.3gp",
- "/sdcard/media_api/video_perf/PV_H264_2000kbps_20fps_CIF_352x288+AAC_96kbps_48khz_stereo_SSE.mp4",
- "/sdcard/media_api/video_perf/PV_H264_2000kbps_25fps_CIF_352x288+AAC_96kbps_48khz_stereo_SSE.mp4",
- "/sdcard/media_api/video_perf/PV_H264_2000kbps_30fps_CIF_352x288+AAC_128kbps_48khz_stereo_SSE.mp4",
- "/sdcard/media_api/video_perf/Stevie-1.wmv",
- "/sdcard/media_api/video_perf/WC_H264_1600kbps_20fps_QCIF_176x144+AAC_96kbps_48khz_mono_SSE.mp4",
- "/sdcard/media_api/video_perf/WC_H264_1600kbps_25fps_QCIF_176x144+AAC_96kbps_48khz_mono_SSE.mp4",
- "/sdcard/media_api/video_perf/WC_H264_1600kbps_30fps_QCIF_176x144+AAC_96kbps_48khz_mono_SSE.mp4",
- "/sdcard/media_api/video_perf/bugs.wmv",
- "/sdcard/media_api/video_perf/niceday.wmv",
- "/sdcard/media_api/video_perf/eaglesatopnflpe.wmv",
-
- };
-
- //wma - only support up to wma 9
- public static String[] WMASUPPORTED = {
- "/sdcard/media_api/music_perf/WMASUPPORTED/AI_WMA9.2_32kbps_44.1khz_mono_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMASUPPORTED/AI_WMA9.2_48kbps_44.1khz_mono_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMASUPPORTED/NIN_WMA9.2_32kbps_44.1khz_mono_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMASUPPORTED/NIN_WMA9.2_48kbps_44.1khz_mono_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMASUPPORTED/PD_WMA9.2_32kbps_44.1khz_mono_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMASUPPORTED/PD_WMA9.2_48kbps_44.1khz_mono_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMASUPPORTED/PV_WMA9.2_32kbps_44.1khz_mono_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMASUPPORTED/PV_WMA9.2_48kbps_44.1khz_mono_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMASUPPORTED/WC_WMA9.2_32kbps_44.1khz_mono_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMASUPPORTED/WC_WMA9.2_48kbps_44.1khz_mono_CBR_DPA.wma"
-
- };
-
- public static String[] WMAUNSUPPORTED = {
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_127kbps_48khz_stereo_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_128kbps_44.1khz_stereo_2pVBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_128kbps_48khz_stereo_2pVBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_128kbps_88khz_stereo_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_128kbps_96khz_stereo_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_192kbps_44.1khz_stereo_2pVBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_192kbps_88khz_stereo_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_192kbps_96khz_stereo_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_256kbps_44khz_stereo_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_256kbps_48khz_stereo_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_256kbps_88khz_stereo_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_256kbps_96khz_stereo_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_384kbps_44khz_stereo_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_384kbps_48khz_stereo_CBR_DPA.wma",
- "/sdcard/media_api/music_perf/WMAUNSUPPORTED/AI_WMA10_384kbps_88khz_stereo_CBR_DPA.wma"
- };
-
- //Media Recorder
- public static final String RECORDER_OUTPUT = "/sdcard/media_api/recorderOutput.amr";
-
- //video thumbnail
- public static final String THUMBNAIL_OUTPUT = "/sdcard/media_api/videoThumbnail.png";
- public static final String GOLDEN_THUMBNAIL_OUTPUT = "/sdcard/media_api/goldenThumbnail.png";
-
- //Metadata Utility
- public static final String[] THUMBNAIL_CAPTURE_TEST_FILES = {
- "/sdcard/media_api/metadata/test.mp4",
- "/sdcard/media_api/metadata/test1.3gp",
- "/sdcard/media_api/metadata/test2.3gp",
- "/sdcard/media_api/metadata/test3.3gp",
- "/sdcard/media_api/metadata/test4.3gp",
- "/sdcard/media_api/metadata/test5.3gp",
- "/sdcard/media_api/metadata/test6.3gp",
- "/sdcard/media_api/metadata/test7.3gp",
- "/sdcard/media_api/metadata/test8.3gp",
- "/sdcard/media_api/metadata/test9.3gp",
- "/sdcard/media_api/metadata/test10.3gp",
- "/sdcard/media_api/metadata/test11.3gp",
- "/sdcard/media_api/metadata/test12.3gp",
- "/sdcard/media_api/metadata/test13.3gp",
- "/sdcard/media_api/metadata/test14.3gp",
- "/sdcard/media_api/metadata/test15.3gp",
- "/sdcard/media_api/metadata/test16.3gp",
- "/sdcard/media_api/metadata/test17.3gp",
- "/sdcard/media_api/metadata/test18.3gp",
- "/sdcard/media_api/metadata/test19.3gp",
- "/sdcard/media_api/metadata/test20.3gp",
- "/sdcard/media_api/metadata/test21.3gp",
- "/sdcard/media_api/metadata/test22.3gp",
- "/sdcard/media_api/metadata/test23.3gp",
- "/sdcard/media_api/metadata/test24.3gp",
- "/sdcard/media_api/metadata/test25.3gp",
- "/sdcard/media_api/metadata/test26.3gp",
- "/sdcard/media_api/metadata/test27.3gp",
- "/sdcard/media_api/metadata/test28.3gp",
- "/sdcard/media_api/metadata/test29.3gp",
- "/sdcard/media_api/metadata/test30.3gp",
- "/sdcard/media_api/metadata/test31.3gp",
- "/sdcard/media_api/metadata/test32.3gp",
- "/sdcard/media_api/metadata/test33.3gp",
- "/sdcard/media_api/metadata/test35.mp4",
- "/sdcard/media_api/metadata/test36.m4v",
- "/sdcard/media_api/metadata/test34.wmv",
- "/sdcard/media_api/metadata/test_metadata.mp4",
- };
-
- public static final String[] METADATA_RETRIEVAL_TEST_FILES = {
- // Raw AAC is not supported
- // "/sdcard/media_api/test_raw.aac",
- // "/sdcard/media_api/test_adts.aac",
- // "/sdcard/media_api/test_adif.aac",
- "/sdcard/media_api/metadata/test_metadata.mp4",
- "/sdcard/media_api/metadata/WMA10.wma",
- "/sdcard/media_api/metadata/Leadsol_out.wav",
- "/sdcard/media_api/metadata/test_aac.mp4",
- "/sdcard/media_api/metadata/test_amr.mp4",
- "/sdcard/media_api/metadata/test_avc_amr.mp4",
- "/sdcard/media_api/metadata/test_metadata.mp4",
- "/sdcard/media_api/metadata/test_vbr.mp3",
- "/sdcard/media_api/metadata/test_cbr.mp3",
- "/sdcard/media_api/metadata/metadata_test1.mp3",
- "/sdcard/media_api/metadata/test33.3gp",
- "/sdcard/media_api/metadata/test35.mp4",
- "/sdcard/media_api/metadata/test36.m4v",
- "/sdcard/media_api/metadata/test_m4v_amr.mp4",
- "/sdcard/media_api/metadata/test_h263_amr.mp4",
- "/sdcard/media_api/metadata/test34.wmv",
- };
-
- public static final String[] ALBUMART_TEST_FILES = {
- "/sdcard/media_api/album_photo/test_22_16_mp3.mp3",
- "/sdcard/media_api/album_photo/PD_256kbps_48khz_mono_CBR_MCA.mp3",
- "/sdcard/media_api/album_photo/PD_256kbps_44.1khz_mono_CBR_DPA.mp3",
- "/sdcard/media_api/album_photo/PD_192kbps_32khz_mono_CBR_DPA.mp3",
- "/sdcard/media_api/album_photo/NIN_256kbps_48khz_mono_CBR_MCA.mp3",
- "/sdcard/media_api/album_photo/NIN_256kbps_44.1khz_mono_CBR_MCA.mp3",
- "/sdcard/media_api/album_photo/NIN_112kbps(96kbps)_48khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/album_photo/NIN_112kbps(96kbps)_44.1khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/album_photo/lightGreen1.mp3",
- "/sdcard/media_api/album_photo/babyBlue2 1.mp3",
- "/sdcard/media_api/album_photo/2-01 01 NIN_56kbps(64kbps)_32khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/album_photo/02_NIN_112kbps(80kbps)_32khz_stereo_VBR_MCA.mp3",
- "/sdcard/media_api/album_photo/No_Woman_No_Cry_128K.wma",
- "/sdcard/media_api/album_photo/Beethoven_2.wma",
- };
-
- //TEST_PATH_1: is a video and contains metadata for key "num-tracks"
- // TEST_PATH_2: any valid media file.
- // TEST_PATH_3: invalid media file
- public static final String TEST_PATH_1 = "/sdcard/media_api/metadata/test.mp4";
- public static final String TEST_PATH_3 = "/sdcard/media_api/data.txt";
- public static final String TEST_PATH_4 = "somenonexistingpathname";
- public static final String TEST_PATH_5 = "mem://012345";
-
- //Meta data expected result
- //The expected tag result in the following order
- //cd_track_number, album, artist, author, composer, date, genre
- //title, years, duration
- public static final String META_DATA_MP3 [][] = {
- {"/sdcard/media_api/metaDataTestMedias/MP3/ID3V1_ID3V2.mp3", "1/10", "ID3V2.3 Album", "ID3V2.3 Artist",
- "ID3V2.3 Lyricist", "ID3V2.3 Composer", null, "Blues",
- "ID3V2.3 Title", "1234", "321", "1"},
- {"/sdcard/media_api/metaDataTestMedias/MP3/ID3V2.mp3", "1/10", "ID3V2.3 Album", "ID3V2.3 Artist",
- "ID3V2.3 Lyricist", "ID3V2.3 Composer", null, "Blues",
- "ID3V2.3 Title", "1234", "313", "1"},
- {"/sdcard/media_api/metaDataTestMedias/MP3/ID3V1.mp3", null, "test ID3V1 Album", "test ID3V1 Artist",
- null, null, null, null, "test ID3V1 Title", "1234", "231332", "1"},
- {"/sdcard/media_api/metaDataTestMedias/MP3/Corrupted_ID3V1.mp3" , null, null, null,
- null, null, null, null, null, null, "231330", "1"},
- //The corrupted TALB field in id3v2 would not switch to id3v1 tag automatically
- {"/sdcard/media_api/metaDataTestMedias/MP3/Corrupted_ID3V2_TALB.mp3", "01", null, "ID3V2.3 Artist",
- "ID3V2.3 Lyricist", "ID3V2.3 Composer", null,
- "Blues", "ID3V2.3 Title", "1234", "321", "1"},
- {"/sdcard/media_api/metaDataTestMedias/MP3/Corrupted_ID3V2_TCOM.mp3", "01", "ID3V2.3 Album",
- "ID3V2.3 Artist", "ID3V2.3 Lyricist", null, null,
- "Blues", "ID3V2.3 Title", "1234", "321", "1"},
- {"/sdcard/media_api/metaDataTestMedias/MP3/Corrupted_ID3V2_TCOM_2.mp3", "01", "ID3V2.3 Album",
- "ID3V2.3 Artist", null, null, null, "Blues", "ID3V2.3 Title", "1234", "321", "1"},
- {"/sdcard/media_api/metaDataTestMedias/MP3/Corrupted_ID3V2_TRCK.mp3", "dd", "ID3V2.3 Album",
- "ID3V2.3 Artist", "ID3V2.3 Lyricist", "ID3V2.3 Composer", null,
- "Blues", "ID3V2.3 Title", "1234", "321", "1"},
- {"/sdcard/media_api/metaDataTestMedias/MP3/Corrupted_ID3V2_TRCK_2.mp3", "01", "ID3V2.3 Album",
- "ID3V2.3 Artist", null, null, null, null, "ID3V2.3 Title", null, "321", "1"},
- {"/sdcard/media_api/metaDataTestMedias/MP3/Corrupted_ID3V2_TYER.mp3", "01", "ID3V2.3 Album",
- "ID3V2.3 Artist", null, null, null, null, "ID3V2.3 Title", "9999", "321", "1"},
- {"/sdcard/media_api/metaDataTestMedias/MP3/Corrupted_ID3V2_TYER_2.mp3", "01", "ID3V2.3 Album",
- "ID3V2.3 Artist", "ID3V2.3 Lyricist", "ID3V2.3 Composer", null,
- "Blues", "ID3V2.3 Title", null, "321", "1"},
- {"/sdcard/media_api/metaDataTestMedias/MP3/Corrupted_ID3V2_TIT.mp3", null, null, null,
- null, null, null, null, null, null, "577", "1"}
- };
-
- public static final String META_DATA_OTHERS [][] = {
- {"/sdcard/media_api/metaDataTestMedias/3GP/cat.3gp", null, null, null,
- null, null, "20080309T002415.000Z", null,
- null, null, "1404928", "2"},
- {"/sdcard/media_api/metaDataTestMedias/AMR/AMR_NB.amr", null, null, null,
- null, null, null, null,
- null, null, "126540", "1"},
- {"/sdcard/media_api/metaDataTestMedias/AMRWB/AMR_WB.amr", null, null, null,
- null, null, null, null,
- null, null, "231180", "1"},
- {"/sdcard/media_api/metaDataTestMedias/M4A/Jaws Of Life_ver1.m4a", null, "Suspended Animation",
- "John Petrucci", null, null, "20070510T125223.000Z",
- null, null, "2005", "231180", "1"},
- {"/sdcard/media_api/metaDataTestMedias/M4V/sample_iPod.m4v", null, null,
- null, null, null, "20051220T202015.000Z",
- null, null, null, "3771392", "2"},
- {"/sdcard/media_api/metaDataTestMedias/MIDI/MIDI.mid", null, "Suspended Animation",
- "John Petrucci", null, null, "20070510T125223.000Z",
- null, null, "2005", "231180", "1"},
- {"/sdcard/media_api/metaDataTestMedias/MP4/kung_fu_panda_h264.mp4", null, "mp4 album Kung Fu Panda",
- "mp4 artist Kung Fu Panda", null, null, "20080517T091451.000Z",
- "Kung Fu Panda", "Kung Fu Panda", "2008", "5667840", "2"},
- {"/sdcard/media_api/metaDataTestMedias/OGG/Ring_Classic_02.ogg", null, "Suspended Animation",
- "John Petrucci", null, null, "20070510T125223.000Z",
- null, null, "2005", "231180", "1"},
- {"/sdcard/media_api/metaDataTestMedias/OGG/When You Say Nothing At All.ogg",
- null, "Suspended Animation", "John Petrucci",
- null, null, "20070510T125223.000Z", null, null, "2005", "231180", "1"},
- {"/sdcard/media_api/metaDataTestMedias/WAV/Im With You.wav", null, null,
- null, null, null, null,
- null, null, null, "224000", "1"},
- {"/sdcard/media_api/metaDataTestMedias/WMA/WMA9.wma", "6", "Ten Songs in the Key of Betrayal",
- "Alien Crime Syndicate", "Alien Crime Syndicate",
- "wma 9 Composer", "20040521T175729.483Z",
- "Rock", "Run for the Money", "2004", "134479", "1"},
- {"/sdcard/media_api/metaDataTestMedias/WMA/WMA10.wma", "09", "wma 10 Album",
- "wma 10 Album Artist", "wma 10 Artist", "wma 10 Composer", "20070705T063625.097Z",
- "Acid Jazz", "wma 10 Title", "2010", "126574", "1"},
- {"/sdcard/media_api/metaDataTestMedias/WMV/bugs.wmv", "8", "wmv 9 Album",
- null, "wmv 9 Artist ", null, "20051122T155247.540Z",
- null, "Looney Tunes - Hare-Breadth Hurry", "2005", "193482", "2"},
- {"/sdcard/media_api/metaDataTestMedias/WMV/clips_ver7.wmv", "50", "wmv 7 Album",
- null, "Hallau Shoots & Company", null, "20020226T170045.891Z",
- null, "CODEC Shootout", "1986", "43709", "2"}
- };
-
- //output recorded video
-
- public static final String RECORDED_HVGA_H263 = "/sdcard/HVGA_H263.3gp";
- public static final String RECORDED_QVGA_H263 = "/sdcard/QVGA_H263.3gp";
- public static final String RECORDED_SQVGA_H263 = "/sdcard/SQVGA_H263.3gp";
- public static final String RECORDED_CIF_H263 = "/sdcard/CIF_H263.3gp";
- public static final String RECORDED_QCIF_H263 = "/sdcard/QCIF_H263.3gp";
-
- public static final String RECORDED_HVGA_MP4 = "/sdcard/HVGA_mp4.mp4";
- public static final String RECORDED_QVGA_MP4 = "/sdcard/QVGA_mp4.mp4";
- public static final String RECORDED_SQVGA_MP4 = "/sdcard/SQVGA_mp4.mp4";
- public static final String RECORDED_CIF_MP4 = "/sdcard/CIF_mp4.mp4";
- public static final String RECORDED_QCIF_MP4 = "/sdcard/QCIF_mp4.mp4";
-
- public static final String RECORDED_VIDEO_3GP = "/sdcard/temp.3gp";
-
- public static final String INVALD_VIDEO_PATH = "/sdcard/media_api/filepathdoesnotexist" +
- "/filepathdoesnotexist/temp.3gp";
-
-
- public static final long RECORDED_TIME = 5000;
- public static final long VALID_VIDEO_DURATION = 2000;
-
- //Videos for the mediaplayer stress test
- public static String[] H263_STRESS = {
- "/sdcard/media_api/video_stress/h263/H263_CIF.3gp",
- "/sdcard/media_api/video_stress/h263/H263_QCIF.3gp",
- "/sdcard/media_api/video_stress/h263/H263_QVGA.3gp",
- "/sdcard/media_api/video_stress/h263/H263_SQVGA.3gp"
- };
-
- public static String[] MPEG4_STRESS = {
- "/sdcard/media_api/video_stress/h263/mpeg4_CIF.mp4",
- "/sdcard/media_api/video_stress/h263/mpeg4_QCIF.3gp",
- "/sdcard/media_api/video_stress/h263/mpeg4_QVGA.3gp",
- "/sdcard/media_api/video_stress/h263/mpeg4_SQVGA.mp4"
- };
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaRecorderStressTestRunner.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaRecorderStressTestRunner.java
deleted file mode 100755
index 12eacd3..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaRecorderStressTestRunner.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest;
-
-import android.test.InstrumentationTestRunner;
-import android.test.InstrumentationTestSuite;
-import com.android.mediaframeworktest.stress.MediaRecorderStressTest;
-
-import junit.framework.TestSuite;
-
-public class MediaRecorderStressTestRunner extends InstrumentationTestRunner {
-
- @Override
- public TestSuite getAllTests() {
- TestSuite suite = new InstrumentationTestSuite(this);
- suite.addTestSuite(MediaRecorderStressTest.class);
- return suite;
- }
-
- @Override
- public ClassLoader getLoader() {
- return MediaRecorderStressTestRunner.class.getClassLoader();
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java
deleted file mode 100644
index 5981a13..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.functional;
-
-import com.android.mediaframeworktest.MediaFrameworkTest;
-import com.android.mediaframeworktest.MediaNames;
-
-import java.io.*;
-
-import android.content.Context;
-import android.hardware.Camera;
-import android.hardware.Camera.PictureCallback;
-import android.hardware.Camera.PreviewCallback;
-import android.hardware.Camera.ShutterCallback;
-import android.test.ActivityInstrumentationTestCase;
-import android.util.Log;
-import android.view.SurfaceHolder;
-
-import android.os.Looper;
-
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Junit / Instrumentation test case for the camera api
-
- */
-public class CameraTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> {
- private String TAG = "CameraTest";
-
- private boolean rawPreviewCallbackResult = false;
- private boolean shutterCallbackResult = false;
- private boolean rawPictureCallbackResult = false;
- private boolean jpegPictureCallbackResult = false;
-
- private static int WAIT_FOR_COMMAND_TO_COMPLETE = 10000; // Milliseconds.
-
- private RawPreviewCallback mRawPreviewCallback = new RawPreviewCallback();
- private TestShutterCallback mShutterCallback = new TestShutterCallback();
- private RawPictureCallback mRawPictureCallback = new RawPictureCallback();
- private JpegPictureCallback mJpegPictureCallback = new JpegPictureCallback();
-
- private boolean mInitialized = false;
- private Looper mLooper = null;
- private final Object lock = new Object();
- private final Object previewDone = new Object();
-
- Camera mCamera;
- Context mContext;
-
- public CameraTest() {
- super("com.android.mediaframeworktest", MediaFrameworkTest.class);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- /*
- * Initializes the message looper so that the Camera object can
- * receive the callback messages.
- */
- private void initializeMessageLooper() {
- Log.v(TAG, "start looper");
- new Thread() {
- @Override
- public void run() {
- // Set up a looper to be used by camera.
- Looper.prepare();
- Log.v(TAG, "start loopRun");
- // Save the looper so that we can terminate this thread
- // after we are done with it.
- mLooper = Looper.myLooper();
- mCamera = Camera.open();
- synchronized (lock) {
- mInitialized = true;
- lock.notify();
- }
- Looper.loop(); // Blocks forever until Looper.quit() is called.
- Log.v(TAG, "initializeMessageLooper: quit.");
- }
- }.start();
- }
-
- /*
- * Terminates the message looper thread.
- */
- private void terminateMessageLooper() {
- mLooper.quit();
- mCamera.release();
- }
-
- //Implement the previewCallback
- private final class RawPreviewCallback implements PreviewCallback {
- public void onPreviewFrame(byte [] rawData, Camera camera) {
- Log.v(TAG, "Preview callback start");
- int rawDataLength = 0;
- if (rawData != null) {
- rawDataLength = rawData.length;
- }
- if (rawDataLength > 0) {
- rawPreviewCallbackResult = true;
- } else {
- rawPreviewCallbackResult = false;
- }
- synchronized (previewDone) {
- Log.v(TAG, "notify the preview callback");
- previewDone.notify();
- }
-
- Log.v(TAG, "Preview callback stop");
- }
- };
-
- //Implement the shutterCallback
- private final class TestShutterCallback implements ShutterCallback {
- public void onShutter() {
- shutterCallbackResult = true;
- Log.v(TAG, "onShutter called");
- }
- };
-
- //Implement the RawPictureCallback
- private final class RawPictureCallback implements PictureCallback {
- public void onPictureTaken(byte [] rawData, Camera camera) {
- if (rawData != null) {
- rawPictureCallbackResult = true;
- } else {
- rawPictureCallbackResult = false;
- }
- Log.v(TAG, "RawPictureCallback callback");
- }
- };
-
- //Implement the JpegPictureCallback
- private final class JpegPictureCallback implements PictureCallback {
- public void onPictureTaken(byte [] rawData, Camera camera) {
- try {
- if (rawData != null) {
- int rawDataLength = rawData.length;
- File rawoutput = new File("/sdcard/test.bmp");
- FileOutputStream outstream = new FileOutputStream(rawoutput);
- outstream.write(rawData);
- Log.v(TAG, "JpegPictureCallback rawDataLength = " + rawDataLength);
- jpegPictureCallbackResult = true;
- } else {
- jpegPictureCallbackResult = false;
- }
- Log.v(TAG, "Jpeg Picture callback");
- } catch (Exception e) {
- Log.v(TAG, e.toString());
- }
- }
- };
-
-
- private void checkTakePicture() {
- SurfaceHolder mSurfaceHolder;
- try {
- mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
- Log.v(TAG, "Start preview");
- mCamera.startPreview();
- synchronized (previewDone) {
- try {
- previewDone.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- Log.v(TAG, "Preview Done");
- } catch (Exception e) {
- Log.v(TAG, "wait was interrupted.");
- }
- }
- mCamera.setPreviewCallback(null);
- mCamera.takePicture(mShutterCallback, mRawPictureCallback, mJpegPictureCallback);
- Thread.sleep(MediaNames.WAIT_LONG);
- } catch (Exception e) {
- Log.v(TAG, e.toString());
- }
- }
-
- private void checkPreviewCallback() {
- SurfaceHolder mSurfaceHolder;
- try {
- mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
- Log.v(TAG, "start preview");
- mCamera.startPreview();
- synchronized (previewDone) {
- try {
- previewDone.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- Log.v(TAG, "setPreview done");
- } catch (Exception e) {
- Log.v(TAG, "wait was interrupted.");
- }
- }
- mCamera.setPreviewCallback(null);
- } catch (Exception e) {
- Log.v(TAG, e.toString());
- }
- }
-
- /*
- * TODO(yslau): Need to setup the golden rawData and compare the
- * the new captured rawData with the golden one.
- *
- * Test case 1: Take a picture and verify all the callback
- * functions are called properly.
- */
- @LargeTest
- public void testTakePicture() throws Exception {
- initializeMessageLooper();
- synchronized (lock) {
- try {
- lock.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch(Exception e) {
- Log.v(TAG, "runTestOnMethod: wait was interrupted.");
- }
- }
- mCamera.setPreviewCallback(mRawPreviewCallback);
- checkTakePicture();
- terminateMessageLooper();
- assertTrue("shutterCallbackResult", shutterCallbackResult);
- assertTrue("rawPictureCallbackResult", rawPictureCallbackResult);
- assertTrue("jpegPictureCallbackResult", jpegPictureCallbackResult);
- }
-
- /*
- * Test case 2: Set the preview and
- * verify the RawPreviewCallback is called
- */
- @LargeTest
- public void testCheckPreview() throws Exception {
- initializeMessageLooper();
- synchronized (lock) {
- try {
- lock.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch(Exception e) {
- Log.v(TAG, "wait was interrupted.");
- }
- }
- mCamera.setPreviewCallback(mRawPreviewCallback);
- checkPreviewCallback();
- terminateMessageLooper();
- assertTrue("RawPreviewCallbackResult", rawPreviewCallbackResult);
- }
-
-}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CodecTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CodecTest.java
deleted file mode 100644
index 0e88719..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CodecTest.java
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.functional;
-
-
-
-//import android.content.Resources;
-import com.android.mediaframeworktest.MediaFrameworkTest;
-import com.android.mediaframeworktest.MediaNames;
-
-import android.content.res.AssetFileDescriptor;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.media.MediaMetadataRetriever;
-import android.media.MediaPlayer;
-import android.media.MediaRecorder;
-import android.os.SystemClock;
-import android.util.Log;
-
-import java.io.IOException;
-import java.io.InputStream;
-/**
- * Junit / Instrumentation test case for the media player api
-
- */
-public class CodecTest {
- private static String TAG = "MediaPlayerApiTest";
-
- public static String printCpuInfo(){
- String cm = "dumpsys cpuinfo";
- String cpuinfo =null;
- int ch;
- try{
- Process p = Runtime.getRuntime().exec(cm);
- InputStream in = p.getInputStream();
- StringBuffer sb = new StringBuffer(512);
- while ( ( ch = in.read() ) != -1 ){
- sb.append((char) ch);
- }
- cpuinfo = sb.toString();
- }catch (IOException e){
- Log.v(TAG, e.toString());
- }
- return cpuinfo;
- }
-
-
- public static int getDuration(String filePath) {
- Log.v(TAG, "getDuration - " + filePath);
- MediaPlayer mp = new MediaPlayer();
- try{
- mp.setDataSource(filePath);
- mp.prepare();
- }catch (Exception e){}
- int duration = mp.getDuration();
- Log.v(TAG, "Duration " + duration);
- mp.release();
- Log.v(TAG, "release");
- return duration;
- }
-
- public static boolean getCurrentPosition(String filePath){
- Log.v(TAG, "GetCurrentPosition - " + filePath);
- int currentPosition = 0;
- long t1=0;
- long t2 =0;
- MediaPlayer mp = new MediaPlayer();
- try{
- mp.setDataSource(filePath);
- Log.v(TAG, "start playback");
- mp.prepare();
- mp.start();
- t1=SystemClock.uptimeMillis();
- Thread.sleep(10000);
- mp.pause();
- Thread.sleep(MediaNames.PAUSE_WAIT_TIME);
- t2=SystemClock.uptimeMillis();
- }catch (Exception e){
- Log.v(TAG, e.toString());
- }
- currentPosition = mp.getCurrentPosition();
- mp.stop();
- mp.release();
- Log.v(TAG, "mp currentPositon = " + currentPosition + " play duration = " + (t2-t1));
- //The currentposition should be within 10% of the sleep time
- //For the very short mp3, it should return the length instead of 10 seconds
- if (filePath.equals(MediaNames.SHORTMP3)){
- if (currentPosition < 1000 )
- return true;
- }
- if ((currentPosition < ((t2-t1) *1.2)) && (currentPosition > 0))
- return true;
- else
- return false;
- }
-
- public static boolean seekTo(String filePath){
- Log.v(TAG, "seekTo " + filePath);
- int currentPosition = 0;
- MediaPlayer mp = new MediaPlayer();
- try{
- mp.setDataSource(filePath);
- mp.prepare();
- mp.start();
- mp.seekTo(MediaNames.SEEK_TIME);
- Thread.sleep(MediaNames.WAIT_TIME);
- currentPosition = mp.getCurrentPosition();
- }catch (Exception e){
- Log.v(TAG, e.getMessage());
- }
- mp.stop();
- mp.release();
- Log.v(TAG, "CurrentPosition = " + currentPosition);
- //The currentposition should be at least greater than the 80% of seek time
- if ((currentPosition > MediaNames.SEEK_TIME *0.8))
- return true;
- else
- return false;
- }
-
- public static boolean setLooping(String filePath){
- int currentPosition = 0;
- int duration = 0;
- long t1 =0;
- long t2 =0;
- Log.v (TAG, "SetLooping - " + filePath);
- MediaPlayer mp = new MediaPlayer();
- try{
- mp.setDataSource(filePath);
- mp.prepare();
- duration = mp.getDuration();
- Log.v(TAG, "setLooping duration " + duration);
- mp.setLooping(true);
- mp.start();
- Thread.sleep(5000);
- mp.seekTo(duration - 5000);
- t1=SystemClock.uptimeMillis();
- Thread.sleep(20000);
- t2=SystemClock.uptimeMillis();
- Log.v(TAG, "pause");
- //Bug# 1106852 - IllegalStateException will be thrown if pause is called
- //in here
- //mp.pause();
- currentPosition = mp.getCurrentPosition();
- Log.v(TAG, "looping position " + currentPosition + "duration = " + (t2-t1));
- }catch (Exception e){
- Log.v(TAG, "Exception : " + e.toString());
- }
- mp.stop();
- mp.release();
- //The current position should be within 20% of the sleep time
- //and should be greater than zero.
- if ((currentPosition < ((t2-t1-5000)*1.2)) && currentPosition > 0)
- return true;
- else
- return false;
- }
-
- public static boolean pause(String filePath) throws Exception {
- Log.v(TAG, "pause - " + filePath);
- boolean misPlaying = true;
- boolean pauseResult = false;
- long t1=0;
- long t2=0;
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.prepare();
- int duration = mp.getDuration();
- mp.start();
- t1=SystemClock.uptimeMillis();
- Thread.sleep(5000);
- mp.pause();
- Thread.sleep(MediaNames.PAUSE_WAIT_TIME);
- t2=SystemClock.uptimeMillis();
- misPlaying = mp.isPlaying();
- int curPosition = mp.getCurrentPosition();
- Log.v(TAG, filePath + " pause currentPositon " + curPosition);
- Log.v(TAG, "isPlaying "+ misPlaying + " wait time " + (t2 - t1) );
- String cpuinfo = printCpuInfo();
- Log.v(TAG, cpuinfo);
- if ((curPosition>0) && (curPosition < ((t2-t1) * 1.3)) && (misPlaying == false))
- pauseResult = true;
- mp.stop();
- mp.release();
- return pauseResult;
- }
-
- public static void prepareStopRelease(String filePath) throws Exception {
- Log.v(TAG, "prepareStopRelease" + filePath);
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.prepare();
- mp.stop();
- mp.release();
- }
-
- public static void preparePauseRelease(String filePath) throws Exception {
- Log.v(TAG, "preparePauseRelease" + filePath);
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.prepare();
- mp.pause();
- mp.release();
- }
-
- public static int videoHeight(String filePath) throws Exception {
- Log.v(TAG, "videoHeight - " + filePath);
- int videoHeight = 0;
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.setDisplay(MediaFrameworkTest.mSurfaceView.getHolder());
- mp.prepare();
- videoHeight = mp.getVideoHeight();
- mp.release();
- return videoHeight;
- }
-
- public static int videoWidth(String filePath) throws Exception {
- Log.v(TAG, "videoWidth - " + filePath);
- int videoWidth = 0;
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.setDisplay(MediaFrameworkTest.mSurfaceView.getHolder());
- mp.prepare();
- videoWidth = mp.getVideoWidth();
- mp.release();
- return videoWidth;
- }
-
- //This also test the streaming video which may take a long
- //time to start the playback.
- public static boolean videoSeekTo(String filePath) throws Exception {
- Log.v(TAG, "videoSeekTo - " + filePath);
- int currentPosition = 0;
- int duration = 0;
- boolean videoResult = false;
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.setDisplay(MediaFrameworkTest.mSurfaceView.getHolder());
- mp.prepare();
- mp.start();
- if (filePath.equals(MediaNames.VIDEO_SHORT_3GP)){
- mp.pause();
- Thread.sleep(MediaNames.PAUSE_WAIT_TIME);
- mp.seekTo(0);
- mp.start();
- Thread.sleep(1000);
- currentPosition = mp.getCurrentPosition();
- Log.v(TAG,"short position " + currentPosition);
- if (currentPosition > 100 )
- return true;
- else
- return false;
- }
- Thread.sleep(5000);
- duration = mp.getDuration();
- Log.v(TAG, "video duration " + duration);
- mp.pause();
- Thread.sleep(MediaNames.PAUSE_WAIT_TIME);
- mp.seekTo(duration - 20000 );
- mp.start();
- Thread.sleep(1000);
- mp.pause();
- Thread.sleep(MediaNames.PAUSE_WAIT_TIME);
- mp.seekTo(duration/2);
- mp.start();
- Thread.sleep(10000);
- currentPosition = mp.getCurrentPosition();
- Log.v(TAG, "video currentPosition " + currentPosition);
- mp.release();
- if (currentPosition > (duration /2 )*0.9)
- return true;
- else
- return false;
-
- }
-
- public static boolean seekToEnd(String filePath){
- Log.v(TAG, "seekToEnd - " + filePath);
- int duration = 0;
- int currentPosition = 0;
- boolean isPlaying = false;
- MediaPlayer mp = new MediaPlayer();
- try{
- mp.setDataSource(filePath);
- Log.v(TAG, "start playback");
- mp.prepare();
- duration = mp.getDuration();
- mp.seekTo(duration - 3000);
- mp.start();
- Thread.sleep(6000);
- }catch (Exception e){}
- isPlaying = mp.isPlaying();
- currentPosition = mp.getCurrentPosition();
- Log.v(TAG, "seekToEnd currentPosition= " + currentPosition + " isPlaying = " + isPlaying);
- mp.stop();
- mp.release();
- Log.v(TAG, "duration = " + duration);
- if (currentPosition < 0.9 * duration || isPlaying)
- return false;
- else
- return true;
- }
-
- public static boolean shortMediaStop(String filePath){
- Log.v(TAG, "shortMediaStop - " + filePath);
- //This test is only for the short media file
- int duration = 0;
- int currentPosition = 0;
- boolean isPlaying = false;
- MediaPlayer mp = new MediaPlayer();
- try{
- mp.setDataSource(filePath);
- Log.v(TAG, "start playback");
- mp.prepare();
- duration = mp.getDuration();
- mp.start();
- Thread.sleep(10000);
- }catch (Exception e){}
- isPlaying = mp.isPlaying();
- currentPosition = mp.getCurrentPosition();
- Log.v(TAG, "seekToEnd currentPosition= " + currentPosition + " isPlaying = " + isPlaying);
- mp.stop();
- mp.release();
- Log.v(TAG, "duration = " + duration);
- if (currentPosition > duration || isPlaying)
- return false;
- else
- return true;
- }
-
- public static boolean playToEnd(String filePath){
- Log.v(TAG, "shortMediaStop - " + filePath);
- //This test is only for the short media file
- int duration = 200000;
- int updateDuration = 0;
- int currentPosition = 0;
- boolean isPlaying = false;
- MediaPlayer mp = new MediaPlayer();
- try{
- Thread.sleep(5000);
- mp.setDataSource(filePath);
- Log.v(TAG, "start playback");
- mp.prepare();
- //duration = mp.getDuration();
- mp.start();
- Thread.sleep(50000);
- }catch (Exception e){}
- isPlaying = mp.isPlaying();
- currentPosition = mp.getCurrentPosition();
- //updateDuration = mp.getDuration();
- Log.v(TAG, "seekToEnd currentPosition= " + currentPosition + " isPlaying = " + isPlaying);
- mp.stop();
- mp.release();
- //Log.v(TAG, "duration = " + duration);
- //Log.v(TAG, "Update duration = " + updateDuration);
- if (currentPosition > duration || isPlaying)
- return false;
- else
- return true;
- }
-
- public static boolean seektoBeforeStart(String filePath){
- Log.v(TAG, "seektoBeforeStart - " + filePath);
- //This test is only for the short media file
- int duration = 0;
- int currentPosition = 0;
-
- MediaPlayer mp = new MediaPlayer();
- try{
- mp.setDataSource(filePath);
- mp.prepare();
- duration = mp.getDuration();
- mp.seekTo(duration - 10000);
- mp.start();
- currentPosition=mp.getCurrentPosition();
- mp.stop();
- mp.release();
- }catch (Exception e){}
- if (currentPosition < duration/2)
- return false;
- else
- return true;
- }
-
- public static boolean mediaRecorderRecord(String filePath){
- Log.v(TAG, "SoundRecording - " + filePath);
- //This test is only for the short media file
- int duration = 0;
- try{
- MediaRecorder mRecorder = new MediaRecorder();
- mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
- mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
- mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
- mRecorder.setOutputFile(filePath);
- mRecorder.prepare();
- mRecorder.start();
- Thread.sleep(500);
- mRecorder.stop();
- Log.v(TAG, "sound recorded");
- mRecorder.release();
- }catch (Exception e){
- Log.v(TAG, e.toString());
- }
-
- //Verify the recorded file
- MediaPlayer mp = new MediaPlayer();
- try{
- mp.setDataSource(filePath);
- mp.prepare();
- duration = mp.getDuration();
- Log.v(TAG,"Duration " + duration);
- mp.release();
- }catch (Exception e){}
- //Check the record media file length is greate than zero
- if (duration > 0)
- return true;
- else
- return false;
-
- }
-
- //Test for mediaMeta Data Thumbnail
- public static boolean getThumbnail(String filePath, String goldenPath){
- Log.v(TAG, "getThumbnail - " + filePath);
-
- int goldenHeight = 0;
- int goldenWidth = 0;
- int outputWidth = 0;
- int outputHeight = 0;
-
- //This test is only for the short media file
- try{
- BitmapFactory mBitmapFactory = new BitmapFactory();
-
- MediaMetadataRetriever mMediaMetadataRetriever = new MediaMetadataRetriever();
- try {
- mMediaMetadataRetriever.setDataSource(filePath);
- } catch(Exception e) {
- e.printStackTrace();
- return false;
- }
- Bitmap outThumbnail = mMediaMetadataRetriever.captureFrame();
-
- //Verify the thumbnail
- Bitmap goldenBitmap = mBitmapFactory.decodeFile(goldenPath);
-
- outputWidth = outThumbnail.getWidth();
- outputHeight = outThumbnail.getHeight();
- goldenHeight = goldenBitmap.getHeight();
- goldenWidth = goldenBitmap.getWidth();
-
- //check the image dimension
- if ((outputWidth != goldenWidth) || (outputHeight != goldenHeight))
- return false;
-
- //Check one line of pixel
- int x = goldenHeight/2;
- for (int j=0; j<goldenWidth; j++){
- if (goldenBitmap.getPixel(x, j) != outThumbnail.getPixel(x, j)){
- Log.v(TAG, "pixel = " + goldenBitmap.getPixel(x, j));
- return false;
- }
- }
- }catch (Exception e){}
- return true;
- }
-
- //Load midi file from resources
- public static boolean resourcesPlayback(AssetFileDescriptor afd, int expectedDuration){
- int duration = 0;
- try{
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(), afd.getLength());
- mp.prepare();
- mp.start();
- duration = mp.getDuration();
- Thread.sleep(5000);
- mp.release();
- }catch (Exception e){
- Log.v(TAG,e.getMessage());
- }
- if (duration > expectedDuration)
- return true;
- else
- return false;
- }
-
- public static boolean prepareAsyncReset(String filePath){
- //preparesAsync
- try{
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.prepareAsync();
- mp.reset();
- mp.release();
- }catch (Exception e){
- Log.v(TAG,e.getMessage());
- return false;
- }
- return true;
- }
-
-
- public static boolean isLooping(String filePath) {
- MediaPlayer mp = null;
-
- try {
- mp = new MediaPlayer();
- if (mp.isLooping()) {
- Log.v(TAG, "MediaPlayer.isLooping() returned true after ctor");
- return false;
- }
- mp.setDataSource(filePath);
- mp.prepare();
-
- mp.setLooping(true);
- if (!mp.isLooping()) {
- Log.v(TAG, "MediaPlayer.isLooping() returned false after setLooping(true)");
- return false;
- }
-
- mp.setLooping(false);
- if (mp.isLooping()) {
- Log.v(TAG, "MediaPlayer.isLooping() returned true after setLooping(false)");
- return false;
- }
- }catch (Exception e){
- Log.v(TAG, "Exception : " + e.toString());
- return false;
- } finally {
- if (mp != null)
- mp.release();
- }
-
- return true;
- }
-
- public static boolean isLoopingAfterReset(String filePath) {
- MediaPlayer mp = null;
- try {
- mp = new MediaPlayer();
- mp.setDataSource(filePath);
- mp.prepare();
-
- mp.setLooping(true);
- mp.reset();
- if (mp.isLooping()) {
- Log.v(TAG, "MediaPlayer.isLooping() returned true after reset()");
- return false;
- }
- }catch (Exception e){
- Log.v(TAG, "Exception : " + e.toString());
- return false;
- } finally {
- if (mp != null)
- mp.release();
- }
-
- return true;
- }
-}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioTrackTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioTrackTest.java
deleted file mode 100644
index b6a0848..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioTrackTest.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.functional;
-
-import com.android.mediaframeworktest.MediaFrameworkTest;
-import com.android.mediaframeworktest.MediaNames;
-
-import android.media.AudioFormat;
-import android.media.AudioManager;
-import android.media.AudioTrack;
-import android.content.Context;
-import android.test.ActivityInstrumentationTestCase2;
-import android.util.Log;
-import android.test.suitebuilder.annotation.LargeTest;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.Suppress;
-
-/**
- * Junit / Instrumentation test case for the media AudioTrack api
-
- */
-public class MediaAudioTrackTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
- private String TAG = "MediaAudioTrack";
-
- public MediaAudioTrackTest() {
- super("com.android.mediaframeworktest", MediaFrameworkTest.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- //-----------------------------------------------------------------
- // private class to hold test reslts
- public class TestResults {
- public boolean mResult = false;
- public String mResultLog = "";
- public TestResults(boolean b, String s) { mResult = b; mResultLog = s; }
- }
-
- //-----------------------------------------------------------------
- // generic test methods
- public TestResults constructorTestMultiSampleRate(
- // parameters tested by this method
- int _inTest_streamType, int _inTest_mode, int _inTest_config,
- // parameter-dependent expected results
- int _expected_stateForMode) {
-
- int[] testSampleRates = {8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000};
- String failedRates = "Failure for rate(s): ";
- boolean localRes, finalRes = true;
-
- for(int i = 0 ; i < testSampleRates.length ; i++) {
- //Log.v("MediaAudioTrackTest", "[ constructorTestMultiSampleRate ] testing "+ testSampleRates[i]);
- AudioTrack track = null;
- try {
- track = new AudioTrack(
- _inTest_streamType,
- testSampleRates[i],
- _inTest_config,
- AudioFormat.ENCODING_PCM_16BIT,
- AudioTrack.getMinBufferSize(testSampleRates[i],
- _inTest_config, AudioFormat.ENCODING_PCM_16BIT),//testSampleRates[i]*4
- _inTest_mode);
- } catch(IllegalArgumentException iae) {
- Log.e("MediaAudioTrackTest", "[ constructorTestMultiSampleRate ] exception at SR "
- + testSampleRates[i]+": \n" + iae);
- }
- if(track != null) {
- localRes = (track.getState() == _expected_stateForMode);
- track.release();
- }
- else {
- localRes = false;
- }
-
- if (!localRes) {
- //log the error for the test runner
- failedRates += Integer.toString(testSampleRates[i]) + "Hz ";
- //log the error for logcat
- Log.e("MediaAudioTrackTest", "[ constructorTestMultiSampleRate ] failed to construct "
- +"AudioTrack(streamType="+_inTest_streamType
- +", sampleRateInHz=" + testSampleRates[i]
- +", channelConfig=" + _inTest_config
- +", audioFormat=AudioFormat.ENCODING_PCM_16BIT"
- +", bufferSizeInBytes=" + AudioTrack.getMinBufferSize(testSampleRates[i],
- _inTest_config, AudioFormat.ENCODING_PCM_16BIT)
- +", mode="+ _inTest_mode );
- //mark test as failed
- finalRes = false;
- }
- }
- return new TestResults(finalRes, failedRates);
- }
-
- //-----------------------------------------------------------------
- // AUDIOTRACK TESTS:
- //----------------------------------
-
- //-----------------------------------------------------------------
- // AudioTrack constructor and AudioTrack.getMinBufferSize(...)
- //----------------------------------
-
- //Test case 1: constructor for streaming AudioTrack, mono, 16bit at misc valid sample rates
- @MediumTest
- public void testConstructorMono16MusicStream() throws Exception {
-
- TestResults res = constructorTestMultiSampleRate(
- AudioManager.STREAM_MUSIC, AudioTrack.MODE_STREAM,
- AudioFormat.CHANNEL_CONFIGURATION_MONO,
- AudioTrack.STATE_INITIALIZED);
-
- assertTrue("testConstructorMono16MusicStream: " + res.mResultLog, res.mResult);
- }
-
-
- //Test case 2: constructor for streaming AudioTrack, stereo, 16bit at misc valid sample rates
- @MediumTest
- public void testConstructorStereo16MusicStream() throws Exception {
-
- TestResults res = constructorTestMultiSampleRate(
- AudioManager.STREAM_MUSIC, AudioTrack.MODE_STREAM,
- AudioFormat.CHANNEL_CONFIGURATION_STEREO,
- AudioTrack.STATE_INITIALIZED);
-
- assertTrue("testConstructorStereo16MusicStream: " + res.mResultLog, res.mResult);
- }
-
-
- //Test case 3: constructor for static AudioTrack, mono, 16bit at misc valid sample rates
- @MediumTest
- public void testConstructorMono16MusicStatic() throws Exception {
-
- TestResults res = constructorTestMultiSampleRate(
- AudioManager.STREAM_MUSIC, AudioTrack.MODE_STATIC,
- AudioFormat.CHANNEL_CONFIGURATION_MONO,
- AudioTrack.STATE_NO_STATIC_DATA);
-
- assertTrue("testConstructorMono16MusicStatic: " + res.mResultLog, res.mResult);
- }
-
-
- //Test case 4: constructor for static AudioTrack, stereo, 16bit at misc valid sample rates
- @MediumTest
- public void testConstructorStereo16MusicStatic() throws Exception {
-
- TestResults res = constructorTestMultiSampleRate(
- AudioManager.STREAM_MUSIC, AudioTrack.MODE_STATIC,
- AudioFormat.CHANNEL_CONFIGURATION_STEREO,
- AudioTrack.STATE_NO_STATIC_DATA);
-
- assertTrue("testConstructorStereo16MusicStatic: " + res.mResultLog, res.mResult);
- }
-
-}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java
deleted file mode 100644
index 364e1af..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.functional;
-
-import android.media.MediaMetadataRetriever;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.Suppress;
-import android.util.Log;
-
-import com.android.mediaframeworktest.MediaNames;
-/**
- * This metadata test suite test the basic functionality of the
- * MediaMetadataRetriever
- *
- */
-public class MediaMetadataTest extends AndroidTestCase {
-
- private static final String TAG = "MediaMetadataTest";
-
- public static enum METADATA_EXPECTEDRESULT{
- FILE_PATH,CD_TRACK, ALBUM,
- ARTIST, AUTHOR, COMPOSER,
- DATE, GENRE, TITLE,
- YEAR, DURATION, NUM_TRACKS
- }
-
- public static enum MP3_TEST_FILE{
- ID3V1V2, ID3V2, ID3V1,
- CORRUPTED_ID3V1, CORRUPTED_ID3V2_TALB, CORRUPTED_ID3V2_TCOM,
- CORRUPTED_ID3V2_TCOM_2, CORRUPTED_ID3V2_TRCK, CORRUPTED_D3V2_TRCK_2,
- CORRUPTED_ID3V2_TYER, CORRUPTED_ID3V2_TYER_2, CORRUPTED_ID3V2_TIT
- }
-
- public static enum NON_MP3_TEST_FILE{
- THREE3GP, AMRNB, AMRWB, M4A1, M4V, MIDI,
- H264, OGG1, OGG2, WAV, WMA9, WMA10, WMV9, WMV7
- }
-
- public static METADATA_EXPECTEDRESULT meta;
- public static MP3_TEST_FILE mp3_test_file;
- public static NON_MP3_TEST_FILE non_mp3_test_file;
-
- @MediumTest
- public static void testID3V1V2Metadata() throws Exception {
- validateMetatData(mp3_test_file.ID3V1V2.ordinal(), MediaNames.META_DATA_MP3);
- }
-
- @MediumTest
- public static void testID3V2Metadata() throws Exception {
- validateMetatData(mp3_test_file.ID3V2.ordinal(), MediaNames.META_DATA_MP3);
- }
-
- @MediumTest
- public static void testID3V1Metadata() throws Exception {
- validateMetatData(mp3_test_file.ID3V1.ordinal(), MediaNames.META_DATA_MP3);
- }
-
- @MediumTest
- public static void testCorruptedID3V1Metadata() throws Exception {
- validateMetatData(mp3_test_file.CORRUPTED_ID3V1.ordinal(), MediaNames.META_DATA_MP3);
- }
-
- @MediumTest
- public static void testCorrupted_ID3V2_TALBMetadata() throws Exception {
- validateMetatData(mp3_test_file.CORRUPTED_ID3V2_TALB.ordinal(), MediaNames.META_DATA_MP3);
- }
-
- @MediumTest
- public static void testCorrupted_ID3V2_TCOMMetadata() throws Exception {
- validateMetatData(mp3_test_file.CORRUPTED_ID3V2_TCOM.ordinal(), MediaNames.META_DATA_MP3);
- }
-
- @MediumTest
- public static void testCorrupted_ID3V2_TCOMM2etadata() throws Exception {
- validateMetatData(mp3_test_file.CORRUPTED_ID3V2_TCOM_2.ordinal(), MediaNames.META_DATA_MP3);
- }
-
- @MediumTest
- public static void testCorrupted_ID3V2_TRCKMetadata() throws Exception {
- validateMetatData(mp3_test_file.CORRUPTED_ID3V2_TRCK.ordinal(), MediaNames.META_DATA_MP3);
- }
-
- @MediumTest
- public static void testCorrupted_ID3V2_TRCK2Metadata() throws Exception {
- validateMetatData(mp3_test_file.CORRUPTED_D3V2_TRCK_2.ordinal(), MediaNames.META_DATA_MP3);
- }
-
- @MediumTest
- public static void testCorrupted_ID3V2_TYERMetadata() throws Exception {
- validateMetatData(mp3_test_file.CORRUPTED_ID3V2_TYER.ordinal(), MediaNames.META_DATA_MP3);
- }
-
- @MediumTest
- public static void testCorrupted_ID3V2_TYER2Metadata() throws Exception {
- validateMetatData(mp3_test_file.CORRUPTED_ID3V2_TYER_2.ordinal(), MediaNames.META_DATA_MP3);
- }
-
- @MediumTest
- public static void testCorrupted_ID3V2_TITMetadata() throws Exception {
- validateMetatData(mp3_test_file.CORRUPTED_ID3V2_TIT.ordinal(), MediaNames.META_DATA_MP3);
- }
-
- @MediumTest
- public static void test3gp_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.THREE3GP.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- @MediumTest
- public static void testAmr_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.AMRNB.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- @MediumTest
- public static void testAmrWb_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.AMRWB.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- //Bug# 1440173 - skip this test case now
- @Suppress
- @MediumTest
- public static void testM4A1_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.M4A1.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- @MediumTest
- public static void testM4v_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.M4V.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- @MediumTest
- public static void testH264_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.H264.ordinal(), MediaNames.META_DATA_OTHERS);
- }
- //bug# 1440489
- @Suppress
- @MediumTest
- public static void testOgg1_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.OGG1.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- @Suppress
- @MediumTest
- public static void testOgg2_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.OGG2.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- @Suppress
- @MediumTest
- public static void testMidi_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.MIDI.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- @MediumTest
- public static void testWav_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.WAV.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- @MediumTest
- public static void testWma9_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.WMA9.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- @MediumTest
- public static void testWma10_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.WMA10.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- @MediumTest
- public static void testWmv9_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.WMV9.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- @MediumTest
- public static void testWmv10_Metadata() throws Exception {
- validateMetatData(non_mp3_test_file.WMV7.ordinal(), MediaNames.META_DATA_OTHERS);
- }
-
- private static void validateMetatData(int fileIndex, String meta_data_file[][]) {
- String value = null;
- MediaMetadataRetriever retriever = new MediaMetadataRetriever();
- retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY);
- try {
- retriever.setDataSource(meta_data_file[fileIndex][0]);
- Log.v(TAG, "filePath = "+ meta_data_file[fileIndex][0]);
- } catch(Exception e) {
- Log.v(TAG, "Failed: "+meta_data_file[fileIndex][0] + " " + e.toString());
- //Set the test case failure whenever it failed to setDataSource
- assertTrue("Failed to setDataSource ", false);
- }
-
- //METADATA_KEY_CD_TRACK_NUMBER should return the TCRK value
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER);
- Log.v(TAG, "CD_TRACK_NUMBER : " + value);
- assertEquals(TAG, meta_data_file[fileIndex][meta.CD_TRACK.ordinal()], value);
-
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
- Log.v(TAG, "Album : "+ value);
- assertEquals(TAG, meta_data_file[fileIndex][meta.ALBUM.ordinal()], value);
-
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
- Log.v(TAG, "Artist : "+ value);
- assertEquals(TAG, meta_data_file[fileIndex][meta.ARTIST.ordinal()], value);
-
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_AUTHOR);
- Log.v(TAG, "Author : "+ value);
- assertEquals(TAG, meta_data_file[fileIndex][meta.AUTHOR.ordinal()], value);
-
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_COMPOSER);
- Log.v(TAG, "Composer : "+ value);
- assertEquals(TAG, meta_data_file[fileIndex][meta.COMPOSER.ordinal()], value);
-
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DATE);
- Log.v(TAG, "Date : "+ value);
- assertEquals(TAG, meta_data_file[fileIndex][meta.DATE.ordinal()], value);
-
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE);
- Log.v(TAG, "Genre : "+ value);
- assertEquals(TAG, meta_data_file[fileIndex][meta.GENRE.ordinal()], value);
-
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
- Log.v(TAG, "Title : "+ value);
- assertEquals(TAG, meta_data_file[fileIndex][meta.TITLE.ordinal()], value);
-
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_YEAR);
- Log.v(TAG, "Year : "+ value);
- assertEquals(TAG, meta_data_file[fileIndex][meta.YEAR.ordinal()], value);
-
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
- Log.v(TAG, "Expected = " + meta_data_file[fileIndex][meta.DURATION.ordinal()] + "reult = " + value);
- assertEquals(TAG, meta_data_file[fileIndex][meta.DURATION.ordinal()], value);
-
- //METADATA_KEY_NUM_TRACKS should return the total number of tracks in the media
- //include the video and audio
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS);
- Log.v(TAG, "Track : "+ value);
- assertEquals(TAG,meta_data_file[fileIndex][meta.NUM_TRACKS.ordinal()], value);
-
- retriever.release();
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
deleted file mode 100644
index dd94164..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.functional;
-
-import com.android.mediaframeworktest.MediaFrameworkTest;
-import com.android.mediaframeworktest.MediaNames;
-
-import android.content.Context;
-import android.test.ActivityInstrumentationTestCase;
-import android.util.Log;
-import android.test.suitebuilder.annotation.LargeTest;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.Suppress;
-
-/**
- * Junit / Instrumentation test case for the media player api
-
- */
-public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> {
- private boolean duratoinWithinTolerence = false;
- private String TAG = "MediaPlayerApiTest";
-
- Context mContext;
-
- public MediaPlayerApiTest() {
- super("com.android.mediaframeworktest", MediaFrameworkTest.class);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
-
- }
-
- public boolean verifyDuration(int duration, int expectedDuration){
- if ((duration > expectedDuration * 1.1) || (duration < expectedDuration * 0.9))
- return false;
- else
- return true;
- }
-
-
- //Audio
- //Wait for PV bugs for MP3 duration
- @MediumTest
- public void testMP3CBRGetDuration() throws Exception {
- int duration = CodecTest.getDuration(MediaNames.MP3CBR);
- duratoinWithinTolerence = verifyDuration(duration, MediaNames.MP3CBR_LENGTH);
- assertTrue("MP3CBR getDuration", duratoinWithinTolerence);
- }
-
- @MediumTest
- public void testMP3VBRGetDuration() throws Exception {
- int duration = CodecTest.getDuration(MediaNames.MP3VBR);
- Log.v(TAG, "getDuration");
- duratoinWithinTolerence = verifyDuration(duration, MediaNames.MP3VBR_LENGTH);
- assertTrue("MP3VBR getDuration", duratoinWithinTolerence);
- }
-
- @MediumTest
- public void testMIDIGetDuration() throws Exception {
- int duration = CodecTest.getDuration(MediaNames.MIDI);
- duratoinWithinTolerence = verifyDuration(duration, MediaNames.MIDI_LENGTH);
- assertTrue("MIDI getDuration", duratoinWithinTolerence);
- }
-
- @MediumTest
- public void testWMA9GetDuration() throws Exception {
- int duration = CodecTest.getDuration(MediaNames.WMA9);
- duratoinWithinTolerence = verifyDuration(duration, MediaNames.WMA9_LENGTH);
- assertTrue("WMA9 getDuration", duratoinWithinTolerence);
- }
-
- @MediumTest
- public void testAMRGetDuration() throws Exception {
- int duration = CodecTest.getDuration(MediaNames.AMR);
- duratoinWithinTolerence = verifyDuration(duration, MediaNames.AMR_LENGTH);
- assertTrue("AMR getDuration", duratoinWithinTolerence);
- }
-
- /*
- public void testOGGGetDuration() throws Exception {
- int duration = CodecTest.getDuration(MediaNames.OGG);
- duratoinWithinTolerence = verifyDuration(duration, MediaNames.OGG_LENGTH);
- assertTrue("OGG getDuration", duratoinWithinTolerence);
- }*/
-
-
- //Test cases for GetCurrentPosition
- @LargeTest
- public void testMP3CBRGetCurrentPosition() throws Exception {
- boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.MP3CBR);
- assertTrue("MP3CBR GetCurrentPosition", currentPosition);
- }
-
- @LargeTest
- public void testMP3VBRGetCurrentPosition() throws Exception {
- boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.MP3VBR);
- assertTrue("MP3VBR GetCurrentPosition", currentPosition);
- }
-
- @LargeTest
- public void testMIDIGetCurrentPosition() throws Exception {
- boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.MIDI);
- assertTrue("MIDI GetCurrentPosition", currentPosition);
- }
-
- @LargeTest
- public void testWMA9GetCurrentPosition() throws Exception {
- boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.WMA9);
- assertTrue("WMA9 GetCurrentPosition", currentPosition);
- }
-
- @LargeTest
- public void testAMRGetCurrentPosition() throws Exception {
- boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.AMR);
- assertTrue("AMR GetCurrentPosition", currentPosition);
- }
-
- /*
- public void testOGGGetCurrentPosition() throws Exception {
- boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.OGG);
- assertTrue("OGG GetCurrentPosition", currentPosition);
- */
-
- //Test cases for pause
- @LargeTest
- public void testMP3CBRPause() throws Exception {
- boolean isPaused = CodecTest.pause(MediaNames.MP3CBR);
- assertTrue("MP3CBR Pause", isPaused);
- }
-
- @LargeTest
- public void testMP3VBRPause() throws Exception {
- boolean isPaused = CodecTest.pause(MediaNames.MP3VBR);
- assertTrue("MP3VBR Pause", isPaused);
- }
-
- @LargeTest
- public void testMIDIPause() throws Exception {
- boolean isPaused = CodecTest.pause(MediaNames.MIDI);
- assertTrue("MIDI Pause", isPaused);
- }
-
- @LargeTest
- public void testWMA9Pause() throws Exception {
- boolean isPaused = CodecTest.pause(MediaNames.WMA9);
- assertTrue("WMA9 Pause", isPaused);
- }
-
- @LargeTest
- public void testAMRPause() throws Exception {
- boolean isPaused = CodecTest.pause(MediaNames.AMR);
- assertTrue("AMR Pause", isPaused);
- }
-
- /*
- public void testOGGPause() throws Exception {
- boolean isPaused = CodecTest.pause(MediaNames.OGG);
- assertTrue("OGG Pause", isPaused);
- }*/
-
- @MediumTest
- public void testMP3CBRPrepareStopRelease() throws Exception {
- CodecTest.prepareStopRelease(MediaNames.MP3CBR);
- assertTrue("MP3CBR prepareStopRelease", true);
- }
-
- @MediumTest
- public void testMIDIPrepareStopRelease() throws Exception {
- CodecTest.prepareStopRelease(MediaNames.MIDI);
- assertTrue("MIDI prepareStopRelease", true);
- }
-
- //One test case for seek before start
- @MediumTest
- public void testMP3CBRSeekBeforeStart() throws Exception {
- boolean seekBeforePlay = CodecTest.seektoBeforeStart(MediaNames.MP3CBR);
- assertTrue("MP3CBR SeekBeforePlay", seekBeforePlay);
- }
-
- //Skip test - Bug# 1120249
- /*
- public void testMP3CBRpreparePauseRelease() throws Exception {
- CodecTest.preparePauseRelease(MediaNames.MP3CBR);
- assertTrue("MP3CBR preparePauseRelease", true);
- }
-
- public void testMIDIpreparePauseRelease() throws Exception {
- CodecTest.preparePauseRelease(MediaNames.MIDI);
- assertTrue("MIDI preparePauseRelease", true);
- }
- */
-
-
- //Test cases for setLooping
- @LargeTest
- public void testMP3CBRSetLooping() throws Exception {
- boolean isLoop = CodecTest.setLooping(MediaNames.MP3CBR);
- assertTrue("MP3CBR setLooping", isLoop);
- }
-
- @LargeTest
- public void testMP3VBRSetLooping() throws Exception {
- boolean isLoop = CodecTest.setLooping(MediaNames.MP3VBR);
- Log.v(TAG, "setLooping");
- assertTrue("MP3VBR setLooping", isLoop);
- }
-
- @LargeTest
- public void testMIDISetLooping() throws Exception {
- boolean isLoop = CodecTest.setLooping(MediaNames.MIDI);
- assertTrue("MIDI setLooping", isLoop);
- }
-
- @LargeTest
- public void testWMA9SetLooping() throws Exception {
- boolean isLoop = CodecTest.setLooping(MediaNames.WMA9);
- assertTrue("WMA9 setLooping", isLoop);
- }
-
- @LargeTest
- public void testAMRSetLooping() throws Exception {
- boolean isLoop = CodecTest.setLooping(MediaNames.AMR);
- assertTrue("AMR setLooping", isLoop);
- }
-
- /*
- public void testOGGSetLooping() throws Exception {
- boolean isLoop = CodecTest.setLooping(MediaNames.OGG);
- assertTrue("OGG setLooping", isLoop);
- } */
-
- //Test cases for seekTo
- @LargeTest
- public void testMP3CBRSeekTo() throws Exception {
- boolean isLoop = CodecTest.seekTo(MediaNames.MP3CBR);
- assertTrue("MP3CBR seekTo", isLoop);
- }
-
- @LargeTest
- public void testMP3VBRSeekTo() throws Exception {
- boolean isLoop = CodecTest.seekTo(MediaNames.MP3VBR);
- Log.v(TAG, "seekTo");
- assertTrue("MP3VBR seekTo", isLoop);
- }
-
- @LargeTest
- public void testMIDISeekTo() throws Exception {
- boolean isLoop = CodecTest.seekTo(MediaNames.MIDI);
- assertTrue("MIDI seekTo", isLoop);
- }
-
- @LargeTest
- public void testWMA9SeekTo() throws Exception {
- boolean isLoop = CodecTest.seekTo(MediaNames.WMA9);
- assertTrue("WMA9 seekTo", isLoop);
- }
-
- @LargeTest
- public void testAMRSeekTo() throws Exception {
- boolean isLoop = CodecTest.seekTo(MediaNames.AMR);
- assertTrue("AMR seekTo", isLoop);
- }
-
- /*
- public void testOGGSeekTo() throws Exception {
- boolean isLoop = CodecTest.seekTo(MediaNames.OGG);
- assertTrue("OGG seekTo", isLoop);
- }*/
-
-
- //Jump to the end of the files
- @LargeTest
- public void testMP3CBRSeekToEnd() throws Exception {
- boolean isEnd = CodecTest.seekToEnd(MediaNames.MP3CBR);
- assertTrue("MP3CBR seekToEnd", isEnd);
- }
-
- @LargeTest
- public void testMP3VBRSeekToEnd() throws Exception {
- boolean isEnd = CodecTest.seekToEnd(MediaNames.MP3VBR);
- Log.v(TAG, "seekTo");
- assertTrue("MP3VBR seekToEnd", isEnd);
- }
-
- @LargeTest
- public void testMIDISeekToEnd() throws Exception {
- boolean isEnd = CodecTest.seekToEnd(MediaNames.MIDI);
- assertTrue("MIDI seekToEnd", isEnd);
- }
-
- @LargeTest
- public void testWMA9SeekToEnd() throws Exception {
- boolean isEnd = CodecTest.seekToEnd(MediaNames.WMA9);
- assertTrue("WMA9 seekToEnd", isEnd);
- }
-
- @LargeTest
- public void testAMRSeekToEnd() throws Exception {
- boolean isEnd = CodecTest.seekToEnd(MediaNames.AMR);
- assertTrue("AMR seekToEnd", isEnd);
- }
-
- /*
- public void testOGGSeekToEnd() throws Exception {
- boolean isEnd = CodecTest.seekToEnd(MediaNames.OGG);
- assertTrue("OGG seekToEnd", isEnd);
- }*/
-
- @LargeTest
- public void testWAVSeekToEnd() throws Exception {
- boolean isEnd = CodecTest.seekToEnd(MediaNames.WAV);
- assertTrue("WAV seekToEnd", isEnd);
- }
-
- @MediumTest
- public void testLargeVideoHeigth() throws Exception {
- int height = 0;
- height = CodecTest.videoHeight(MediaNames.VIDEO_LARGE_SIZE_3GP);
- Log.v(TAG, "Video height = " + height);
- assertEquals("streaming video height", 240, height);
- }
-
- @MediumTest
- public void testLargeVideoWidth() throws Exception {
- int width = 0;
- width = CodecTest.videoWidth(MediaNames.VIDEO_LARGE_SIZE_3GP);
- Log.v(TAG, "Video width = " + width);
- assertEquals("streaming video width", 320, width);
- }
-
- @LargeTest
- public void testVideoMP4SeekTo() throws Exception {
- boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_MP4);
- assertTrue("Local MP4 SeekTo", isSeek);
- }
-
- @LargeTest
- public void testVideoLong3gpSeekTo() throws Exception {
- boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_LONG_3GP);
- assertTrue("Local 3gp SeekTo", isSeek);
- }
-
- @LargeTest
- public void testVideoH263AACSeekTo() throws Exception {
- boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_H263_AAC);
- assertTrue("H263AAC SeekTo", isSeek);
- }
-
- @LargeTest
- public void testVideoH263AMRSeekTo() throws Exception {
- boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_H263_AMR);
- assertTrue("H263AMR SeekTo", isSeek);
- }
-
- @LargeTest
- public void testVideoH264AACSeekTo() throws Exception {
- boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_H264_AAC);
- assertTrue("H264AAC SeekTo", isSeek);
- }
-
- @LargeTest
- public void testVideoH264AMRSeekTo() throws Exception {
- boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_H264_AMR);
- assertTrue("H264AMR SeekTo", isSeek);
- }
-
- @LargeTest
- public void testVideoWMVSeekTo() throws Exception {
- boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_WMV);
- assertTrue("WMV SeekTo", isSeek);
- }
-
- @LargeTest
- public void testSoundRecord() throws Exception {
- boolean isRecordered = CodecTest.mediaRecorderRecord(MediaNames.RECORDER_OUTPUT);
- assertTrue("Recorder", isRecordered);
- }
-
- @LargeTest
- public void testGetThumbnail() throws Exception {
- boolean getThumbnail = CodecTest.getThumbnail(MediaNames.VIDEO_H264_AAC, MediaNames.GOLDEN_THUMBNAIL_OUTPUT);
- assertTrue("Get Thumbnail", getThumbnail);
- }
-
- //Play a mid file which the duration is around 210 seconds
- @LargeTest
- public void testMidiResources() throws Exception {
- boolean midiResources = CodecTest.resourcesPlayback(MediaFrameworkTest.midiafd,180000);
- assertTrue("Play midi from resources", midiResources);
- }
-
- @LargeTest
- public void testMp3Resources() throws Exception {
- boolean mp3Resources = CodecTest.resourcesPlayback(MediaFrameworkTest.mp3afd,25000);
- assertTrue("Play mp3 from resources", mp3Resources);
- }
-
- //Bug# 1422662
- @Suppress
- @MediumTest
- public void testPrepareAsyncReset() throws Exception {
- boolean isReset = CodecTest.prepareAsyncReset(MediaNames.STREAM_LARGE_MP3);
- assertTrue("PrepareAsync Reset", isReset);
- }
-
- @MediumTest
- public void testIsLooping() throws Exception {
- boolean isLooping = CodecTest.isLooping(MediaNames.AMR);
- assertTrue("isLooping", isLooping);
- }
-
- @MediumTest
- public void testIsLoopingAfterReset() throws Exception {
- boolean isLooping = CodecTest.isLoopingAfterReset(MediaNames.AMR);
- assertTrue("isLooping after reset", isLooping);
- }
-}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
deleted file mode 100644
index 65451c5..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.functional;
-
-import com.android.mediaframeworktest.MediaFrameworkTest;
-import com.android.mediaframeworktest.MediaNames;
-
-import java.io.*;
-
-import android.content.Context;
-import android.media.MediaPlayer;
-import android.media.MediaRecorder;
-import android.test.ActivityInstrumentationTestCase;
-import android.util.Log;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-
-
-import android.test.suitebuilder.annotation.LargeTest;
-import android.test.suitebuilder.annotation.Suppress;
-
-
-/**
- * Junit / Instrumentation test case for the media recorder api
- */
-public class MediaRecorderTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> {
- private String TAG = "MediaRecorderTest";
- private int mOutputDuration =0;
- private int mOutputVideoWidth = 0;
- private int mOutputVideoHeight= 0 ;
-
- private SurfaceHolder mSurfaceHolder = null;
- private MediaRecorder mRecorder;
- Context mContext;
-
- public MediaRecorderTest() {
- super("com.android.mediaframeworktest", MediaFrameworkTest.class);
-
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- Log.v(TAG,"create the media recorder");
- mRecorder = new MediaRecorder();
- }
-
- private void recordVideo(int frameRate, int width, int height,
- int videoFormat, int outFormat, String outFile, boolean videoOnly) {
- Log.v(TAG,"startPreviewAndPrepareRecording");
- try {
- if (!videoOnly) {
- Log.v(TAG, "setAudioSource");
- mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
- }
- mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
- mRecorder.setOutputFormat(outFormat);
- Log.v(TAG, "output format " + outFormat);
- mRecorder.setOutputFile(outFile);
- mRecorder.setVideoFrameRate(frameRate);
- mRecorder.setVideoSize(width, height);
- Log.v(TAG, "setEncoder");
- mRecorder.setVideoEncoder(videoFormat);
- if (!videoOnly) {
- mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
- }
- mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
- Log.v(TAG, "setPreview");
- mRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
- Log.v(TAG, "prepare");
- mRecorder.prepare();
- Log.v(TAG, "start");
- mRecorder.start();
- Thread.sleep(MediaNames.RECORDED_TIME);
- Log.v(TAG, "stop");
- mRecorder.stop();
- mRecorder.release();
- } catch (Exception e) {
- Log.v("record video failed ", e.toString());
- mRecorder.release();
- }
- }
-
-
- private boolean invalidRecordSetting(int frameRate, int width, int height,
- int videoFormat, int outFormat, String outFile, boolean videoOnly) {
- try {
- if (!videoOnly) {
- Log.v(TAG, "setAudioSource");
- mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
- }
- mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
- mRecorder.setOutputFormat(outFormat);
- Log.v(TAG, "output format " + outFormat);
- mRecorder.setOutputFile(outFile);
- mRecorder.setVideoFrameRate(frameRate);
- mRecorder.setVideoSize(width, height);
- Log.v(TAG, "setEncoder");
- mRecorder.setVideoEncoder(videoFormat);
- if (!videoOnly) {
- mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
- }
- mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
- Log.v(TAG, "setPreview");
- mRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
- Log.v(TAG, "prepare");
- mRecorder.prepare();
- Log.v(TAG, "start");
- mRecorder.start();
- Thread.sleep(MediaNames.RECORDED_TIME);
- Log.v(TAG, "stop");
- mRecorder.stop();
- mRecorder.release();
- } catch (Exception e) {
- Log.v("record video failed ", e.toString());
- mRecorder.release();
- Log.v(TAG, "reset and release");
- return true;
- }
- return false;
- }
-
-
-
- private void getOutputVideoProperty(String outputFilePath) {
- MediaPlayer mediaPlayer = new MediaPlayer();
- try {
- mediaPlayer.setDataSource(outputFilePath);
- Log.v(TAG, "file Path = " + outputFilePath);
- mediaPlayer.setDisplay(MediaFrameworkTest.mSurfaceView.getHolder());
- Log.v(TAG, "before player prepare");
- mediaPlayer.prepare();
- Log.v(TAG, "before getduration");
- mOutputDuration = mediaPlayer.getDuration();
- Log.v(TAG, "get video dimension");
- mOutputVideoHeight = mediaPlayer.getVideoHeight();
- mOutputVideoWidth = mediaPlayer.getVideoWidth();
- mediaPlayer.release();
- } catch (Exception e) {
- Log.v(TAG, e.toString());
- mediaPlayer.release();
- }
- }
-
- private void removeFile(String filePath) {
- File fileRemove = new File(filePath);
- fileRemove.delete();
- }
-
- private boolean validateVideo(String filePath, int width, int height) {
- boolean validVideo = false;
- getOutputVideoProperty(filePath);
- if (mOutputVideoWidth == width && mOutputVideoHeight == height &&
- mOutputDuration > MediaNames.VALID_VIDEO_DURATION ) {
- validVideo = true;
- }
- Log.v(TAG, "width = " + mOutputVideoWidth + " height = " + mOutputVideoHeight + " Duration = " + mOutputDuration);
- removeFile(filePath);
- return validVideo;
- }
-
-
- //Format: HVGA h263
- @Suppress
- public void testHVGAH263() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 480, 320, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.THREE_GPP, MediaNames.RECORDED_HVGA_H263, false);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_HVGA_H263, 480, 320);
- assertTrue("HVGAH263", videoRecordedResult);
- }
-
- //Format: QVGA h263
- @LargeTest
- public void testQVGAH263() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 320, 240, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.THREE_GPP, MediaNames.RECORDED_QVGA_H263, false);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_QVGA_H263, 320, 240);
- assertTrue("QVGAH263", videoRecordedResult);
- }
-
- //Format: SQVGA h263
- @LargeTest
- public void testSQVGAH263() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 240, 160, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.THREE_GPP, MediaNames.RECORDED_SQVGA_H263, false);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_SQVGA_H263, 240, 160);
- assertTrue("SQVGAH263", videoRecordedResult);
- }
-
- //Format: QCIF h263
- @LargeTest
- public void testQCIFH263() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 176, 144, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.THREE_GPP, MediaNames.RECORDED_QCIF_H263, false);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_QCIF_H263, 176, 144);
- assertTrue("QCIFH263", videoRecordedResult);
- }
-
- //Format: CIF h263
- @LargeTest
- public void testCIFH263() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 352, 288, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.THREE_GPP, MediaNames.RECORDED_CIF_H263, false);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_CIF_H263, 352, 288);
- assertTrue("CIFH263", videoRecordedResult);
- }
-
-
-
- @LargeTest
- public void testVideoOnly() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 176, 144, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_VIDEO_3GP, true);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_VIDEO_3GP, 176, 144);
- assertTrue("QCIFH263 Video Only", videoRecordedResult);
- }
-
- @Suppress
- public void testPortraitH263() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 144, 176, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_VIDEO_3GP, true);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_VIDEO_3GP, 144, 176);
- assertTrue("PortraitH263", videoRecordedResult);
- }
-
- @Suppress
- public void testHVGAMP4() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 480, 320, MediaRecorder.VideoEncoder.MPEG_4_SP,
- MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_HVGA_MP4, false);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_HVGA_MP4, 480, 320);
- assertTrue("HVGAMP4", videoRecordedResult);
- }
-
- @LargeTest
- public void testQVGAMP4() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 320, 240, MediaRecorder.VideoEncoder.MPEG_4_SP,
- MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_QVGA_MP4, false);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_QVGA_MP4, 320, 240);
- assertTrue("QVGAMP4", videoRecordedResult);
- }
-
- @LargeTest
- public void testSQVGAMP4() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 240, 160, MediaRecorder.VideoEncoder.MPEG_4_SP,
- MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_SQVGA_MP4, false);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_SQVGA_MP4, 240, 160);
- assertTrue("SQVGAMP4", videoRecordedResult);
- }
-
- //Format: QCIF MP4
- @LargeTest
- public void testQCIFMP4() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 176, 144, MediaRecorder.VideoEncoder.MPEG_4_SP,
- MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_QCIF_MP4, false);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_QCIF_MP4, 176, 144);
- assertTrue("QCIFMP4", videoRecordedResult);
- }
-
-
- //Format: CIF MP4
- @LargeTest
- public void testCIFMP4() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 352, 288, MediaRecorder.VideoEncoder.MPEG_4_SP,
- MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_CIF_MP4, false);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_CIF_MP4, 352, 288);
- assertTrue("CIFMP4", videoRecordedResult);
- }
-
-
- //Format: CIF MP4 output format 3gpp
- @LargeTest
- public void testCIFMP43GPP() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 352, 288, MediaRecorder.VideoEncoder.MPEG_4_SP,
- MediaRecorder.OutputFormat.THREE_GPP, MediaNames.RECORDED_VIDEO_3GP, false);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_VIDEO_3GP, 352, 288);
- assertTrue("CIFMP4 3GPP", videoRecordedResult);
- }
-
- @LargeTest
- public void testQCIFH2633GPP() throws Exception {
- boolean videoRecordedResult = false;
- recordVideo(15, 176, 144, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.THREE_GPP, MediaNames.RECORDED_VIDEO_3GP, false);
- videoRecordedResult = validateVideo(MediaNames.RECORDED_VIDEO_3GP, 176, 144);
- assertTrue("QCIFH263 3GPP", videoRecordedResult);
- }
-
- @LargeTest
- public void testInvalidVideoPath() throws Exception {
- boolean isTestInvalidVideoPathSuccessful = false;
- isTestInvalidVideoPathSuccessful = invalidRecordSetting(15, 176, 144, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.THREE_GPP, MediaNames.INVALD_VIDEO_PATH, false);
- assertTrue("Invalid outputFile Path", isTestInvalidVideoPathSuccessful);
- }
-
- @Suppress
- public void testInvalidVideoSize() throws Exception {
- boolean isTestInvalidVideoSizeSuccessful = false;
- isTestInvalidVideoSizeSuccessful = invalidRecordSetting(15, 800, 600, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.THREE_GPP, MediaNames.RECORDED_VIDEO_3GP, false);
- assertTrue("Invalid video Size", isTestInvalidVideoSizeSuccessful);
- }
-
- @LargeTest
- public void testInvalidFrameRate() throws Exception {
- boolean isTestInvalidFrameRateSuccessful = false;
- isTestInvalidFrameRateSuccessful = invalidRecordSetting(50, 176, 144, MediaRecorder.VideoEncoder.H263,
- MediaRecorder.OutputFormat.THREE_GPP, MediaNames.RECORDED_VIDEO_3GP, false);
- assertTrue("Invalid FrameRate", isTestInvalidFrameRateSuccessful);
- }
-
-}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/SimTonesTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/SimTonesTest.java
deleted file mode 100644
index 241f8d6..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/SimTonesTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.functional;
-
-// import android.content.Resources;
-import com.android.mediaframeworktest.MediaFrameworkTest;
-
-import android.content.Context;
-import android.test.ActivityInstrumentationTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Junit / Instrumentation test case for the SIM tone generator
- *
- */
-public class SimTonesTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> {
- private String TAG = "SimTonesTest";
-
- Context mContext;
-
- public SimTonesTest() {
- super("com.android.mediaframeworktest", MediaFrameworkTest.class);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @LargeTest
- public void testDtmfTones() throws Exception {
- boolean result = TonesAutoTest.tonesDtmfTest();
- assertTrue("DTMF Tones", result);
- }
-
- @LargeTest
- public void testSupervisoryTones() throws Exception {
- boolean result = TonesAutoTest.tonesSupervisoryTest();
- assertTrue("Supervisory Tones", result);
- }
-
- @LargeTest
- public void testProprietaryTones() throws Exception {
- boolean result = TonesAutoTest.tonesProprietaryTest();
- assertTrue("Proprietary Tones", result);
- }
-
- @LargeTest
- public void testSimultaneousTones() throws Exception {
- boolean result = TonesAutoTest.tonesSimultaneousTest();
- assertTrue("Simultaneous Tones", result);
- }
-
- @LargeTest
- public void testStressTones() throws Exception {
- boolean result = TonesAutoTest.tonesStressTest();
- assertTrue("Stress Tones", result);
- }
-}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/TonesAutoTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/TonesAutoTest.java
deleted file mode 100644
index da18e74..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/TonesAutoTest.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.functional;
-
-
-//import android.content.Resources;
-import android.util.Log;
-
-import android.media.ToneGenerator;
-import android.media.AudioManager;
-
-/**
- * Junit / Instrumentation test case for the Sim tones tests
-
- */
- public class TonesAutoTest {
- private static String TAG = "TonesAutoTest";
-
- // Test all DTMF tones one by one
- public static boolean tonesDtmfTest() throws Exception {
- Log.v(TAG, "DTMF tones test");
- ToneGenerator toneGen;
- int type;
- boolean result = true;
-
- toneGen = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
-
- for (type = ToneGenerator.TONE_DTMF_0; type <= ToneGenerator.TONE_DTMF_D; type++) {
- if (toneGen.startTone(type)) {
- Thread.sleep(200);
- toneGen.stopTone();
- Thread.sleep(100);
- } else {
- result = false;
- break;
- }
- }
-
- toneGen.release();
- return result;
- }
-
- // Test all supervisory tones one by one
- public static boolean tonesSupervisoryTest() throws Exception {
- Log.v(TAG, "Supervisory tones test");
- ToneGenerator toneGen;
- int type;
- boolean result = true;
-
- toneGen = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
-
- for (type = ToneGenerator.TONE_SUP_DIAL;
- type <= ToneGenerator.TONE_SUP_RINGTONE; type++) {
- if (toneGen.startTone(type)) {
- Thread.sleep(2000);
- toneGen.stopTone();
- Thread.sleep(200);
- } else {
- result = false;
- break;
- }
- }
-
- toneGen.release();
- return result;
- }
-
- // Test all proprietary tones one by one
- public static boolean tonesProprietaryTest() throws Exception {
- Log.v(TAG, "Proprietary tones test");
- ToneGenerator toneGen;
- int type;
- boolean result = true;
-
- toneGen = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
-
- for (type = ToneGenerator.TONE_PROP_BEEP; type <= ToneGenerator.TONE_PROP_BEEP2; type++) {
- if (toneGen.startTone(type)) {
- Thread.sleep(1000);
- toneGen.stopTone();
- Thread.sleep(100);
- } else {
- result = false;
- break;
- }
- }
-
- toneGen.release();
- return result;
- }
-
- // Test playback of 2 tones simultaneously
- public static boolean tonesSimultaneousTest() throws Exception {
- Log.v(TAG, "Simultaneous tones test");
- ToneGenerator toneGen1;
- ToneGenerator toneGen2;
- int type;
- boolean result = true;
-
- toneGen1 = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
- toneGen2 = new ToneGenerator(AudioManager.STREAM_MUSIC, 50);
-
- if (toneGen1.startTone(ToneGenerator.TONE_DTMF_1)) {
- Thread.sleep(100);
- if (toneGen2.startTone(ToneGenerator.TONE_DTMF_2)) {
- Thread.sleep(500);
- toneGen1.stopTone();
- Thread.sleep(100);
- toneGen2.stopTone();
- } else {
- toneGen1.stopTone();
- result = false;
- }
- } else {
- result = false;
- }
-
- toneGen1.release();
- toneGen2.release();
- return result;
- }
-
- // Test start of new tone without stopping previous one
- public static boolean tonesStressTest() throws Exception {
- Log.v(TAG, "Stress tones test");
- ToneGenerator toneGen;
- int type;
- boolean result = true;
-
- toneGen = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
-
- for (type = ToneGenerator.TONE_DTMF_1; type <= ToneGenerator.TONE_DTMF_9; type++) {
- if (toneGen.startTone(type)) {
- Thread.sleep(200);
- } else {
- result = false;
- break;
- }
- }
-
- toneGen.release();
- return result;
- }
-
- // Perform all tones tests
- public static boolean tonesAllTest() throws Exception {
- Log.v(TAG, "All tones tests");
-
- if (!tonesDtmfTest()) {
- return false;
- }
- if (!tonesSupervisoryTest()) {
- return false;
- }
- if (!tonesProprietaryTest()) {
- return false;
- }
- if (!tonesSimultaneousTest()) {
- return false;
- }
- if (!tonesStressTest()) {
- return false;
- }
- return true;
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
deleted file mode 100644
index b606f25..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.performance;
-
-import com.android.mediaframeworktest.MediaFrameworkTest;
-import com.android.mediaframeworktest.MediaNames;
-
-import android.content.Context;
-import android.database.sqlite.SQLiteDatabase;
-import android.media.MediaPlayer;
-import android.os.SystemClock;
-import android.test.ActivityInstrumentationTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-import android.test.suitebuilder.annotation.Suppress;
-import android.util.Log;
-
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import android.media.MediaMetadataRetriever;
-
-/**
- * Junit / Instrumentation test case for the media player api
-
- */
-public class MediaPlayerPerformance extends ActivityInstrumentationTestCase<MediaFrameworkTest> {
-
-
- private boolean mIsPlaying = true;
- private String TAG = "MediaPlayerApiTest";
- Context mContext;
- private SQLiteDatabase mDB;
-
-
- public MediaPlayerPerformance() {
- super("com.android.mediaframeworktest", MediaFrameworkTest.class);
- }
-
- protected void setUp() throws Exception {
-
- super.setUp();
- }
-
- public void createDB(){
- mDB = SQLiteDatabase.openOrCreateDatabase("/sdcard/perf.db",null);
- mDB.execSQL("CREATE TABLE perfdata (_id INTEGER PRIMARY KEY,"
- + "file TEXT," + "setdatatime LONG," +"preparetime LONG," +"playtime LONG" + ");");
- }
-
- public void audioPlaybackStartupTime(String[] testFile){
- long t1 = 0;
- long t2 = 0;
- long t3 = 0;
- long t4 =0;
-
- long setDataSourceDuration = 0;
- long prepareDuration = 0;
- long startDuration=0;
-
- long totalSetDataTime=0;
- long totalPrepareTime=0;
- long totalStartDuration=0;
-
- int numberOfFiles = testFile.length;
- Log.v(TAG, "File lenght " + numberOfFiles);
- for (int k=0; k<numberOfFiles; k++){
- MediaPlayer mp = new MediaPlayer();
- try{
- t1 = SystemClock.uptimeMillis();
- FileInputStream fis = new FileInputStream(testFile[k]);
- FileDescriptor fd = fis.getFD();
- mp.setDataSource(fd);
- fis.close();
- t2 = SystemClock.uptimeMillis();
- mp.prepare();
- t3 = SystemClock.uptimeMillis();
- mp.start();
- t4 = SystemClock.uptimeMillis();
- Thread.sleep(10000);
- mp.pause();
- }catch (Exception e){}
- setDataSourceDuration = t2 -t1;
- prepareDuration = t3 - t2;
- startDuration = t4 - t3;
- totalSetDataTime = totalSetDataTime + setDataSourceDuration;
- totalPrepareTime = totalPrepareTime + prepareDuration;
- totalStartDuration = totalStartDuration + startDuration;
- mDB.execSQL("INSERT INTO perfdata (file, setdatatime, preparetime, playtime) VALUES (" + '"' + testFile[k] + '"' +','
- +setDataSourceDuration+ ',' + prepareDuration + ',' + startDuration +");");
- Log.v(TAG,"File name " + testFile[k]);
- mp.stop();
- mp.release();
- }
- Log.v (TAG, "setDataSource average " + totalSetDataTime/numberOfFiles);
- Log.v (TAG, "prepare average " + totalPrepareTime/numberOfFiles);
- Log.v (TAG, "start average " + totalStartDuration/numberOfFiles);
-
- }
-
- //Test cases for GetCurrentPosition
- @LargeTest
- public void testStartUpTime() throws Exception {
- createDB();
- audioPlaybackStartupTime(MediaNames.MP3FILES);
- audioPlaybackStartupTime(MediaNames.AACFILES);
-
- }
-
- public void wmametadatautility(String[] testFile){
- long t1 = 0;
- long t2 = 0;
- long sum = 0;
- long duration = 0;
- MediaMetadataRetriever retriever = new MediaMetadataRetriever();
- String value;
- for(int i = 0, n = testFile.length; i < n; ++i) {
- try {
- t1 = SystemClock.uptimeMillis();
- retriever.setDataSource(testFile[i]);
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_COMPOSER);
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE);
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_YEAR);
- value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER);
- t2 = SystemClock.uptimeMillis();
- duration = t2 - t1;
- Log.v(TAG, "Time taken = " + duration);
- sum=sum+duration;
- }
- catch (Exception e){Log.v(TAG, e.getMessage());}
-
- }
- Log.v(TAG, "Average duration = " + sum/testFile.length);
- }
-
- @Suppress
- public void testWmaParseTime() throws Exception {
- // createDB();
- wmametadatautility(MediaNames.WMASUPPORTED);
- }
-
-
-}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java
deleted file mode 100644
index dbf937c..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.stress;
-
-import com.android.mediaframeworktest.MediaFrameworkTest;
-
-import android.hardware.Camera;
-import android.media.MediaPlayer;
-import android.media.MediaRecorder;
-import android.test.ActivityInstrumentationTestCase2;
-import android.test.suitebuilder.annotation.LargeTest;
-import android.util.Log;
-import android.view.SurfaceHolder;
-
-/**
- * Junit / Instrumentation test case for the media player api
-
- */
-public class MediaRecorderStressTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
-
-
- private String TAG = "MediaRecorderStressTest";
- private MediaRecorder mRecorder;
- private Camera mCamera;
-
- private static final int NUMBER_OF_CAMERA_STRESS_LOOPS = 100;
- private static final int NUMBER_OF_RECORDER_STRESS_LOOPS = 100;
- private static final int NUMBER_OF_RECORDERANDPLAY_STRESS_LOOPS = 50;
- private static final int NUMBER_OF_SWTICHING_LOOPS_BW_CAMERA_AND_RECORDER = 200;
- private static final long WAIT_TIME_CAMERA_TEST = 3000; // 3 second
- private static final long WAIT_TIME_RECORDER_TEST = 60000; // 6 second
- private static final long WAIT_TIME_RECORD = 100000; // 10 seconds
- private static final long WAIT_TIME_PLAYBACK = 60000; // 6 second
- private static final String OUTPUT_FILE = "/sdcard/temp";
- private static final String OUTPUT_FILE_EXT = ".3gp";
-
- public MediaRecorderStressTest() {
- super("com.android.mediaframeworktest", MediaFrameworkTest.class);
- }
-
- protected void setUp() throws Exception {
- getActivity();
- super.setUp();
- }
-
- //Test case for stressing the camera preview.
- @LargeTest
- public void testStressCamera() throws Exception {
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
- try {
- Log.v(TAG, "Start preview");
- for (int i = 0; i< NUMBER_OF_CAMERA_STRESS_LOOPS; i++){
- mCamera = Camera.open();
- mCamera.setPreviewDisplay(mSurfaceHolder);
- mCamera.startPreview();
- Thread.sleep(WAIT_TIME_CAMERA_TEST);
- mCamera.stopPreview();
- mCamera.release();
- }
- } catch (Exception e) {
- Log.v(TAG, e.toString());
- }
- }
-
- //Test case for stressing the camera preview.
- @LargeTest
- public void testStressRecorder() throws Exception {
- String filename;
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
- try {
- Log.v(TAG, "Start preview");
- for (int i = 0; i < NUMBER_OF_RECORDER_STRESS_LOOPS; i++){
- Log.v(TAG, "counter = " + i);
- filename = OUTPUT_FILE + i + OUTPUT_FILE_EXT;
- Log.v(TAG, filename);
- mRecorder = new MediaRecorder();
- mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
- mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
- mRecorder.setOutputFile(filename);
- mRecorder.setVideoFrameRate(20);
- mRecorder.setVideoSize(176,144);
- Log.v(TAG, "setEncoder");
- mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
- mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
- Log.v(TAG, "setPreview");
- mRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
- Log.v(TAG, "prepare");
- mRecorder.prepare();
- Log.v(TAG, "before release");
- Thread.sleep(WAIT_TIME_RECORDER_TEST);
- mRecorder.reset();
- mRecorder.release();
- }
- } catch (Exception e) {
- Log.v(TAG, e.toString());
- }
- }
-
-
- //Stress test case for switching camera and video recorder preview.
- @LargeTest
- public void testStressCameraSwitchRecorder() throws Exception {
- String filename;
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
- try {
- Log.v(TAG, "Start preview");
- for (int i = 0; i < NUMBER_OF_SWTICHING_LOOPS_BW_CAMERA_AND_RECORDER; i++){
- mCamera = Camera.open();
- mCamera.setPreviewDisplay(mSurfaceHolder);
- mCamera.startPreview();
- Thread.sleep(WAIT_TIME_CAMERA_TEST);
- mCamera.stopPreview();
- mCamera.release();
- mCamera = null;
- Log.v(TAG, "release camera");
- filename = OUTPUT_FILE + i + OUTPUT_FILE_EXT;
- Log.v(TAG, filename);
- mRecorder = new MediaRecorder();
- mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
- mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
- mRecorder.setOutputFile(filename);
- mRecorder.setVideoFrameRate(20);
- mRecorder.setVideoSize(176,144);
- Log.v(TAG, "Media recorder setEncoder");
- mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
- Log.v(TAG, "mediaRecorder setPreview");
- mRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
- Log.v(TAG, "prepare");
- mRecorder.prepare();
- Log.v(TAG, "before release");
- Thread.sleep(WAIT_TIME_CAMERA_TEST);
- mRecorder.release();
- Log.v(TAG, "release video recorder");
- }
- } catch (Exception e) {
- Log.v(TAG, e.toString());
- }
- }
-
- //Stress test case for record a video and play right away.
- @LargeTest
- public void testStressRecordVideoAndPlayback() throws Exception {
- String filename;
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
- try {
- for (int i = 0; i < NUMBER_OF_RECORDERANDPLAY_STRESS_LOOPS; i++){
- filename = OUTPUT_FILE + i + OUTPUT_FILE_EXT;
- Log.v(TAG, filename);
- mRecorder = new MediaRecorder();
- mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
- mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
- mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
- mRecorder.setOutputFile(filename);
- mRecorder.setVideoFrameRate(20);
- mRecorder.setVideoSize(352,288);
- mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
- mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
- Log.v(TAG, "mediaRecorder setPreview");
- mRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
- mRecorder.prepare();
- mRecorder.start();
- Thread.sleep(WAIT_TIME_RECORD);
- Log.v(TAG, "Before stop");
- mRecorder.stop();
- mRecorder.release();
- //start the playback
- MediaPlayer mp = new MediaPlayer();
- mp.setDataSource(filename);
- mp.setDisplay(MediaFrameworkTest.mSurfaceView.getHolder());
- mp.prepare();
- mp.start();
- Thread.sleep(WAIT_TIME_PLAYBACK);
- mp.release();
- }
- } catch (Exception e) {
- Log.v(TAG, e.toString());
- }
- }
-}
-
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java
deleted file mode 100644
index 61a8a29..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.util.Log;
-import android.media.MediaMetadataRetriever;
-import android.graphics.Bitmap;
-import java.io.FileOutputStream;
-import android.test.AndroidTestCase;
-import com.android.mediaframeworktest.MediaNames;
-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";
-
- // Test album art extraction.
- @MediumTest
- public static void testAlbumArt() throws Exception {
- Log.v(TAG, "testAlbumArt starts.");
- MediaMetadataRetriever retriever = new MediaMetadataRetriever();
- 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]);
- retriever.setDataSource(MediaNames.ALBUMART_TEST_FILES[i]);
- byte[] albumArt = retriever.extractAlbumArt();
-
- // TODO:
- // A better test would be to compare the retrieved album art with the
- // known result.
- if (albumArt == null) { // Do we have expect in JUnit?
- fail("Fails to extract album art for " + MediaNames.ALBUMART_TEST_FILES[i]);
- }
- } catch(Exception e) {
- throw new Exception("Fails to setDataSource for " + MediaNames.ALBUMART_TEST_FILES[i], e);
- }
- Thread.yield(); // Don't be evil
- }
- retriever.release();
- Log.v(TAG, "testAlbumArt completes.");
- }
-
- // Test frame capture
- // Suppressing until 1259652 is fixed.
- @Suppress
- public static void disableTestThumbnailCapture() throws Exception {
- MediaMetadataRetriever retriever = new MediaMetadataRetriever();
- 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]);
- retriever.setDataSource(MediaNames.THUMBNAIL_CAPTURE_TEST_FILES[i]);
- Bitmap bitmap = retriever.captureFrame();
- assertTrue(bitmap != null);
- try {
- java.io.OutputStream stream = new FileOutputStream(MediaNames.THUMBNAIL_CAPTURE_TEST_FILES[i] + ".jpg");
- bitmap.compress(Bitmap.CompressFormat.JPEG, 75, stream);
- stream.close();
- } catch (Exception e) {
- throw new Exception("Fails to convert the bitmap to a JPEG file for " + MediaNames.THUMBNAIL_CAPTURE_TEST_FILES[i], e);
- }
- } catch(Exception e) {
- throw new Exception("Fails to setDataSource for file " + MediaNames.THUMBNAIL_CAPTURE_TEST_FILES[i], e);
- }
- Thread.yield(); // Don't be evil
- }
- long endedAt = System.currentTimeMillis();
- Log.v(TAG, "Average processing time per thumbnail: " + (endedAt - startedAt)/MediaNames.THUMBNAIL_CAPTURE_TEST_FILES.length + " ms");
- retriever.release();
- }
-
- @LargeTest
- public static void testMetadataRetrieval() throws Exception {
- 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 {
- retriever.setDataSource(MediaNames.METADATA_RETRIEVAL_TEST_FILES[i]);
- extractAllSupportedMetadataValues(retriever);
- } catch(Exception e) {
- throw new Exception("Fails to setDataSource for file " + MediaNames.METADATA_RETRIEVAL_TEST_FILES[i], e);
- }
- Thread.yield(); // Don't be evil
- }
- retriever.release();
- }
-
- // If the specified call order and valid media file is used, no exception
- // should be thrown.
- @MediumTest
- public static void testBasicNormalMethodCallSequence() throws Exception {
- 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 {
- java.io.OutputStream stream = new FileOutputStream("/sdcard/thumbnailout.jpg");
- bitmap.compress(Bitmap.CompressFormat.JPEG, 75, stream);
- stream.close();
- } 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) {
- throw new Exception("Fails to setDataSource for " + MediaNames.TEST_PATH_1, e);
- }
- retriever.release();
- }
-
- // If setDataSource() has not been called, both captureFrame() and extractMetadata() must
- // return null.
- @MediumTest
- public static void testBasicAbnormalMethodCallSequence() {
- MediaMetadataRetriever retriever = new MediaMetadataRetriever();
- retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY);
- assertTrue(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM) == null);
- assertTrue(retriever.captureFrame() == null);
- }
-
- // Test setDataSource()
- @MediumTest
- public static void testSetDataSource() {
- MediaMetadataRetriever retriever = new MediaMetadataRetriever();
- retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY);
-
- // Null pointer argument
- try {
- String path = null;
- retriever.setDataSource(path);
- fail("IllegalArgumentException must be thrown.");
- } catch(Exception e) {
- assertTrue(e instanceof IllegalArgumentException);
- }
-
- // Use mem:// path
- try {
- retriever.setDataSource(MediaNames.TEST_PATH_5);
- fail("IllegalArgumentException must be thrown.");
- } catch(Exception e) {
- assertTrue(e instanceof IllegalArgumentException);
- }
-
- // The pathname does not correspond to any existing file
- try {
- retriever.setDataSource(MediaNames.TEST_PATH_4);
- fail("Runtime exception must be thrown.");
- } catch(Exception e) {
- assertTrue(e instanceof RuntimeException);
- }
-
- // The pathname does correspond to a file, but this file
- // is not a valid media file
- try {
- retriever.setDataSource(MediaNames.TEST_PATH_3);
- fail("Runtime exception must be thrown.");
- } catch(Exception e) {
- assertTrue(e instanceof RuntimeException);
- }
-
- retriever.release();
- }
-
- // 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();
- // 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);
- retriever.setDataSource(MediaNames.TEST_PATH_1);
- assertTrue(retriever.captureFrame() == null);
- assertTrue(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS) == null);
-
- // 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 metadata only
- retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY);
- retriever.setDataSource(MediaNames.TEST_PATH_1);
- assertTrue(retriever.captureFrame() == null);
-
- // 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.release();
- }
-
- // TODO:
- // Encode and test for the correct mix of metadata elements on a per-file basis?
- // We should be able to compare the actual returned metadata with the expected metadata
- // with each given sample test file.
- private static void extractAllSupportedMetadataValues(MediaMetadataRetriever retriever) {
- String value = null;
- Log.v(TAG, (value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER)) == null? "not found": value);
- Log.v(TAG, (value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)) == null? "not found": value);
- Log.v(TAG, (value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS)) == null? "not found": value);
- Log.v(TAG, (value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM)) == null? "not found": value);
- Log.v(TAG, (value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST)) == null? "not found": value);
- Log.v(TAG, (value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_AUTHOR)) == null? "not found": value);
- Log.v(TAG, (value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_COMPOSER)) == null? "not found": value);
- Log.v(TAG, (value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DATE)) == null? "not found": value);
- Log.v(TAG, (value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE)) == null? "not found": value);
- Log.v(TAG, (value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE)) == null? "not found": value);
- Log.v(TAG, (value = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_YEAR)) == null? "not found": value);
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetCurrentPositionStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetCurrentPositionStateUnitTest.java
deleted file mode 100644
index 032b469..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetCurrentPositionStateUnitTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.getCurrentPosition() method can be called.
- */
-public class MediaPlayerGetCurrentPositionStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call getCurrentPosition() in the following states:
- * {Idle, Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted}.
- * 2. It is invalid to call getCurrentPosition() in the following states:
- * {Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInInitializedState);
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInPreparedStateAfterStop);
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInPausedState);
- assertTrue(!stateErrors.errorInStoppedState);
- assertTrue(!stateErrors.errorInPlaybackCompletedState);
- assertTrue(!stateErrors.errorInIdleStateAfterReset);
-
- // Invalid states.
- assertTrue(stateErrors.errorInErrorState);
- assertTrue(!stateErrors.errorInIdleState); // onError() won't be called
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- player.getCurrentPosition();
- }
-
- @LargeTest
- public void testGetCurrentPosition() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "getCurrentPosition()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetDurationStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetDurationStateUnitTest.java
deleted file mode 100644
index 5f7abe5..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetDurationStateUnitTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.getDuration() method can be called.
- */
-public class MediaPlayerGetDurationStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call getDuration() in the following states:
- * {Prepared, Started, Paused, Stopped, PlaybackCompleted}.
- * 2. It is invalid to call getDuration() in the following states:
- * {Idle, Initialized, Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInPreparedStateAfterStop);
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInPausedState);
- assertTrue(!stateErrors.errorInStoppedState);
- assertTrue(!stateErrors.errorInPlaybackCompletedState);
-
- // Invalid states.
- assertTrue(!stateErrors.errorInIdleState); // onError() won't be called
- assertTrue(stateErrors.errorInInitializedState);
- assertTrue(stateErrors.errorInErrorState);
- assertTrue(stateErrors.errorInIdleStateAfterReset);
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- player.getDuration();
- }
-
- @LargeTest
- public void testGetDuration() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "getDuration()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetVideoHeightStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetVideoHeightStateUnitTest.java
deleted file mode 100644
index 6d3c083..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetVideoHeightStateUnitTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.getVideoHeight() method can be called.
- */
-public class MediaPlayerGetVideoHeightStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call getVideoHeight() in the following states:
- * {Idle, Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted}.
- * 2. It is invalid to call getVideoHeight() in the following states:
- * {Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInPreparedStateAfterStop);
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInPausedState);
- assertTrue(!stateErrors.errorInPlaybackCompletedState);
- assertTrue(!stateErrors.errorInIdleState);
- assertTrue(!stateErrors.errorInIdleStateAfterReset);
- assertTrue(!stateErrors.errorInInitializedState);
- assertTrue(!stateErrors.errorInStoppedState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInErrorState);
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- player.getVideoHeight();
- }
-
- @LargeTest
- public void testGetVideoHeight() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "getVideoHeight()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetVideoWidthStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetVideoWidthStateUnitTest.java
deleted file mode 100644
index 198439c..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerGetVideoWidthStateUnitTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.getVideoWidth() method can be called.
- */
-public class MediaPlayerGetVideoWidthStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call getVideoWidth() in the following states:
- * {Idle, Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted}.
- * 2. It is invalid to call getVideoWidth() in the following states:
- * {Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInPausedState);
- assertTrue(!stateErrors.errorInPlaybackCompletedState);
- assertTrue(!stateErrors.errorInIdleState);
- assertTrue(!stateErrors.errorInIdleStateAfterReset);
- assertTrue(!stateErrors.errorInInitializedState);
- assertTrue(!stateErrors.errorInStoppedState);
- assertTrue(!stateErrors.errorInPreparedStateAfterStop);
-
- // Invalid states.
- assertTrue(stateErrors.errorInErrorState);
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- player.getVideoWidth();
- }
-
- @LargeTest
- public void testGetVideoWidth() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "getVideoWidth()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerIsPlayingStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerIsPlayingStateUnitTest.java
deleted file mode 100644
index b9c63fd..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerIsPlayingStateUnitTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.isPlaying() method can be called.
- */
-public class MediaPlayerIsPlayingStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call isPlaying() in the following states:
- * {Idle, Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted}.
- * 2. It is invalid to call isPlaying() in the following states:
- * {Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInPreparedStateAfterStop);
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInPausedState);
- assertTrue(!stateErrors.errorInPlaybackCompletedState);
- assertTrue(!stateErrors.errorInIdleState);
- assertTrue(!stateErrors.errorInIdleStateAfterReset);
- assertTrue(!stateErrors.errorInInitializedState);
- assertTrue(!stateErrors.errorInStoppedState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInErrorState);
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- player.isPlaying();
- }
-
- @LargeTest
- public void testIsPlaying() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "isPlaying()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerMethodUnderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerMethodUnderTest.java
deleted file mode 100644
index 91ed694..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerMethodUnderTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-
-/**
- * All MediaPlayer method unit test subclass must implement this interface.
- */
-interface MediaPlayerMethodUnderTest {
- public void checkStateErrors(MediaPlayerStateErrors stateErrors);
- public void invokeMethodUnderTest(MediaPlayer player);
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerPauseStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerPauseStateUnitTest.java
deleted file mode 100644
index 0a18a39..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerPauseStateUnitTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.pause() method can be called.
- */
-public class MediaPlayerPauseStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call pause() in the following states:
- * {Started, Paused}.
- * 2. It is invalid to call pause() in the following states:
- * {Idle, Initialized, Prepared, Stopped, PlaybackCompleted, Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInPausedState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInPreparedState);
- assertTrue(stateErrors.errorInPreparedStateAfterStop);
- assertTrue(stateErrors.errorInPlaybackCompletedState);
- assertTrue(!stateErrors.errorInIdleState); // noError() won't be called
- assertTrue(stateErrors.errorInIdleStateAfterReset);
- assertTrue(stateErrors.errorInInitializedState);
- assertTrue(stateErrors.errorInStoppedState);
- assertTrue(stateErrors.errorInErrorState);
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- player.pause();
- }
-
- @LargeTest
- public void testPause() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "pause()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerResetStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerResetStateUnitTest.java
deleted file mode 100644
index 2497cd7..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerResetStateUnitTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.reset() method can be called.
- */
-public class MediaPlayerResetStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call reset() in the following states:
- * {Idle, Initialized, Prepared, Started, Paused, Stopped, PlaybackCompleted}.
- * 2. It is invalid to call reset() in the following states:
- * {Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInPreparedStateAfterStop);
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInPausedState);
- assertTrue(!stateErrors.errorInPlaybackCompletedState);
- assertTrue(!stateErrors.errorInIdleState);
- assertTrue(!stateErrors.errorInIdleStateAfterReset);
- assertTrue(!stateErrors.errorInInitializedState);
- assertTrue(!stateErrors.errorInStoppedState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInErrorState);
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- player.reset();
- }
-
- @LargeTest
- public void testReset() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "reset()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSeekToStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSeekToStateUnitTest.java
deleted file mode 100644
index 46bba9b..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSeekToStateUnitTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.seekTo() method can be called.
- */
-public class MediaPlayerSeekToStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call seekTo() in the following states:
- * {Prepared, Started, Paused, PlaybackComplted}.
- * 2. It is invalid to call seekTo() in the following states:
- * {Idle, Initialized, Stopped, Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInPreparedStateAfterStop);
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInPausedState);
- assertTrue(!stateErrors.errorInPlaybackCompletedState);
-
- // Invalid states.
- assertTrue(!stateErrors.errorInIdleState); // onError() won't be called
- assertTrue(stateErrors.errorInIdleStateAfterReset);
- assertTrue(stateErrors.errorInInitializedState);
- assertTrue(stateErrors.errorInStoppedState);
- assertTrue(stateErrors.errorInErrorState);
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- player.seekTo(0);
- }
-
- @LargeTest
- public void testSeekTo() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "seekTo()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetAudioStreamTypeStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetAudioStreamTypeStateUnitTest.java
deleted file mode 100644
index 3153792..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetAudioStreamTypeStateUnitTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.media.AudioManager;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.setAudioStreamType() method can be called.
- */
-public class MediaPlayerSetAudioStreamTypeStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call setAudioStreamType() in the following states:
- * {Idle, Initialized, Stopped, Prepared, Started, Paused, PlaybackComplted}.
- * 2. It is invalid to call setAudioStreamType() in the following states:
- * {Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInIdleState);
- assertTrue(!stateErrors.errorInIdleStateAfterReset);
- assertTrue(!stateErrors.errorInPreparedStateAfterStop);
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInPausedState);
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInPlaybackCompletedState);
- assertTrue(!stateErrors.errorInInitializedState);
- assertTrue(!stateErrors.errorInStoppedState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInErrorState);
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- player.setAudioStreamType(AudioManager.STREAM_MUSIC);
- }
-
- @LargeTest
- public void testSetAudioSystemType() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "setAudioStreamType()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetLoopingStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetLoopingStateUnitTest.java
deleted file mode 100644
index 17c9d8c..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetLoopingStateUnitTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.setLooping() method can be called.
- */
-public class MediaPlayerSetLoopingStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
- private boolean looping = false;
-
- /**
- * 1. It is valid to call setLooping() in the following states:
- * {Idle, Initialized, Stopped, Prepared, Started, Paused, PlaybackComplted}.
- * 2. It is invalid to call setLooping() in the following states:
- * {Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInPausedState);
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInPreparedStateAfterStop);
- assertTrue(!stateErrors.errorInPlaybackCompletedState);
- assertTrue(!stateErrors.errorInIdleStateAfterReset);
- assertTrue(!stateErrors.errorInInitializedState);
- assertTrue(!stateErrors.errorInStoppedState);
- assertTrue(!stateErrors.errorInIdleState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInErrorState);
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- looping = !looping; // Flip the looping mode.
- player.setLooping(looping);
- }
-
- @LargeTest
- public void testSetLooping() {
- mTestTemplate.runTestOnMethod(this);
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetVolumeStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetVolumeStateUnitTest.java
deleted file mode 100644
index a149565..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerSetVolumeStateUnitTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.setVolume() method can be called.
- */
-public class MediaPlayerSetVolumeStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call setVolume() in the following states:
- * {Idle, Initialized, Stopped, Prepared, Started, Paused, PlaybackComplted}.
- * 2. It is invalid to call setVolume() in the following states:
- * {Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInPausedState);
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInPreparedStateAfterStop);
- assertTrue(!stateErrors.errorInPlaybackCompletedState);
- assertTrue(!stateErrors.errorInIdleStateAfterReset);
- assertTrue(!stateErrors.errorInInitializedState);
- assertTrue(!stateErrors.errorInStoppedState);
- assertTrue(!stateErrors.errorInIdleState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInErrorState);
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- player.setVolume(0.5f, 0.5f);
- }
-
- @LargeTest
- public void testSetVolume() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "setVolume()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStartStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStartStateUnitTest.java
deleted file mode 100644
index 6debbb4..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStartStateUnitTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.start() method can be called.
- */
-public class MediaPlayerStartStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call start() in the following states:
- * {Prepared, Started, Paused, PlaybackComplted}.
- * 2. It is invalid to call start() in the following states:
- * {Idle, Initialized, Stopped, Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInPreparedStateAfterStop);
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInPausedState);
- assertTrue(!stateErrors.errorInPlaybackCompletedState);
-
- // Invalid states.
- assertTrue(!stateErrors.errorInIdleState); // onError() won't be called
- assertTrue(stateErrors.errorInErrorState);
- assertTrue(stateErrors.errorInIdleStateAfterReset);
- assertTrue(stateErrors.errorInInitializedState);
- assertTrue(stateErrors.errorInStoppedState);
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- player.start();
- }
-
- @LargeTest
- public void testStart() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "start()";
- }
-
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStateErrors.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStateErrors.java
deleted file mode 100644
index 5be6fe3..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStateErrors.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-class MediaPlayerStateErrors {
- public static final int MEDIA_PLAYER_ERROR = 100;
- public static enum MediaPlayerState {
- IDLE,
- IDLE_AFTER_RESET,
- INITIALIZED,
- PREPARED,
- PREPARED_AFTER_STOP,
- STARTED,
- STARTED_AFTER_PAUSE,
- PAUSED,
- STOPPED,
- PLAYBACK_COMPLETED,
- ERROR,
- }
-
- // Error occurs in the states below?
- public boolean errorInIdleState = false;
- public boolean errorInIdleStateAfterReset = false;
- public boolean errorInInitializedState = false;
- public boolean errorInPreparedState = false;
- public boolean errorInStartedState = false;
- public boolean errorInPausedState = false;
- public boolean errorInStartedStateAfterPause = false;
- public boolean errorInStoppedState = false;
- public boolean errorInPreparedStateAfterStop = false;
- public boolean errorInPlaybackCompletedState = false;
- public boolean errorInErrorState = false;
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStateUnitTestTemplate.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStateUnitTestTemplate.java
deleted file mode 100644
index 6abfbb2..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStateUnitTestTemplate.java
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.util.Log;
-import android.os.Looper;
-import android.os.Handler;
-import android.os.Message;
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import com.android.mediaframeworktest.MediaNames;
-
-/**
- * A template class for running a method under test in all possible
- * states of a MediaPlayer object.
- *
- * @see com.android.mediaframeworktest.unit.MediaPlayerSeekToStateUnitTest
- * for an example of using this class.
- *
- * A typical concrete unit test class would implement the
- * MediaPlayerMethodUnderTest interface and have a reference to an object of
- * this class. Then it calls runTestOnMethod() to actually perform the unit
- * tests.
- *
- */
-class MediaPlayerStateUnitTestTemplate extends AndroidTestCase {
- private static final String TEST_PATH = MediaNames.TEST_PATH_1;
- private static final String TAG = "MediaPlayerSeekToStateUnitTest";
- private static final int SEEK_TO_END = 135110; // Milliseconds.
- private static int WAIT_FOR_COMMAND_TO_COMPLETE = 1000; // Milliseconds.
-
- private MediaPlayerStateErrors mStateErrors = new MediaPlayerStateErrors();
- private MediaPlayer mMediaPlayer = null;
- private boolean mInitialized = false;
- private boolean mOnCompletionHasBeenCalled = false;
- private MediaPlayerStateErrors.MediaPlayerState mMediaPlayerState = null;
- private Looper mLooper = null;
- private final Object lock = new Object();
- private MediaPlayerMethodUnderTest mMethodUnderTest = null;
-
- // An Handler object is absolutely necessary for receiving callback
- // messages from MediaPlayer objects.
- private Handler mHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- /*
- switch(msg.what) {
- case MediaPlayerStateErrors.MEDIA_PLAYER_ERROR:
- Log.v(TAG, "handleMessage: received MEDIA_PLAYER_ERROR message");
- break;
- default:
- Log.v(TAG, "handleMessage: received unknown message");
- break;
- }
- */
- }
- };
-
- /**
- * Runs the given method under test in all possible states of a MediaPlayer
- * object.
- *
- * @param testMethod the method under test.
- */
- public void runTestOnMethod(MediaPlayerMethodUnderTest testMethod) {
- mMethodUnderTest = testMethod;
- if (mMethodUnderTest != null) { // Method under test has been set?
- initializeMessageLooper();
- synchronized(lock) {
- try {
- lock.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch(Exception e) {
- Log.v(TAG, "runTestOnMethod: wait was interrupted.");
- }
- }
- assertTrue(mInitialized); // mMediaPlayer has been initialized?
- checkMethodUnderTestInAllPossibleStates();
- terminateMessageLooper(); // Release message looper thread.
- assertTrue(mOnCompletionHasBeenCalled);
- mMethodUnderTest.checkStateErrors(mStateErrors);
- cleanUp();
- }
- }
-
- /*
- * Initializes the message looper so that the MediaPlayer object can
- * receive the callback messages.
- */
- private void initializeMessageLooper() {
- new Thread() {
- @Override
- public void run() {
- // Set up a looper to be used by mMediaPlayer.
- Looper.prepare();
-
- // Save the looper so that we can terminate this thread
- // after we are done with it.
- mLooper = Looper.myLooper();
-
- mMediaPlayer = new MediaPlayer();
- mMediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
- public boolean onError(MediaPlayer player, int what, int extra) {
- Log.v(TAG, "onError has been called.");
- synchronized(lock) {
- Log.v(TAG, "notify lock.");
- setStateError(mMediaPlayerState, true);
- if (mMediaPlayerState != MediaPlayerStateErrors.MediaPlayerState.ERROR) {
- notifyStateError();
- }
- lock.notify();
- }
- return true;
- }
- });
- mMediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
- public void onCompletion(MediaPlayer player) {
- Log.v(TAG, "onCompletion has been called.");
- synchronized(lock) {
- if (mMediaPlayerState == MediaPlayerStateErrors.MediaPlayerState.PLAYBACK_COMPLETED) {
- mOnCompletionHasBeenCalled = true;
- }
- lock.notify();
- }
- }
- });
- synchronized(lock) {
- mInitialized = true;
- lock.notify();
- }
- Looper.loop(); // Blocks forever until Looper.quit() is called.
- Log.v(TAG, "initializeMessageLooper: quit.");
- }
- }.start();
- }
-
- /*
- * Calls method under test in the given state of the MediaPlayer object.
- *
- * @param state the MediaPlayer state in which the method under test is called.
- */
- private void callMediaPlayerMethodUnderTestInState(MediaPlayerStateErrors.MediaPlayerState state) {
- Log.v(TAG, "call " + mMethodUnderTest + ": started in state " + state);
- setMediaPlayerToState(state);
- mMethodUnderTest.invokeMethodUnderTest(mMediaPlayer);
- synchronized(lock) {
- try {
- lock.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch(Exception e) {
- Log.v(TAG, "callMediaPlayerMethodUnderTestInState: wait is interrupted in state " + state);
- }
- }
- Log.v(TAG, "call " + mMethodUnderTest + ": ended in state " + state);
- }
-
- /*
- * The following setMediaPlayerToXXXStateXXX methods sets the MediaPlayer
- * object to the corresponding state, given the assumption that reset()
- * always resets the MediaPlayer object to Idle (after reset) state.
- */
- private void setMediaPlayerToIdleStateAfterReset() {
- try {
- mMediaPlayer.reset();
- mMediaPlayer.setDataSource(TEST_PATH);
- mMediaPlayer.prepare();
- mMediaPlayer.reset();
- } catch(Exception e) {
- Log.v(TAG, "setMediaPlayerToIdleStateAfterReset: Exception " + e.getClass().getName() + " was thrown.");
- assertTrue(false);
- }
- }
-
- private void setMediaPlayerToInitializedState() {
- try {
- mMediaPlayer.reset();
- mMediaPlayer.setDataSource(TEST_PATH);
- } catch(Exception e) {
- Log.v(TAG, "setMediaPlayerToInitializedState: Exception " + e.getClass().getName() + " was thrown.");
- assertTrue(false);
- }
- }
-
- private void setMediaPlayerToPreparedState() {
- try {
- mMediaPlayer.reset();
- mMediaPlayer.setDataSource(TEST_PATH);
- mMediaPlayer.prepare();
- } catch(Exception e) {
- Log.v(TAG, "setMediaPlayerToPreparedState: Exception " + e.getClass().getName() + " was thrown.");
- assertTrue(false);
- }
- }
-
- private void setMediaPlayerToPreparedStateAfterStop() {
- try {
- mMediaPlayer.reset();
- mMediaPlayer.setDataSource(TEST_PATH);
- mMediaPlayer.prepare();
- mMediaPlayer.start();
- mMediaPlayer.stop();
- mMediaPlayer.prepare();
- } catch(Exception e) {
- Log.v(TAG, "setMediaPlayerToPreparedStateAfterStop: Exception " + e.getClass().getName() + " was thrown.");
- assertTrue(false);
- }
- }
-
- private void setMediaPlayerToStartedState() {
- try {
- mMediaPlayer.reset();
- mMediaPlayer.setDataSource(TEST_PATH);
- mMediaPlayer.prepare();
- mMediaPlayer.start();
- } catch(Exception e) {
- Log.v(TAG, "setMediaPlayerToStartedState: Exception " + e.getClass().getName() + " was thrown.");
- assertTrue(false);
- }
- }
-
- private void setMediaPlayerToStartedStateAfterPause() {
- try {
- mMediaPlayer.reset();
- mMediaPlayer.setDataSource(TEST_PATH);
- mMediaPlayer.prepare();
- mMediaPlayer.start();
- mMediaPlayer.pause();
-
- // pause() is an asynchronous call and returns immediately, but
- // PV player engine may take quite a while to actually set the
- // player state to Paused; if we call start() right after pause()
- // without waiting, start() may fail.
- try {
- Thread.sleep(MediaNames.PAUSE_WAIT_TIME);
- } catch(Exception ie) {
- Log.v(TAG, "sleep was interrupted and terminated prematurely");
- }
-
- mMediaPlayer.start();
- } catch(Exception e) {
- Log.v(TAG, "setMediaPlayerToStartedStateAfterPause: Exception " + e.getClass().getName() + " was thrown.");
- assertTrue(false);
- }
- }
-
- private void setMediaPlayerToPausedState() {
- try {
- mMediaPlayer.reset();
- mMediaPlayer.setDataSource(TEST_PATH);
- mMediaPlayer.prepare();
- mMediaPlayer.start();
- mMediaPlayer.pause();
- } catch(Exception e) {
- Log.v(TAG, "setMediaPlayerToPausedState: Exception " + e.getClass().getName() + " was thrown.");
- assertTrue(false);
- }
- }
-
- private void setMediaPlayerToStoppedState() {
- try {
- mMediaPlayer.reset();
- mMediaPlayer.setDataSource(TEST_PATH);
- mMediaPlayer.prepare();
- mMediaPlayer.start();
- mMediaPlayer.stop();
- } catch(Exception e) {
- Log.v(TAG, "setMediaPlayerToStoppedState: Exception " + e.getClass().getName() + " was thrown.");
- assertTrue(false);
- }
- }
-
- private void setMediaPlayerToPlaybackCompletedState() {
- try {
- mMediaPlayer.reset();
- mMediaPlayer.setDataSource(TEST_PATH);
- mMediaPlayer.prepare();
- mMediaPlayer.seekTo(SEEK_TO_END);
- mMediaPlayer.start();
- synchronized(lock) {
- try {
- lock.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch(Exception e) {
- Log.v(TAG, "setMediaPlayerToPlaybackCompletedState: wait was interrupted.");
- }
- }
- } catch(Exception e) {
- Log.v(TAG, "setMediaPlayerToPlaybackCompletedState: Exception " + e.getClass().getName() + " was thrown.");
- assertTrue(false);
- }
- Log.v(TAG, "setMediaPlayerToPlaybackCompletedState: done.");
- }
-
- /*
- * There are a lot of ways to force the MediaPlayer object to enter
- * the Error state. The impact (such as onError is called or not) highly
- * depends on how the Error state is entered.
- */
- private void setMediaPlayerToErrorState() {
- try {
- mMediaPlayer.reset();
- mMediaPlayer.setDataSource(TEST_PATH);
- mMediaPlayer.start();
- synchronized(lock) {
- try {
- lock.wait(WAIT_FOR_COMMAND_TO_COMPLETE);
- } catch(Exception e) {
- Log.v(TAG, "setMediaPlayerToErrorState: wait was interrupted.");
- }
- }
- } catch(Exception e) {
- Log.v(TAG, "setMediaPlayerToErrorState: Exception " + e.getClass().getName() + " was thrown.");
- assertTrue(e instanceof IllegalStateException);
- }
- Log.v(TAG, "setMediaPlayerToErrorState: done.");
- }
-
- /*
- * Sets the state of the MediaPlayer object to the specified one.
- *
- * @param state the state of the MediaPlayer object.
- */
- private void setMediaPlayerToState(MediaPlayerStateErrors.MediaPlayerState state) {
- mMediaPlayerState = state;
- switch(state) {
- case IDLE:
- // Does nothing.
- break;
- case IDLE_AFTER_RESET:
- setMediaPlayerToIdleStateAfterReset();
- break;
- case INITIALIZED:
- setMediaPlayerToInitializedState();
- break;
- case PREPARED:
- setMediaPlayerToPreparedState();
- break;
- case PREPARED_AFTER_STOP:
- setMediaPlayerToPreparedStateAfterStop();
- break;
- case STARTED:
- setMediaPlayerToStartedState();
- break;
- case STARTED_AFTER_PAUSE:
- setMediaPlayerToStartedStateAfterPause();
- break;
- case PAUSED:
- setMediaPlayerToPausedState();
- break;
- case STOPPED:
- setMediaPlayerToStoppedState();
- break;
- case PLAYBACK_COMPLETED:
- setMediaPlayerToPlaybackCompletedState();
- break;
- case ERROR:
- setMediaPlayerToErrorState();
- break;
- }
- }
-
- /*
- * Sets the error value of the corresponding state to the given error.
- *
- * @param state the state of the MediaPlayer object.
- * @param error the value of the state error to be set.
- */
- private void setStateError(MediaPlayerStateErrors.MediaPlayerState state, boolean error) {
- switch(state) {
- case IDLE:
- mStateErrors.errorInIdleState = error;
- break;
- case IDLE_AFTER_RESET:
- mStateErrors.errorInIdleStateAfterReset = error;
- break;
- case INITIALIZED:
- mStateErrors.errorInInitializedState = error;
- break;
- case PREPARED:
- mStateErrors.errorInPreparedState = error;
- break;
- case PREPARED_AFTER_STOP:
- mStateErrors.errorInPreparedStateAfterStop = error;
- break;
- case STARTED:
- mStateErrors.errorInStartedState = error;
- break;
- case STARTED_AFTER_PAUSE:
- mStateErrors.errorInStartedStateAfterPause = error;
- break;
- case PAUSED:
- mStateErrors.errorInPausedState = error;
- break;
- case STOPPED:
- mStateErrors.errorInStoppedState = error;
- break;
- case PLAYBACK_COMPLETED:
- mStateErrors.errorInPlaybackCompletedState = error;
- break;
- case ERROR:
- mStateErrors.errorInErrorState = error;
- break;
- }
- }
-
- private void notifyStateError() {
- mHandler.sendMessage(mHandler.obtainMessage(MediaPlayerStateErrors.MEDIA_PLAYER_ERROR));
- }
-
- private void checkIdleState() {
- callMediaPlayerMethodUnderTestInState(MediaPlayerStateErrors.MediaPlayerState.IDLE);
- }
-
- private void checkIdleStateAfterReset() {
- callMediaPlayerMethodUnderTestInState(MediaPlayerStateErrors.MediaPlayerState.IDLE_AFTER_RESET);
- }
-
- private void checkInitializedState() {
- callMediaPlayerMethodUnderTestInState(MediaPlayerStateErrors.MediaPlayerState.INITIALIZED);
- }
-
- private void checkPreparedState() {
- callMediaPlayerMethodUnderTestInState(MediaPlayerStateErrors.MediaPlayerState.PREPARED);
- }
-
- private void checkPreparedStateAfterStop() {
- callMediaPlayerMethodUnderTestInState(MediaPlayerStateErrors.MediaPlayerState.PREPARED_AFTER_STOP);
- }
-
- private void checkStartedState() {
- callMediaPlayerMethodUnderTestInState(MediaPlayerStateErrors.MediaPlayerState.STARTED);
- }
-
- private void checkPausedState() {
- callMediaPlayerMethodUnderTestInState(MediaPlayerStateErrors.MediaPlayerState.PAUSED);
- }
-
- private void checkStartedStateAfterPause() {
- callMediaPlayerMethodUnderTestInState(MediaPlayerStateErrors.MediaPlayerState.STARTED_AFTER_PAUSE);
- }
-
- private void checkStoppedState() {
- callMediaPlayerMethodUnderTestInState(MediaPlayerStateErrors.MediaPlayerState.STOPPED);
- }
-
- private void checkPlaybackCompletedState() {
- callMediaPlayerMethodUnderTestInState(MediaPlayerStateErrors.MediaPlayerState.PLAYBACK_COMPLETED);
- }
-
- private void checkErrorState() {
- callMediaPlayerMethodUnderTestInState(MediaPlayerStateErrors.MediaPlayerState.ERROR);
- }
-
- /*
- * Checks the given method under test in all possible states of the MediaPlayer object.
- */
- private void checkMethodUnderTestInAllPossibleStates() {
- // Must be called first.
- checkIdleState();
-
- // The sequence of the following method calls should not
- // affect the test results.
- checkErrorState();
- checkIdleStateAfterReset();
- checkInitializedState();
- checkStartedState();
- checkStartedStateAfterPause();
- checkPausedState();
- checkPreparedState();
-
- checkPreparedStateAfterStop();
-
- checkPlaybackCompletedState();
- checkStoppedState();
- }
-
- /*
- * Terminates the message looper thread.
- */
- private void terminateMessageLooper() {
- mLooper.quit();
- mMediaPlayer.release();
- }
-
- /*
- * Cleans up all the internal object references.
- */
- private void cleanUp() {
- mMediaPlayer = null;
- mMediaPlayerState = null;
- mLooper = null;
- mStateErrors = null;
- mMethodUnderTest = null;
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStopStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStopStateUnitTest.java
deleted file mode 100644
index 3427f86..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaPlayerStopStateUnitTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaPlayer;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaPlayer.stop() method can be called.
- */
-public class MediaPlayerStopStateUnitTest extends AndroidTestCase implements MediaPlayerMethodUnderTest {
- private MediaPlayerStateUnitTestTemplate mTestTemplate = new MediaPlayerStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call stop() in the following states:
- * {Prepared, Started, Stopped, Paused, PlaybackCompleted}.
- * 2. It is invalid to call stop() in the following states:
- * {Idle, Initialized, Error}
- *
- * @param stateErrors the MediaPlayerStateErrors to check against.
- */
- public void checkStateErrors(MediaPlayerStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInStartedState);
- assertTrue(!stateErrors.errorInStartedStateAfterPause);
- assertTrue(!stateErrors.errorInStoppedState);
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInPreparedStateAfterStop);
- assertTrue(!stateErrors.errorInPlaybackCompletedState);
- assertTrue(!stateErrors.errorInPausedState);
-
- // Invalid states.
- assertTrue(!stateErrors.errorInIdleState); // noError() won't be called
- assertTrue(stateErrors.errorInIdleStateAfterReset);
- assertTrue(stateErrors.errorInInitializedState);
- assertTrue(stateErrors.errorInErrorState);
- }
-
- public void invokeMethodUnderTest(MediaPlayer player) {
- player.stop();
- }
-
- @LargeTest
- public void testStop() {
- mTestTemplate.runTestOnMethod(this);
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderMethodUnderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderMethodUnderTest.java
deleted file mode 100644
index 3f46f74..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderMethodUnderTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaRecorder;
-
-/**
- * All MediaRecorder method unit test subclass must implement this interface.
- */
-interface MediaRecorderMethodUnderTest {
- public void checkStateErrors(MediaRecorderStateErrors stateErrors);
- public void invokeMethodUnderTest(MediaRecorder player);
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderPrepareStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderPrepareStateUnitTest.java
deleted file mode 100644
index 134144d..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderPrepareStateUnitTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaRecorder;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.Suppress;
-import java.io.IOException;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaRecorder.prepare() method can be called.
- */
-public class MediaRecorderPrepareStateUnitTest extends AndroidTestCase implements MediaRecorderMethodUnderTest {
- private MediaRecorderStateUnitTestTemplate mTestTemplate = new MediaRecorderStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call prepare() in the following states:
- * {DataSourceConfigured}.
- * 2. It is invalid to call prepare() in the following states:
- * {Prepared, Initial, Initialized, Recording, Error}
- *
- * @param stateErrors the MediaRecorderStateErrors to check against.
- */
- public void checkStateErrors(MediaRecorderStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInDataSourceConfiguredState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInPreparedState);
- assertTrue(stateErrors.errorInRecordingState);
- assertTrue(stateErrors.errorInInitialState);
- assertTrue(stateErrors.errorInInitialStateAfterReset);
- assertTrue(stateErrors.errorInInitialStateAfterStop);
- assertTrue(stateErrors.errorInInitializedState);
- assertTrue(stateErrors.errorInErrorState);
- }
-
- public void invokeMethodUnderTest(MediaRecorder recorder) {
- try {
- recorder.prepare();
- } catch (IOException exception) {
- throw new RuntimeException();
- }
- }
-
- @MediumTest
- public void testPrepare() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "prepare()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderResetStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderResetStateUnitTest.java
deleted file mode 100644
index cae9e31..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderResetStateUnitTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaRecorder;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.Suppress;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaRecorder.reset() method can be called.
- */
-public class MediaRecorderResetStateUnitTest extends AndroidTestCase implements MediaRecorderMethodUnderTest {
- private MediaRecorderStateUnitTestTemplate mTestTemplate = new MediaRecorderStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call reset() in the following states:
- * {Prepared, Initial, Initialized, DataSourceConfigured, Recording, Error}.
- * 2. It is invalid to call reset() in the following states:
- * {}
- *
- * @param stateErrors the MediaRecorderStateErrors to check against.
- */
- public void checkStateErrors(MediaRecorderStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInRecordingState);
- assertTrue(!stateErrors.errorInInitialState);
- assertTrue(!stateErrors.errorInInitialStateAfterReset);
- assertTrue(!stateErrors.errorInInitialStateAfterStop);
- assertTrue(!stateErrors.errorInInitializedState);
- assertTrue(!stateErrors.errorInErrorState);
- assertTrue(!stateErrors.errorInDataSourceConfiguredState);
-
- // Invalid states.
- }
-
- public void invokeMethodUnderTest(MediaRecorder recorder) {
- recorder.reset();
- }
-
- @MediumTest
- public void testReset() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "reset()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetAudioEncoderStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetAudioEncoderStateUnitTest.java
deleted file mode 100644
index 4b5a818..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetAudioEncoderStateUnitTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaRecorder;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.Suppress;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaRecorder.setAudioEncoder() method can be called.
- */
-public class MediaRecorderSetAudioEncoderStateUnitTest extends AndroidTestCase implements MediaRecorderMethodUnderTest {
- private MediaRecorderStateUnitTestTemplate mTestTemplate = new MediaRecorderStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call setAudioEncoder() in the following states:
- * {DataSourceConfigured}.
- * 2. It is invalid to call setAudioEncoder() in the following states:
- * {Initial, Initialized, Prepared, Recording, Error}
- *
- * @param stateErrors the MediaRecorderStateErrors to check against.
- */
- public void checkStateErrors(MediaRecorderStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInDataSourceConfiguredState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInPreparedState);
- assertTrue(stateErrors.errorInRecordingState);
- assertTrue(stateErrors.errorInErrorState);
- assertTrue(stateErrors.errorInInitialState);
- assertTrue(stateErrors.errorInInitialStateAfterReset);
- assertTrue(stateErrors.errorInInitialStateAfterStop);
- assertTrue(stateErrors.errorInInitializedState);
- }
-
- public void invokeMethodUnderTest(MediaRecorder recorder) {
- recorder.setAudioEncoder(MediaRecorderStateUnitTestTemplate.AUDIO_ENCODER);
- }
-
- @MediumTest
- public void testSetAudioEncoder() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "setAudioEncoder()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetAudioSourceStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetAudioSourceStateUnitTest.java
deleted file mode 100644
index f8ab48cf..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetAudioSourceStateUnitTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaRecorder;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.Suppress;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaRecorder.setAudioSource() method can be called.
- */
-public class MediaRecorderSetAudioSourceStateUnitTest extends AndroidTestCase implements MediaRecorderMethodUnderTest {
- private MediaRecorderStateUnitTestTemplate mTestTemplate = new MediaRecorderStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call setAudioSource() in the following states:
- * {Initial, Initialized}.
- * 2. It is invalid to call setAudioSource() in the following states:
- * {Prepared, DataSourceConfigured, Recording, Error}
- *
- * @param stateErrors the MediaRecorderStateErrors to check against.
- */
- public void checkStateErrors(MediaRecorderStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInInitialState);
- assertTrue(!stateErrors.errorInInitialStateAfterReset);
- assertTrue(!stateErrors.errorInInitialStateAfterStop);
- assertTrue(!stateErrors.errorInInitializedState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInPreparedState);
- assertTrue(stateErrors.errorInRecordingState);
- assertTrue(stateErrors.errorInDataSourceConfiguredState);
- assertTrue(stateErrors.errorInErrorState);
- }
-
- public void invokeMethodUnderTest(MediaRecorder recorder) {
- recorder.setAudioSource(MediaRecorderStateUnitTestTemplate.AUDIO_SOURCE);
- }
-
- @MediumTest
- public void testSetAudioSource() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "setAudioSource()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetOutputFileStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetOutputFileStateUnitTest.java
deleted file mode 100644
index 712a758..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetOutputFileStateUnitTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaRecorder;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.Suppress;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaRecorder.setOutputFile() method can be called.
- */
-public class MediaRecorderSetOutputFileStateUnitTest extends AndroidTestCase implements MediaRecorderMethodUnderTest {
- private MediaRecorderStateUnitTestTemplate mTestTemplate = new MediaRecorderStateUnitTestTemplate();
- /**
- * 1. It is valid to call setOutputFile() in the following states:
- * {DataSourceConfigured, Initial, Initialized, Prepared, Recording, Error}.
- * 2. It is invalid to call setOutputFile() in the following states:
- * {}
- *
- * @param stateErrors the MediaRecorderStateErrors to check against.
- */
- public void checkStateErrors(MediaRecorderStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInDataSourceConfiguredState);
- assertTrue(!stateErrors.errorInPreparedState);
- assertTrue(!stateErrors.errorInRecordingState);
- assertTrue(!stateErrors.errorInErrorState);
- assertTrue(!stateErrors.errorInInitialState);
- assertTrue(!stateErrors.errorInInitialStateAfterReset);
- assertTrue(!stateErrors.errorInInitialStateAfterStop);
- assertTrue(!stateErrors.errorInInitializedState);
- }
-
- public void invokeMethodUnderTest(MediaRecorder recorder) {
- recorder.setOutputFile(MediaRecorderStateUnitTestTemplate.RECORD_OUTPUT_PATH);
- }
-
- @MediumTest
- public void testSetOutputFile() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "setOutputFile()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetOutputFormatStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetOutputFormatStateUnitTest.java
deleted file mode 100644
index cacdd87..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderSetOutputFormatStateUnitTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaRecorder;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.Suppress;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaRecorder.setOutputFormat() method can be called.
- */
-public class MediaRecorderSetOutputFormatStateUnitTest extends AndroidTestCase implements MediaRecorderMethodUnderTest {
- private MediaRecorderStateUnitTestTemplate mTestTemplate = new MediaRecorderStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call setOutputFormat() in the following states:
- * {Initialized}.
- * 2. It is invalid to call setOutputFormat() in the following states:
- * {Initial, Prepared, DataSourceConfigured, Recording, Error}
- *
- * @param stateErrors the MediaRecorderStateErrors to check against.
- */
- public void checkStateErrors(MediaRecorderStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInInitializedState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInInitialState);
- assertTrue(stateErrors.errorInInitialStateAfterReset);
- assertTrue(stateErrors.errorInInitialStateAfterStop);
- assertTrue(stateErrors.errorInPreparedState);
- assertTrue(stateErrors.errorInRecordingState);
- assertTrue(stateErrors.errorInErrorState);
- assertTrue(stateErrors.errorInDataSourceConfiguredState);
- }
-
- public void invokeMethodUnderTest(MediaRecorder recorder) {
- recorder.setOutputFormat(MediaRecorderStateUnitTestTemplate.OUTPUT_FORMAT);
- }
-
- @MediumTest
- public void testSetOutputFormat() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "setOutputFormat()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStartStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStartStateUnitTest.java
deleted file mode 100644
index d1232fc..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStartStateUnitTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaRecorder;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.Suppress;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaRecorder.start() method can be called.
- */
-public class MediaRecorderStartStateUnitTest extends AndroidTestCase implements MediaRecorderMethodUnderTest {
- private MediaRecorderStateUnitTestTemplate mTestTemplate = new MediaRecorderStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call start() in the following states:
- * {Prepared}.
- * 2. It is invalid to call start() in the following states:
- * {Initial, Initialized, DataSourceConfigured, Recording, Error}
- *
- * @param stateErrors the MediaRecorderStateErrors to check against.
- */
- public void checkStateErrors(MediaRecorderStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInPreparedState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInRecordingState);
- assertTrue(stateErrors.errorInInitialState);
- assertTrue(stateErrors.errorInInitialStateAfterReset);
- assertTrue(stateErrors.errorInInitialStateAfterStop);
- assertTrue(stateErrors.errorInInitializedState);
- assertTrue(stateErrors.errorInErrorState);
- assertTrue(stateErrors.errorInDataSourceConfiguredState);
- }
-
- public void invokeMethodUnderTest(MediaRecorder recorder) {
- recorder.start();
- }
-
- @MediumTest
- public void testStart() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "start()";
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStateErrors.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStateErrors.java
deleted file mode 100644
index 2d6e5a2..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStateErrors.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-class MediaRecorderStateErrors {
- public static enum MediaRecorderState {
- INITIAL,
- INITIAL_AFTER_RESET,
- INITIAL_AFTER_STOP,
- INITIALIZED,
- DATASOURCECONFIGURED,
- PREPARED,
- RECORDING,
- ERROR,
- }
-
- // Error occurs in the states below?
- public boolean errorInInitialState = false;
- public boolean errorInInitialStateAfterReset = false;
- public boolean errorInInitialStateAfterStop = false;
- public boolean errorInInitializedState = false;
- public boolean errorInDataSourceConfiguredState = false;
- public boolean errorInPreparedState = false;
- public boolean errorInRecordingState = false;
- public boolean errorInErrorState = false;
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStateUnitTestTemplate.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStateUnitTestTemplate.java
deleted file mode 100644
index 9edc9aa..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStateUnitTestTemplate.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.util.Log;
-import android.media.MediaRecorder;
-import android.test.AndroidTestCase;
-
-/**
- * A template class for running a method under test in all possible
- * states of a MediaRecorder object.
- *
- * @see com.android.mediaframeworktest.unit.MediaRecorderStopStateUnitTest
- * for an example of using this class.
- *
- * A typical concrete unit test class would implement the
- * MediaRecorderMethodUnderTest interface and have a reference to an object of
- * this class. Then it calls runTestOnMethod() to actually perform the unit
- * tests. It is recommended that the toString() method of the concrete unit test
- * class be overridden to use the actual method name under test for logging
- * purpose.
- *
- */
-class MediaRecorderStateUnitTestTemplate extends AndroidTestCase {
- public static final String RECORD_OUTPUT_PATH = "/sdcard/recording.3gp";
- public static final int OUTPUT_FORMAT= MediaRecorder.OutputFormat.THREE_GPP;
- public static final int AUDIO_ENCODER = MediaRecorder.AudioEncoder.AMR_NB;
- public static final int AUDIO_SOURCE = MediaRecorder.AudioSource.MIC;
- private static final String TAG = "MediaRecorderStateUnitTest";
- private MediaRecorderStateErrors mStateErrors = new MediaRecorderStateErrors();
- private MediaRecorder mMediaRecorder = new MediaRecorder();
- private MediaRecorderStateErrors.MediaRecorderState mMediaRecorderState = null;
- private MediaRecorderMethodUnderTest mMethodUnderTest = null;
-
- /**
- * Runs the given method under test in all possible states of a MediaRecorder
- * object.
- *
- * @param testMethod the method under test.
- */
- public void runTestOnMethod(MediaRecorderMethodUnderTest testMethod) {
- mMethodUnderTest = testMethod;
- if (mMethodUnderTest != null) { // Method under test has been set?
- checkMethodUnderTestInAllPossibleStates();
- mMethodUnderTest.checkStateErrors(mStateErrors);
- cleanUp();
- }
- }
-
- /*
- * Calls method under test in the given state of the MediaRecorder object.
- *
- * @param state the MediaRecorder state in which the method under test is called.
- */
- private void callMediaRecorderMethodUnderTestInState(MediaRecorderStateErrors.MediaRecorderState state) {
- Log.v(TAG, "call " + mMethodUnderTest + ": started in state " + state);
- setMediaRecorderToState(state);
- try {
- mMethodUnderTest.invokeMethodUnderTest(mMediaRecorder);
- } catch(Exception e) {
- setStateError(mMediaRecorderState, true);
- }
- Log.v(TAG, "call " + mMethodUnderTest + ": ended in state " + state);
- }
-
- /*
- * The following setMediaRecorderToXXXStateXXX methods sets the MediaRecorder
- * object to the corresponding state, given the assumption that reset()
- * always resets the MediaRecorder object to Initial (after reset) state.
- */
- private void setMediaRecorderToInitialStateAfterReset() {
- try {
- mMediaRecorder.reset();
- } catch(Exception e) {
- fail("setMediaRecorderToInitialStateAfterReset: Exception " + e.getClass().getName() + " was thrown.");
- }
- }
-
- // FIXME:
- // In the past, stop() == reset().
- // However, this is no longer true. The plan is to have a STOPPED state.
- // and from STOPPED state, start can be called without the need to
- // do the recording configuration again.
- private void setMediaRecorderToInitialStateAfterStop() {
- try {
- mMediaRecorder.reset();
-/*
- mMediaRecorder.setAudioSource(AUDIO_SOURCE);
- mMediaRecorder.setOutputFormat(OUTPUT_FORMAT);
- mMediaRecorder.setAudioEncoder(AUDIO_ENCODER);
- mMediaRecorder.setOutputFile(RECORD_OUTPUT_PATH);
- mMediaRecorder.prepare();
- mMediaRecorder.start();
- mMediaRecorder.stop();
-*/
- } catch(Exception e) {
- fail("setMediaRecorderToInitialStateAfterReset: Exception " + e.getClass().getName() + " was thrown.");
- }
- }
-
- private void setMediaRecorderToInitializedState() {
- try {
- mMediaRecorder.reset();
- if (mMethodUnderTest.toString() != "setAudioSource()") {
- mMediaRecorder.setAudioSource(AUDIO_SOURCE);
- }
- } catch(Exception e) {
- fail("setMediaRecorderToInitializedState: Exception " + e.getClass().getName() + " was thrown.");
- }
- }
-
- private void setMediaRecorderToPreparedState() {
- try {
- mMediaRecorder.reset();
- mMediaRecorder.setAudioSource(AUDIO_SOURCE);
- mMediaRecorder.setOutputFormat(OUTPUT_FORMAT);
- mMediaRecorder.setAudioEncoder(AUDIO_ENCODER);
- mMediaRecorder.setOutputFile(RECORD_OUTPUT_PATH);
- mMediaRecorder.prepare();
- } catch(Exception e) {
- fail("setMediaRecorderToPreparedState: Exception " + e.getClass().getName() + " was thrown.");
- }
- }
-
- private void setMediaRecorderToRecordingState() {
- try {
- mMediaRecorder.reset();
- mMediaRecorder.setAudioSource(AUDIO_SOURCE);
- mMediaRecorder.setOutputFormat(OUTPUT_FORMAT);
- mMediaRecorder.setAudioEncoder(AUDIO_ENCODER);
- mMediaRecorder.setOutputFile(RECORD_OUTPUT_PATH);
- mMediaRecorder.prepare();
- mMediaRecorder.start();
- } catch(Exception e) {
- fail("setMediaRecorderToRecordingState: Exception " + e.getClass().getName() + " was thrown.");
- }
- }
-
- private void setMediaRecorderToDataSourceConfiguredState() {
- try {
- mMediaRecorder.reset();
- mMediaRecorder.setAudioSource(AUDIO_SOURCE);
- mMediaRecorder.setOutputFormat(OUTPUT_FORMAT);
-
- /* Skip setAudioEncoder() and setOutputFile() calls if
- * the method under test is setAudioEncoder() since this
- * method can only be called once even in the DATASOURCECONFIGURED state
- */
- if (mMethodUnderTest.toString() != "setAudioEncoder()") {
- mMediaRecorder.setAudioEncoder(AUDIO_ENCODER);
- }
-
- if (mMethodUnderTest.toString() != "setOutputFile()") {
- mMediaRecorder.setOutputFile(RECORD_OUTPUT_PATH);
- }
- } catch(Exception e) {
- fail("setMediaRecorderToDataSourceConfiguredState: Exception " + e.getClass().getName() + " was thrown.");
- }
- }
-
- /*
- * There are a lot of ways to force the MediaRecorder object to enter
- * the Error state. We arbitrary choose one here.
- */
- private void setMediaRecorderToErrorState() {
- try {
- mMediaRecorder.reset();
-
- /* Skip setAudioSource() if the method under test is setAudioEncoder()
- * Because, otherwise, it is valid to call setAudioEncoder() after
- * start() since start() will fail, and then the mMediaRecorder
- * won't be set to the Error state
- */
- if (mMethodUnderTest.toString() != "setAudioEncoder()") {
- mMediaRecorder.setAudioSource(AUDIO_SOURCE);
- }
-
- /* Skip setOutputFormat if the method under test is setOutputFile()
- * Because, otherwise, it is valid to call setOutputFile() after
- * start() since start() will fail, and then the mMediaRecorder
- * won't be set to the Error state
- */
- if (mMethodUnderTest.toString() != "setOutputFile()") {
- mMediaRecorder.setOutputFormat(OUTPUT_FORMAT);
- }
-
- mMediaRecorder.start();
- } catch(Exception e) {
- if (!(e instanceof IllegalStateException)) {
- fail("setMediaRecorderToErrorState: Exception " + e.getClass().getName() + " was thrown.");
- }
- }
- Log.v(TAG, "setMediaRecorderToErrorState: done.");
- }
-
- /*
- * Sets the state of the MediaRecorder object to the specified one.
- *
- * @param state the state of the MediaRecorder object.
- */
- private void setMediaRecorderToState(MediaRecorderStateErrors.MediaRecorderState state) {
- mMediaRecorderState = state;
- switch(state) {
- case INITIAL:
- // Does nothing.
- break;
- case INITIAL_AFTER_RESET:
- setMediaRecorderToInitialStateAfterReset();
- break;
- case INITIAL_AFTER_STOP:
- setMediaRecorderToInitialStateAfterStop();
- break;
- case INITIALIZED:
- setMediaRecorderToInitializedState();
- break;
- case DATASOURCECONFIGURED:
- setMediaRecorderToDataSourceConfiguredState();
- break;
- case PREPARED:
- setMediaRecorderToPreparedState();
- break;
- case RECORDING:
- setMediaRecorderToRecordingState();
- break;
- case ERROR:
- setMediaRecorderToErrorState();
- break;
- }
- }
-
- /*
- * Sets the error value of the corresponding state to the given error.
- *
- * @param state the state of the MediaRecorder object.
- * @param error the value of the state error to be set.
- */
- private void setStateError(MediaRecorderStateErrors.MediaRecorderState state, boolean error) {
- switch(state) {
- case INITIAL:
- mStateErrors.errorInInitialState = error;
- break;
- case INITIAL_AFTER_RESET:
- mStateErrors.errorInInitialStateAfterReset = error;
- break;
- case INITIAL_AFTER_STOP:
- mStateErrors.errorInInitialStateAfterStop = error;
- break;
- case INITIALIZED:
- mStateErrors.errorInInitializedState = error;
- break;
- case DATASOURCECONFIGURED:
- mStateErrors.errorInDataSourceConfiguredState = error;
- break;
- case PREPARED:
- mStateErrors.errorInPreparedState = error;
- break;
- case RECORDING:
- mStateErrors.errorInRecordingState = error;
- break;
- case ERROR:
- mStateErrors.errorInErrorState = error;
- break;
- }
- }
-
- private void checkInitialState() {
- callMediaRecorderMethodUnderTestInState(MediaRecorderStateErrors.MediaRecorderState.INITIAL);
- }
-
- private void checkInitialStateAfterReset() {
- callMediaRecorderMethodUnderTestInState(MediaRecorderStateErrors.MediaRecorderState.INITIAL_AFTER_RESET);
- }
-
- private void checkInitialStateAfterStop() {
- callMediaRecorderMethodUnderTestInState(MediaRecorderStateErrors.MediaRecorderState.INITIAL_AFTER_STOP);
- }
-
- private void checkInitializedState() {
- callMediaRecorderMethodUnderTestInState(MediaRecorderStateErrors.MediaRecorderState.INITIALIZED);
- }
-
- private void checkPreparedState() {
- callMediaRecorderMethodUnderTestInState(MediaRecorderStateErrors.MediaRecorderState.PREPARED);
- }
-
- private void checkRecordingState() {
- callMediaRecorderMethodUnderTestInState(MediaRecorderStateErrors.MediaRecorderState.RECORDING);
- }
-
- private void checkDataSourceConfiguredState() {
- callMediaRecorderMethodUnderTestInState(MediaRecorderStateErrors.MediaRecorderState.DATASOURCECONFIGURED);
- }
-
- private void checkErrorState() {
- callMediaRecorderMethodUnderTestInState(MediaRecorderStateErrors.MediaRecorderState.ERROR);
- }
-
- /*
- * Checks the given method under test in all possible states of the MediaRecorder object.
- */
- private void checkMethodUnderTestInAllPossibleStates() {
- // Must be called first.
- checkInitialState();
-
- // The sequence of the following method calls should not
- // affect the test results.
- checkErrorState();
- checkInitialStateAfterReset();
- checkInitialStateAfterStop();
- checkInitializedState();
- checkRecordingState();
- checkDataSourceConfiguredState();
- checkPreparedState();
- }
-
- /*
- * Cleans up all the internal object references.
- */
- private void cleanUp() {
- mMediaRecorder.release();
- mMediaRecorder = null;
- mMediaRecorderState = null;
- mStateErrors = null;
- mMethodUnderTest = null;
- }
-}
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStopStateUnitTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStopStateUnitTest.java
deleted file mode 100644
index 8737595..0000000
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaRecorderStopStateUnitTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.mediaframeworktest.unit;
-
-import android.media.MediaRecorder;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.Suppress;
-
-/**
- * Unit test class to test the set of valid and invalid states that
- * MediaRecorder.stop() method can be called.
- */
-public class MediaRecorderStopStateUnitTest extends AndroidTestCase implements MediaRecorderMethodUnderTest {
- private MediaRecorderStateUnitTestTemplate mTestTemplate = new MediaRecorderStateUnitTestTemplate();
-
- /**
- * 1. It is valid to call stop() in the following states:
- * {Recording}.
- * 2. It is invalid to call stop() in the following states:
- * {Initial, Initialized, DataSourceConfigured, Prepared, Error}
- *
- * @param stateErrors the MediaRecorderStateErrors to check against.
- */
- public void checkStateErrors(MediaRecorderStateErrors stateErrors) {
- // Valid states.
- assertTrue(!stateErrors.errorInRecordingState);
-
- // Invalid states.
- assertTrue(stateErrors.errorInInitialState);
- assertTrue(stateErrors.errorInInitialStateAfterReset);
- assertTrue(stateErrors.errorInInitialStateAfterStop);
- assertTrue(stateErrors.errorInInitializedState);
- assertTrue(stateErrors.errorInErrorState);
- assertTrue(stateErrors.errorInDataSourceConfiguredState);
- assertTrue(stateErrors.errorInPreparedState);
- }
-
- public void invokeMethodUnderTest(MediaRecorder recorder) {
- recorder.stop();
- }
-
- @MediumTest
- public void testStop() {
- mTestTemplate.runTestOnMethod(this);
- }
-
- @Override
- public String toString() {
- return "stop()";
- }
-}