Fix the test cases which fail to launch the camera

in the device which only has one camera.

Change-Id: Ia34087715e49f1aa3e86f3f85cb4e77168323321
This commit is contained in:
Yu Shan Emily Lau
2012-04-26 17:10:29 -07:00
parent 9b593a67f1
commit e35b3e052d
5 changed files with 14 additions and 7 deletions

View File

@@ -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.");

View File

@@ -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");

View File

@@ -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.");

View File

@@ -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);
}
});

View File

@@ -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);