Search in sources :

Example 16 with ActivityResult

use of android.app.Instrumentation.ActivityResult in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class FingerprintEnrollFinishTest method clickAddAnother_shouldPropagateResults.

@Test
public void clickAddAnother_shouldPropagateResults() {
    final ComponentName enrollingComponent = new ComponentName(getTargetContext(), FingerprintEnrollEnrolling.class);
    intending(hasComponent(enrollingComponent)).respondWith(new ActivityResult(Activity.RESULT_OK, null));
    PartnerCustomizationLayout layout = mActivityRule.getActivity().findViewById(R.id.setup_wizard_layout);
    layout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
    intended(hasComponent(enrollingComponent));
    assertTrue(mActivityRule.getActivity().isFinishing());
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) ComponentName(android.content.ComponentName) ActivityResult(android.app.Instrumentation.ActivityResult) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 17 with ActivityResult

use of android.app.Instrumentation.ActivityResult in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class FingerprintEnrollFinishTest method clickAddAnother_shouldLaunchEnrolling.

@Test
public void clickAddAnother_shouldLaunchEnrolling() {
    final ComponentName enrollingComponent = new ComponentName(getTargetContext(), FingerprintEnrollEnrolling.class);
    intending(hasComponent(enrollingComponent)).respondWith(new ActivityResult(Activity.RESULT_CANCELED, null));
    PartnerCustomizationLayout layout = mActivityRule.getActivity().findViewById(R.id.setup_wizard_layout);
    layout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
    intended(hasComponent(enrollingComponent));
    assertFalse(mActivityRule.getActivity().isFinishing());
}
Also used : PartnerCustomizationLayout(com.google.android.setupcompat.PartnerCustomizationLayout) ComponentName(android.content.ComponentName) ActivityResult(android.app.Instrumentation.ActivityResult) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 18 with ActivityResult

use of android.app.Instrumentation.ActivityResult in project GT by Tencent.

the class ActivityHookList method execStartActivity.

/**
 * Activity 的开始+生命周期: *
 */
@HookAnnotation(className = "android.app.Instrumentation", methodName = "execStartActivity", methodSig = "(Landroid/content/Context;" + "Landroid/os/IBinder;" + "Landroid/os/IBinder;" + "Landroid/app/Activity;" + "Landroid/content/Intent;" + "ILandroid/os/Bundle;)" + "Landroid/app/Instrumentation$ActivityResult;")
public static ActivityResult execStartActivity(Object thiz, Context who, IBinder contextThread, IBinder token, Activity target, Intent intent, int requestCode, Bundle options) {
    GTRLog.e(TAG, "Instrumentation.execStartActivity");
    long start = System.currentTimeMillis();
    Instrumentation.ActivityResult activityResult = execStartActivity_backup(thiz, who, contextThread, token, target, intent, requestCode, options);
    long end = System.currentTimeMillis();
    GTRClient.pushData(new StringBuilder().append("Instrumentation.execStartActivity").append(GTConfig.separator).append(start).append(GTConfig.separator).append(end).toString());
    return activityResult;
}
Also used : ActivityResult(android.app.Instrumentation.ActivityResult) Instrumentation(android.app.Instrumentation) HookAnnotation(com.kunpeng.pit.HookAnnotation)

Example 19 with ActivityResult

use of android.app.Instrumentation.ActivityResult in project collect by opendatakit.

the class AllWidgetsFormTest method testExStringWidget.

public void testExStringWidget() {
    // Manually input the value:
    String exStringWidgetFirstText = randomString();
    when(activityAvailability.isActivityAvailable(any(Intent.class))).thenReturn(false);
    onView(withText("Launch")).perform(click());
    onVisibleEditText().perform(replaceText(exStringWidgetFirstText));
    openWidgetList();
    onView(withText("Ex string widget")).perform(click());
    Screengrab.screenshot("ex-string");
    onVisibleEditText().check(matches(withText(exStringWidgetFirstText)));
    // Replace with Intent value:
    String exStringWidgetSecondText = randomString();
    Intent stringIntent = new Intent();
    stringIntent.putExtra("value", exStringWidgetSecondText);
    ActivityResult exStringResult = new ActivityResult(RESULT_OK, stringIntent);
    intending(allOf(hasAction("change.uw.android.BREATHCOUNT"), hasExtra("value", exStringWidgetFirstText))).respondWith(exStringResult);
    when(activityAvailability.isActivityAvailable(any(Intent.class))).thenReturn(true);
    onView(withText("Launch")).perform(click());
    onView(withText(exStringWidgetSecondText)).check(matches(isDisplayed()));
    Screengrab.screenshot("ex-string2");
    openWidgetList();
    onView(withText("Ex string widget")).perform(click());
    onVisibleEditText().check(matches(withText(exStringWidgetSecondText)));
    onView(withText("Ex string widget")).perform(swipeLeft());
}
Also used : Intent(android.content.Intent) RandomString(net.bytebuddy.utility.RandomString) ActivityResult(android.app.Instrumentation.ActivityResult)

Example 20 with ActivityResult

use of android.app.Instrumentation.ActivityResult in project android_packages_apps_Settings by omnirom.

the class FingerprintEnrollFinishTest method clickAddAnother_shouldLaunchEnrolling.

@Test
public void clickAddAnother_shouldLaunchEnrolling() {
    final ComponentName enrollingComponent = new ComponentName(getTargetContext(), FingerprintEnrollEnrolling.class);
    intending(hasComponent(enrollingComponent)).respondWith(new ActivityResult(Activity.RESULT_CANCELED, null));
    onView(withId(R.id.add_another_button)).perform(click());
    intended(hasComponent(enrollingComponent));
    assertFalse(mActivityRule.getActivity().isFinishing());
}
Also used : ComponentName(android.content.ComponentName) ActivityResult(android.app.Instrumentation.ActivityResult) Test(org.junit.Test) SmallTest(android.support.test.filters.SmallTest)

Aggregations

ActivityResult (android.app.Instrumentation.ActivityResult)25 Test (org.junit.Test)18 ComponentName (android.content.ComponentName)14 SmallTest (android.support.test.filters.SmallTest)12 Intent (android.content.Intent)6 RandomString (net.bytebuddy.utility.RandomString)3 SmallTest (androidx.test.filters.SmallTest)2 PartnerCustomizationLayout (com.google.android.setupcompat.PartnerCustomizationLayout)2 Instrumentation (android.app.Instrumentation)1 Bundle (android.os.Bundle)1 LargeTest (android.support.test.filters.LargeTest)1 DocumentFile (androidx.documentfile.provider.DocumentFile)1 LargeTest (androidx.test.filters.LargeTest)1 HookAnnotation (com.kunpeng.pit.HookAnnotation)1 OrgzlyTest (com.orgzly.android.OrgzlyTest)1 File (java.io.File)1 Before (org.junit.Before)1 ShadowActivity (org.robolectric.shadows.ShadowActivity)1