コード例 #1
0
  public void testLaunchAboutActivity() {
    Instrumentation.ActivityMonitor monitorAbout =
        new Instrumentation.ActivityMonitor(AboutActivity.class.getCanonicalName(), null, false);
    getInstrumentation().addMonitor(monitorAbout);

    mainActivity = launchActivity("com.simplealertdialog.sample.demos", MainActivity.class, null);
    getInstrumentation().waitForIdleSync();

    mainActivity.openOptionsMenu();
    getInstrumentation().waitForIdleSync();

    getInstrumentation().sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_DOWN);
    getInstrumentation().waitForIdleSync();

    getInstrumentation().sendKeyDownUpSync(KeyEvent.KEYCODE_ENTER);
    getInstrumentation().waitForIdleSync();

    AboutActivity aboutActivity =
        (AboutActivity) getInstrumentation().waitForMonitorWithTimeout(monitorAbout, 3000);
    assertNotNull(aboutActivity);
    assertTrue(getInstrumentation().checkMonitorHit(monitorAbout, 1));

    aboutActivity.finish();
  }
コード例 #2
0
 public void testLaunch() {
   mainActivity = launchActivity("com.simplealertdialog.sample.demos", MainActivity.class, null);
   getInstrumentation().waitForIdleSync();
   assertNotNull(mainActivity);
   mainActivity.finish();
 }