Search in sources :

Example 96 with Instrumentation

use of android.app.Instrumentation in project android_packages_apps_Camera by CyanogenMod.

the class ImageCapture method testFrontImageCapture.

@LargeTest
public void testFrontImageCapture() throws Exception {
    Instrumentation inst = getInstrumentation();
    Intent intent = new Intent();
    intent.setClass(getInstrumentation().getTargetContext(), CameraActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra(EXTRAS_CAMERA_FACING, android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT);
    Activity act = inst.startActivitySync(intent);
    Thread.sleep(WAIT_FOR_SWITCH_CAMERA);
    captureImages("Front Camera Image Capture\n", inst);
    act.finish();
}
Also used : Instrumentation(android.app.Instrumentation) CameraActivity(com.android.camera.CameraActivity) Activity(android.app.Activity) Intent(android.content.Intent) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 97 with Instrumentation

use of android.app.Instrumentation in project android_packages_apps_Camera by CyanogenMod.

the class VideoCapture method testBackVideoCapture.

@LargeTest
public void testBackVideoCapture() throws Exception {
    Instrumentation inst = getInstrumentation();
    Intent intent = new Intent(MediaStore.INTENT_ACTION_VIDEO_CAMERA);
    intent.setClass(getInstrumentation().getTargetContext(), CameraActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra(EXTRAS_CAMERA_FACING, android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK);
    Activity act = inst.startActivitySync(intent);
    Thread.sleep(WAIT_FOR_SWITCH_CAMERA);
    captureVideos("Back Camera Video Capture\n", inst);
    act.finish();
}
Also used : Instrumentation(android.app.Instrumentation) CameraActivity(com.android.camera.CameraActivity) Activity(android.app.Activity) Intent(android.content.Intent) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 98 with Instrumentation

use of android.app.Instrumentation in project android_packages_apps_Camera by CyanogenMod.

the class VideoCapture method testFrontVideoCapture.

@LargeTest
public void testFrontVideoCapture() throws Exception {
    Instrumentation inst = getInstrumentation();
    Intent intent = new Intent(MediaStore.INTENT_ACTION_VIDEO_CAMERA);
    intent.setClass(getInstrumentation().getTargetContext(), CameraActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra(EXTRAS_CAMERA_FACING, android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT);
    Activity act = inst.startActivitySync(intent);
    Thread.sleep(WAIT_FOR_SWITCH_CAMERA);
    captureVideos("Front Camera Video Capture\n", inst);
    act.finish();
}
Also used : Instrumentation(android.app.Instrumentation) CameraActivity(com.android.camera.CameraActivity) Activity(android.app.Activity) Intent(android.content.Intent) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 99 with Instrumentation

use of android.app.Instrumentation in project appium-espresso-driver by appium.

the class CreateSession method startActivity.

private void startActivity(String appActivity) {
    System.out.println("Starting activity '" + appActivity + "'");
    Instrumentation mInstrumentation = InstrumentationRegistry.getInstrumentation();
    ActivityMonitor mSessionMonitor = mInstrumentation.addMonitor(appActivity, null, false);
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setClassName(mInstrumentation.getTargetContext(), appActivity);
    mInstrumentation.startActivitySync(intent);
    Activity mCurrentActivity = mInstrumentation.waitForMonitor(mSessionMonitor);
    System.out.println("Activity '" + mCurrentActivity.getLocalClassName() + "' started");
}
Also used : ActivityMonitor(android.app.Instrumentation.ActivityMonitor) Instrumentation(android.app.Instrumentation) Activity(android.app.Activity) Intent(android.content.Intent)

Example 100 with Instrumentation

use of android.app.Instrumentation in project android_frameworks_base by crdroidandroid.

the class ListManagedCursorTest method testKeyScrolling.

/**
     * Scroll the list using arrows, launch new activity, hit back, make sure we're still scrolled.
     */
@LargeTest
public void testKeyScrolling() {
    Instrumentation inst = getInstrumentation();
    int firstVisiblePosition = arrowScroll(inst);
    inst.sendCharacterSync(KeyEvent.KEYCODE_BACK);
    inst.waitForIdleSync();
    assertTrue("List changed to touch mode", !mListView.isInTouchMode());
    assertTrue("List did not preserve scroll position", firstVisiblePosition == mListView.getFirstVisiblePosition());
}
Also used : Instrumentation(android.app.Instrumentation) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Aggregations

Instrumentation (android.app.Instrumentation)225 LargeTest (android.test.suitebuilder.annotation.LargeTest)59 FlakyTest (android.test.FlakyTest)49 Intent (android.content.Intent)37 KeyEvent (android.view.KeyEvent)30 MotionEvent (android.view.MotionEvent)27 Point (android.graphics.Point)25 MediumTest (android.test.suitebuilder.annotation.MediumTest)18 Activity (android.app.Activity)14 Field (java.lang.reflect.Field)10 CameraActivity (com.android.camera.CameraActivity)8 Uri (android.net.Uri)7 File (java.io.File)7 Handler (android.os.Handler)6 KeyCharacterMap (android.view.KeyCharacterMap)6 Button (android.widget.Button)6 ListView (android.widget.ListView)6 Message (android.os.Message)5 MessageQueue (android.os.MessageQueue)4 EditText (android.widget.EditText)4