FileDocCategorySizeDatePackage
ImageCapture.javaAPI DocAndroid 1.5 API3397Wed May 06 22:42:42 BST 2009com.android.camera.tests.stress

ImageCapture

public class ImageCapture extends android.test.ActivityInstrumentationTestCase2
Junit / Instrumentation test case for camera test

Fields Summary
private String
TAG
private static final int
TOTAL_NUMBER_OF_IMAGECAPTURE
private static final int
TOTAL_NUMBER_OF_VIDEOCAPTURE
private static final long
WAIT_FOR_IMAGE_CAPTURE_TO_BE_TAKEN
private static final long
WAIT_FOR_VIDEO_CAPTURE_TO_BE_TAKEN
private static final long
WAIT_FOR_PREVIEW
Constructors Summary
public ImageCapture()

 //1 seconds

      
        super("com.android.camera", Camera.class);       
    
Methods Summary
protected voidsetUp()

  
        getActivity();
        super.setUp();     
    
protected voidtearDown()

     
        super.tearDown();              
    
public voidtestImageCapture()

        Instrumentation inst = getInstrumentation();
        try {
            for (int i = 0; i < TOTAL_NUMBER_OF_IMAGECAPTURE; i++) {
                Thread.sleep(WAIT_FOR_IMAGE_CAPTURE_TO_BE_TAKEN);
                inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_UP);
                inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
                Thread.sleep(WAIT_FOR_IMAGE_CAPTURE_TO_BE_TAKEN);
            }
        } catch (Exception e) {
            Log.v(TAG, e.toString());
        }
            assertTrue("testImageCapture", true);
    
public voidtestVideoCapture()

        Instrumentation inst = getInstrumentation();
        //Switch to the video mode
        inst.sendKeyDownUpSync(KeyEvent.KEYCODE_MENU);
        inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
        try {
            for (int i = 0; i < TOTAL_NUMBER_OF_VIDEOCAPTURE; i++) {
                Thread.sleep(WAIT_FOR_PREVIEW);
                inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_UP);
                //record an video
                inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
                Thread.sleep(WAIT_FOR_VIDEO_CAPTURE_TO_BE_TAKEN);
                inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
                Thread.sleep(WAIT_FOR_PREVIEW);
                inst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
            }
        } catch (Exception e) {
            Log.v(TAG, e.toString());
        }
            assertTrue("testVideoCapture", true);