diff options
author | Yu Shan Emily Lau <yslau@google.com> | 2012-04-26 17:29:15 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-04-26 17:29:15 -0700 |
commit | f18222da3cdfd3b052361369b70a4d22396039c1 (patch) | |
tree | 169f8a2bc268e723018d911e6218cae936c4dfe2 | |
parent | ccdf0afbd7dbd4fe2111e94d9e4f14a939ed8882 (diff) | |
parent | e35b3e052dab756113304cb394980e9f271b1613 (diff) | |
download | frameworks_base-f18222da3cdfd3b052361369b70a4d22396039c1.zip frameworks_base-f18222da3cdfd3b052361369b70a4d22396039c1.tar.gz frameworks_base-f18222da3cdfd3b052361369b70a4d22396039c1.tar.bz2 |
Merge "Fix the test cases which fail to launch the camera in the device which only has one camera." into jb-dev
5 files changed, 14 insertions, 7 deletions
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java index bbd6bea..2f864d7 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java @@ -47,6 +47,7 @@ public class CameraTest extends ActivityInstrumentationTestCase<MediaFrameworkTe private boolean jpegPictureCallbackResult = false; private static int WAIT_FOR_COMMAND_TO_COMPLETE = 10000; // Milliseconds. + private static final int CAMERA_ID = 0; private RawPreviewCallback mRawPreviewCallback = new RawPreviewCallback(); private TestShutterCallback mShutterCallback = new TestShutterCallback(); @@ -85,7 +86,7 @@ public class CameraTest extends ActivityInstrumentationTestCase<MediaFrameworkTe // Save the looper so that we can terminate this thread // after we are done with it. mLooper = Looper.myLooper(); - mCamera = Camera.open(); + mCamera = Camera.open(CAMERA_ID); startDone.open(); Looper.loop(); // Blocks forever until Looper.quit() is called. Log.v(TAG, "initializeMessageLooper: quit."); diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java index 0684946..8e6d5cb 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java @@ -54,6 +54,8 @@ public class MediaRecorderTest extends ActivityInstrumentationTestCase2<MediaFra private int MIN_VIDEO_FPS = 5; + private static final int CAMERA_ID = 0; + Context mContext; Camera mCamera; @@ -247,7 +249,7 @@ public class MediaRecorderTest extends ActivityInstrumentationTestCase2<MediaFra public void testPortraitH263() throws Exception { boolean videoRecordedResult = false; try { - mCamera = Camera.open(); + mCamera = Camera.open(CAMERA_ID); Camera.Parameters parameters = mCamera.getParameters(); parameters.setPreviewSize(352, 288); parameters.set("orientation", "portrait"); diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java index db64b94..ccb0638 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java @@ -72,6 +72,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med "/sdcard/mediaMemOutput.txt"; private static final String MEDIA_PROCMEM_OUTPUT = "/sdcard/mediaProcmemOutput.txt"; + private static final int CAMERA_ID = 0; private static int mStartMemory = 0; private static int mEndMemory = 0; @@ -132,7 +133,7 @@ public class MediaPlayerPerformance extends ActivityInstrumentationTestCase2<Med Looper.prepare(); Log.v(TAG, "start loopRun"); mLooper = Looper.myLooper(); - mCamera = Camera.open(); + mCamera = Camera.open(CAMERA_ID); startDone.open(); Looper.loop(); Log.v(TAG, "initializeMessageLooper: quit."); diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/CameraStressTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/CameraStressTest.java index a9c6119..ab9e36c 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/CameraStressTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/CameraStressTest.java @@ -60,6 +60,7 @@ public class CameraStressTest extends ActivityInstrumentationTestCase2<MediaFram private static final long WAIT_ZOOM_ANIMATION = 5 * 1000; // 5 seconds private static final String CAMERA_STRESS_OUTPUT = "/sdcard/cameraStressOutput.txt"; + private static final int CAMERA_ID = 0; private final CameraErrorCallback mCameraErrorCallback = new CameraErrorCallback(); private Thread mLooperThread; @@ -213,7 +214,7 @@ public class CameraStressTest extends ActivityInstrumentationTestCase2<MediaFram Log.v(TAG, "Start preview"); output.write("No of loop: "); - mCamera = Camera.open(); + mCamera = Camera.open(CAMERA_ID); Camera.Parameters params = mCamera.getParameters(); mCamera.release(); @@ -230,7 +231,7 @@ public class CameraStressTest extends ActivityInstrumentationTestCase2<MediaFram runOnLooper(new Runnable() { @Override public void run() { - mCamera = Camera.open(); + mCamera = Camera.open(CAMERA_ID); } }); diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java index e9bc6f0..62462bd 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/stress/MediaRecorderStressTest.java @@ -60,6 +60,8 @@ public class MediaRecorderStressTest extends ActivityInstrumentationTestCase2<Me private static final String OUTPUT_FILE_EXT = ".3gp"; private static final String MEDIA_STRESS_OUTPUT = "/sdcard/mediaStressOutput.txt"; + private static final int CAMERA_ID = 0; + private final CameraErrorCallback mCameraErrorCallback = new CameraErrorCallback(); private final RecorderErrorCallback mRecorderErrorCallback = new RecorderErrorCallback(); @@ -162,7 +164,7 @@ public class MediaRecorderStressTest extends ActivityInstrumentationTestCase2<Me runOnLooper(new Runnable() { @Override public void run() { - mCamera = Camera.open(); + mCamera = Camera.open(CAMERA_ID); } }); mCamera.setErrorCallback(mCameraErrorCallback); @@ -250,7 +252,7 @@ public class MediaRecorderStressTest extends ActivityInstrumentationTestCase2<Me runOnLooper(new Runnable() { @Override public void run() { - mCamera = Camera.open(); + mCamera = Camera.open(CAMERA_ID); } }); mCamera.setErrorCallback(mCameraErrorCallback); |