Java 类android.support.test.espresso.NoActivityResumedException 实例源码

项目:adyen-android    文件:PaymentAppTest.java   
private void cancelCreditCardPayment() throws Exception {
    Espresso.pressBack();
    EspressoTestUtils.waitForView(R.id.activity_payment_method_selection);
    Espresso.pressBack();
    EspressoTestUtils.waitForView(R.id.verificationTextView);
    try {
        // Actually this should not be required. However without pressing back one last time; the
        // activity cannot be started in the next test. To avoid it; we kill the PaymentResultActivity as well.
        Espresso.pressBack();
    } catch (final NoActivityResumedException expected) {
        // expected
    }
}
项目:2016.2-WikiLegis    文件:LoginFragmentTest.java   
private void goBackN() {
    final int N = 50; // how many times to hit back button
    try {
        for (int i = 0; i < N; i++)
            Espresso.pressBack();
    } catch (NoActivityResumedException e) {
        Log.e("TAG", "Closed all activities", e);
    }
}
项目:TextSecureSMP    文件:EspressoUtil.java   
public static void closeAllActivities() throws Exception {
  for (int i = 0; i < 10; i++) {
    try {

      pressBack();

    } catch (NoActivityResumedException e) {
      Log.d(TAG, "you made me do this, android");
      return;
    }
  }

  throw new IllegalStateException("what are you doing with 10 open activities?!");
}