public void testRemoveOnGlobalFocusChangeListener() {
    final LinearLayout layout = (LinearLayout) mActivity.findViewById(R.id.linearlayout);
    final ListView lv1 = (ListView) mActivity.findViewById(R.id.listview1);
    final ListView lv2 = (ListView) mActivity.findViewById(R.id.listview2);

    mViewTreeObserver = layout.getViewTreeObserver();
    MockOnGlobalFocusChangeListener listener = new MockOnGlobalFocusChangeListener();
    mViewTreeObserver.addOnGlobalFocusChangeListener(listener);
    assertFalse(listener.hasCalledOnGlobalFocusChanged());
    mInstrumentation.runOnMainSync(
        new Runnable() {
          @Override
          public void run() {
            layout.requestChildFocus(lv1, lv2);
          }
        });
    mInstrumentation.waitForIdleSync();
    assertTrue(listener.hasCalledOnGlobalFocusChanged());

    listener.reset();
    mViewTreeObserver.removeOnGlobalFocusChangeListener(listener);
    assertFalse(listener.hasCalledOnGlobalFocusChanged());
    mInstrumentation.runOnMainSync(
        new Runnable() {
          @Override
          public void run() {
            layout.requestChildFocus(lv1, lv2);
          }
        });
    mInstrumentation.waitForIdleSync();
    assertFalse(listener.hasCalledOnGlobalFocusChanged());
  }
Beispiel #2
0
  /**
   * Types text in an {@code EditText}
   *
   * @param index the index of the {@code EditText}
   * @param text the text that should be typed
   */
  public void typeText(final EditText editText, final String text) {
    if (editText != null) {
      inst.runOnMainSync(
          new Runnable() {
            public void run() {
              editText.setInputType(InputType.TYPE_NULL);
            }
          });
      clicker.clickOnScreen(editText, false, 0);
      activityUtils.hideSoftKeyboard(editText, true, true);

      boolean successfull = false;
      int retry = 0;

      while (!successfull && retry < 10) {

        try {
          inst.sendStringSync(text);
          successfull = true;
        } catch (SecurityException e) {
          activityUtils.hideSoftKeyboard(editText, true, true);
          retry++;
        }
      }
      if (!successfull) {
        Assert.assertTrue("Text can not be typed!", false);
      }
    }
  }
  public void testcase04_DownloadingCancel() {

    mPreference.edit().putInt(OTA_PRE_STATUS, STATE_DOWNLOADING).commit();
    mPreference.edit().putInt(OTA_PRE_DELTA_ID, PKG_ID_TEST).commit();

    mActivity = getActivity();

    ProgressBar dlRatioProgressBar = (ProgressBar) mActivity.findViewById(R.id.downloaingProBar);

    assertTrue(dlRatioProgressBar != null);
    assertTrue(dlRatioProgressBar.isShown());

    if (Util.isSdcardAvailable(mActivity) && Util.isNetWorkAvailable(mActivity, "WIFI")) {
      if (mPreference.getInt(OTA_PRE_STATUS, -1) == STATE_PAUSEDOWNLOAD) {
        return;
      }
      mInst.invokeMenuActionSync(mActivity, MENU_ID_CANCEL, 0);
      mInst.waitForIdleSync();

      assertTrue(mPreference.getInt(OTA_PRE_STATUS, -1) == STATE_PAUSEDOWNLOAD);
      sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
      sendKeys(KeyEvent.KEYCODE_DPAD_RIGHT);

      sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);

      mInst.waitForIdleSync();
      assertTrue(mPreference.getInt(OTA_PRE_STATUS, -1) == STATE_QUERYNEWVERSION);
    }
  }
Beispiel #4
0
 /**
  * Launches the preferences menu and starts the preferences activity named fragmentName. Returns
  * the activity that was started.
  */
 public static Preferences startPreferences(Instrumentation instrumentation, String fragmentName) {
   Context context = instrumentation.getTargetContext();
   Intent intent = PreferencesLauncher.createIntentForSettingsPage(context, fragmentName);
   Activity activity = instrumentation.startActivitySync(intent);
   assertTrue(activity instanceof Preferences);
   return (Preferences) activity;
 }
  public void testRemoveOnTouchModeChangeListener() {
    final Button b = (Button) mActivity.findViewById(R.id.button1);
    // let the button be touch mode.
    TouchUtils.tapView(this, b);

    mViewTreeObserver = b.getViewTreeObserver();

    MockOnTouchModeChangeListener listener = new MockOnTouchModeChangeListener();
    mViewTreeObserver.addOnTouchModeChangeListener(listener);
    assertFalse(listener.hasCalledOnTouchModeChanged());
    mInstrumentation.runOnMainSync(
        new Runnable() {
          @Override
          public void run() {
            b.requestFocusFromTouch();
          }
        });
    mInstrumentation.waitForIdleSync();

    assertTrue(listener.hasCalledOnTouchModeChanged());

    listener = new MockOnTouchModeChangeListener();
    assertFalse(listener.hasCalledOnTouchModeChanged());
    mInstrumentation.runOnMainSync(
        new Runnable() {
          @Override
          public void run() {
            b.requestFocusFromTouch();
          }
        });
    mInstrumentation.waitForIdleSync();

    assertFalse(listener.hasCalledOnTouchModeChanged());
  }
Beispiel #6
0
 /**
  * Simulate touching a specific location and dragging to a new location.
  *
  * <p>This method was copied from {@code TouchUtils.java} in the Android Open Source Project, and
  * modified here.
  *
  * @param fromX X coordinate of the initial touch, in screen coordinates
  * @param toX Xcoordinate of the drag destination, in screen coordinates
  * @param fromY X coordinate of the initial touch, in screen coordinates
  * @param toY Y coordinate of the drag destination, in screen coordinates
  * @param stepCount How many move steps to include in the drag
  */
 public void drag(float fromX, float toX, float fromY, float toY, int stepCount) {
   long downTime = SystemClock.uptimeMillis();
   long eventTime = SystemClock.uptimeMillis();
   float y = fromY;
   float x = fromX;
   float yStep = (toY - fromY) / stepCount;
   float xStep = (toX - fromX) / stepCount;
   MotionEvent event =
       MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, fromX, fromY, 0);
   try {
     inst.sendPointerSync(event);
   } catch (SecurityException ignored) {
   }
   for (int i = 0; i < stepCount; ++i) {
     y += yStep;
     x += xStep;
     eventTime = SystemClock.uptimeMillis();
     event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, x, y, 0);
     try {
       inst.sendPointerSync(event);
     } catch (SecurityException ignored) {
     }
   }
   eventTime = SystemClock.uptimeMillis();
   event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, toX, toY, 0);
   try {
     inst.sendPointerSync(event);
   } catch (SecurityException ignored) {
   }
 }
  /**
   * Checks the device has a valid Bootstrap (on parse.com via the example API), account, if not,
   * adds one using the test credentials found in system property 'bootstrap.test.api.key'.
   *
   * <p>The credentials can be passed on the command line like this: mvn
   * -bootstrap.test.api.key=0123456789abcdef0123456789abcdef install
   *
   * @param instrumentation taken from the test context
   * @return true if valid account credentials are available
   */
  public static boolean ensureValidAccountAvailable(Instrumentation instrumentation) {
    Context c = instrumentation.getContext();
    AccountManager accountManager = AccountManager.get(instrumentation.getTargetContext());

    for (Account account : accountManager.getAccountsByType(BOOTSTRAP_ACCOUNT_TYPE)) {
      if (accountManager.peekAuthToken(account, AUTHTOKEN_TYPE) != null) {
        Ln.i("Using existing account : " + account.name);
        return true; // we have a valid account that has successfully authenticated
      }
    }

    String testApiKey = c.getString(R.string.test_account_api_key);
    String truncatedApiKey = testApiKey.substring(0, 4) + "…";

    if (!testApiKey.matches("\\p{XDigit}{32}")) {
      Ln.w("No valid test account credentials in bootstrap.test.api.key : " + truncatedApiKey);
      return false;
    }

    Ln.i("Adding test account using supplied api key credential : " + truncatedApiKey);
    Account account = new Account("*****@*****.**", BOOTSTRAP_ACCOUNT_TYPE);
    accountManager.addAccountExplicitly(
        account, null, null); // this test account will not have a valid password
    accountManager.setAuthToken(account, AUTHTOKEN_TYPE, testApiKey);
    return true;
  }
  @UiThreadTest
  public void testStatePause() {
    Instrumentation instr = this.getInstrumentation();
    assertNotNull(instr);

    instr.callActivityOnPause(mPlaceActivity);
    instr.callActivityOnResume(mPlaceActivity);
  } // end testStatePause
 @Before
 public void setUp() throws Exception {
   super.setUp();
   Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
   Context context = instrumentation.getTargetContext();
   intent = new Intent(context, ImageDetailActivity.class);
   intent.putExtra(ImageDetailActivity.EXTRA_CONTENT, DataHolder.LIST_ITEM_JSON);
   intent.putExtra(ImageDetailActivity.EXTRA_CACHE_SIZE, "");
 }
Beispiel #10
0
 private void backToTest() {
   /*Intent intent = new Intent(Intent.ACTION_MAIN);
   intent.setClassName(mContext.getPackageName(), AutoTestActivity.class.getName());
   intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
   mContext.startActivity(intent);*/
   Instrumentation inst = new Instrumentation();
   inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
   inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
 }
 private void layout(final int layoutId) {
   mInstrumentation.runOnMainSync(
       new Runnable() {
         @Override
         public void run() {
           mActivity.setContentView(layoutId);
         }
       });
   mInstrumentation.waitForIdleSync();
 }
  public void longPress(Coordinates where) {
    long downTime = SystemClock.uptimeMillis();
    long eventTime = SystemClock.uptimeMillis();
    Point point = where.getLocationOnScreen();
    // List<MotionEvent> motionEvents = new ArrayList<MotionEvent>();
    //
    // motionEvents.add(getMotionEvent(downTime, downTime, MotionEvent.ACTION_DOWN, point));
    // motionEvents.add(getMotionEvent(downTime, (downTime + 3000), MotionEvent.ACTION_UP, point));
    // sendMotionEvents(motionEvents);
    Instrumentation inst = instrumentation;

    MotionEvent event = null;
    boolean successfull = false;
    int retry = 0;
    while (!successfull && retry < 10) {
      try {
        if (event == null) {
          event =
              MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, point.x, point.y, 0);
        }
        System.out.println("trying to send pointer");
        inst.sendPointerSync(event);
        successfull = true;
      } catch (SecurityException e) {
        System.out.println("failed: " + retry);
        // activityUtils.hideSoftKeyboard(null, false, true);
        retry++;
      }
    }
    if (!successfull) {
      throw new SelendroidException("Click can not be completed!");
    }
    inst.sendPointerSync(event);
    inst.waitForIdleSync();

    eventTime = SystemClock.uptimeMillis();
    final int touchSlop = ViewConfiguration.get(inst.getTargetContext()).getScaledTouchSlop();
    event =
        MotionEvent.obtain(
            downTime,
            eventTime,
            MotionEvent.ACTION_MOVE,
            point.x + touchSlop / 2,
            point.y + touchSlop / 2,
            0);
    inst.sendPointerSync(event);
    inst.waitForIdleSync();

    try {
      Thread.sleep((long) (ViewConfiguration.getLongPressTimeout() * 1.5f));
    } catch (InterruptedException e) {
      e.printStackTrace();
    }

    eventTime = SystemClock.uptimeMillis();
    event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, point.x, point.y, 0);
    inst.sendPointerSync(event);
    inst.waitForIdleSync();
  }
Beispiel #13
0
  @Override
  protected void setUp() throws Exception {
    Instrumentation instrumentation = getInstrumentation();
    mockSupport = new MozcMockSupport(instrumentation);

    activity =
        Preconditions.checkNotNull(
            launchActivity("org.mozc.android.inputmethod.japanese", Activity.class, null));
    instrumentation.runOnMainSync(new OnCreateRunner());
    context = instrumentation.getTargetContext();
  }
  public void testDowngrade() {

    for (final View caseView : mCaseListIndexView) {
      if (((TextView) caseView).getText().toString().equals("TC_Downgrade")) {
        Log.e(TAG, "TC_Downgrade find");

        final TextView inputView = (TextView) caseView;
        mInstrumentation.runOnMainSync(
            new Runnable() {
              @Override
              public void run() {
                inputView.requestFocus();
                inputView.performClick();
              }
            });

        sleep(2000);

        setActivity(WXPageActivity.wxPageActivityInstance);
        Activity activity2 = getActivity();

        ViewGroup myGroup = (ViewGroup) (activity2.findViewById(R.id.container));
        ArrayList<View> inputListView = new ArrayList<View>();
        myGroup.findViewsWithText(
            inputListView, "TC_Downgrade_osV_True", View.FIND_VIEWS_WITH_TEXT);

        Log.e(TAG, "TC_Downgrade_osV_True== " + inputListView.size());

        if (inputListView.size() != 0) {
          final TextView inputTypeView = (TextView) inputListView.get(0);

          mInstrumentation.runOnMainSync(
              new Runnable() {
                @Override
                public void run() {
                  inputTypeView.requestFocus();
                  inputTypeView.performClick();
                  Log.e(TAG, "TC_Downgrade_osV_True clcik!");
                }
              });

          sleep(2000);
          Log.e(TAG, "TC_Downgrade_osV_True snap!");
          //                   screenShot("TC_Downgrade_appV_True");
          ScreenShot.takeScreenShotIncludeDialog(getActivity(), "TC_Downgrade_osV_True");

          sleep(2000);
        }
      }
    }
  }
  // Testing Case #4
  public void testPauseResume() {
    enterVideoPageWaitForIdle();

    mInstrumentation.callActivityOnPause(mActivity);
    CommonTestUtil.wait(mInstrumentation, CommonTestUtil.WAIT_FOR_PAGE_SWITCH_TIME_IN_SECS);

    mInstrumentation.callActivityOnResume(mActivity);
    CommonTestUtil.waitPageForIdleSync(
        mInstrumentation,
        mMedia3DView,
        mActivity.getVideoPage(),
        CommonTestUtil.DEFAULT_PAGE_SWITCH_TIMEOUT_IN_MS);
    assertTrue(mMedia3DView.getCurrentPage() == mActivity.getVideoPage());
  }
Beispiel #16
0
 @Override
 protected int executeInner(String parameters) {
   log("executeInner");
   final Instrumentation instrumentation = AutotestEngine.getInstance().getInstrumentation();
   if (!mIsRecording) {
     PhoneRecorderHandler.getInstance()
         .startVoiceRecord(Constants.PHONE_RECORDING_VOICE_CALL_CUSTOM_VALUE);
   } else {
     PhoneRecorderHandler.getInstance().stopRecording();
   }
   Utils.sleep(2000);
   instrumentation.waitForIdleSync();
   return ICommand.RESULT_OK;
 }
Beispiel #17
0
 protected void setUp() throws Exception {
   super.setUp();
   mInst = getInstrumentation();
   mContext = mInst.getTargetContext();
   mActivity = getActivity();
   mSolo = new Solo(mInst, mActivity);
 }
Beispiel #18
0
  /**
   * Scrolls a ScrollView.
   *
   * @param direction the direction to be scrolled
   * @return {@code true} if scrolling occurred, false if it did not
   */
  boolean scrollView(final View view, int direction) {
    if (view == null) {
      return false;
    }

    int height = view.getHeight();
    height--;
    int scrollTo = -1;

    if (direction == DOWN) {
      scrollTo = height;
    } else if (direction == UP) {
      scrollTo = -height;
    }

    int originalY = view.getScrollY();
    final int scrollAmount = scrollTo;
    inst.runOnMainSync(
        new Runnable() {
          public void run() {
            view.scrollBy(0, scrollAmount);
          }
        });

    if (originalY == view.getScrollY()) {
      return false;
    } else {
      return true;
    }
  }
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    mActivity = getActivity();
    mInstrumentation = getInstrumentation();

    mButton = new Button(mActivity);
    mActivity.runOnUiThread(
        new Runnable() {
          public void run() {
            try {
              mActivity.addContentView(
                  mButton, new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
            } catch (Exception e) {
              mException = e;
            }
          }
        });
    mInstrumentation.waitForIdleSync();

    if (mException != null) {
      throw mException;
    }

    int right = mButton.getRight();
    int bottom = mButton.getBottom();
    mXInside = (mButton.getLeft() + right) / 3;
    mYInside = (mButton.getTop() + bottom) / 3;

    mRect = new Rect();
    mButton.getHitRect(mRect);
  }
  /** Tests that pressing the next button and clicking ok on the dialog closes the activity */
  @LargeTest
  public void testActivityClosesOnFinish() {
    loadUpImageAndGoToShareActivity();

    createNewspaperActivity.runOnUiThread(
        new Runnable() {
          public void run() {
            Button finishButton = (Button) createNewspaperActivity.findViewById(R.id.finishBtn);

            // Ensure that the button is not null before we attempt to click it
            assertNotNull(finishButton);
            finishButton.performClick();

            // Ensure that the error dialog is not null
            assertNotNull(createNewspaperActivity.getErrorDialog());

            // Click on the positive button (OK) to close the dialog
            createNewspaperActivity
                .getErrorDialog()
                .getDialog()
                .getButton(DialogInterface.BUTTON_POSITIVE)
                .performClick();
          }
        });
    instrumentation.waitForIdleSync();

    // Ensure that the activity is closing off now we have clicked finish and ok on the dialog
    assertTrue(createNewspaperActivity.isFinishing());
  }
  private static void callPluginApplicationOnCreate(PluginDescriptor pluginDescriptor) {

    Application application = null;

    if (pluginDescriptor.getPluginApplication() == null
        && pluginDescriptor.getPluginClassLoader() != null) {
      try {
        LogUtil.d("创建插件Application", pluginDescriptor.getApplicationName());
        application =
            Instrumentation.newApplication(
                pluginDescriptor
                    .getPluginClassLoader()
                    .loadClass(pluginDescriptor.getApplicationName()),
                pluginDescriptor.getPluginContext());
        pluginDescriptor.setPluginApplication(application);
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      } catch (InstantiationException e) {
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      }
    }

    // 安装ContentProvider
    PluginInjector.installContentProviders(
        sApplication, pluginDescriptor.getProviderInfos().values());

    // 执行onCreate
    if (application != null) {
      application.onCreate();
    }

    changeListener.onPluginStarted(pluginDescriptor.getPackageName());
  }
Beispiel #22
0
  public static String read(Instrumentation instrumentation, String fileName) {
    String data = "";

    try {
      BufferedReader bufferedReader = null;
      try {
        AssetManager assetManager = instrumentation.getContext().getAssets();
        InputStream inputStream = assetManager.open(fileName);
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));

        StringBuilder stringBuilder = new StringBuilder();
        String line;
        while ((line = bufferedReader.readLine()) != null) {
          stringBuilder.append(line);
        }

        data = stringBuilder.toString();
      } finally {
        if (bufferedReader != null) {
          bufferedReader.close();
        }
      }
    } catch (IOException e) {
      e.printStackTrace();
    }

    return data;
  }
  public void testcase02_NewVersionDl() {

    mPreference.edit().putInt(OTA_PRE_STATUS, STATE_NEWVERSION_READY).commit();
    mPreference.edit().putInt(OTA_PRE_DELTA_ID, PKG_ID_TEST).commit();
    mActivity = getActivity();

    mInst.invokeMenuActionSync(mActivity, MENU_ID_DOWNLOAD, 0);
    mInst.waitForIdleSync();

    Xlog.i(TAG, "OTA_PRE_STATUS = " + mPreference.getInt(OTA_PRE_STATUS, -1));
    if (Util.isSdcardAvailable(mActivity) && Util.isNetWorkAvailable(mActivity, "WIFI")) {
      assertTrue(
          mPreference.getInt(OTA_PRE_STATUS, -1) == STATE_DOWNLOADING
              || mPreference.getInt(OTA_PRE_STATUS, -1) == STATE_PAUSEDOWNLOAD);
    }
  }
 public Activity waitForNextActivity(String methodExt, long timeOut) throws InterruptedException {
   Activity nextActivity = mInstrumentation.waitForMonitorWithTimeout(activityMonitor, timeOut);
   MyLog.v(methodExt, "After waitForMonitor: " + nextActivity);
   assertNotNull("Next activity is opened and captured", nextActivity);
   TestSuite.waitForListLoaded(mInstrumentation, nextActivity, 2);
   activityMonitor = null;
   return nextActivity;
 }
Beispiel #25
0
 /** Load and attach the application under test. */
 private void setupApplication() {
   mApplication = null;
   try {
     mApplication = (T) Instrumentation.newApplication(mApplicationClass, getContext());
   } catch (Exception e) {
     assertNotNull(mApplication);
   }
   mAttached = true;
 }
Beispiel #26
0
 /**
  * Returns a localized string
  *
  * @param id the resource ID for the string
  * @return the localized string
  */
 public String getString(String id) {
   Context targetContext = instrumentation.getTargetContext();
   String packageName = targetContext.getPackageName();
   int viewId = targetContext.getResources().getIdentifier(id, "string", packageName);
   if (viewId == 0) {
     viewId = targetContext.getResources().getIdentifier(id, "string", "android");
   }
   return getString(viewId);
 }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   Instrumentation instrumentation = getInstrumentation();
   mContext = instrumentation.getTargetContext();
   mPackageManager = mContext.getPackageManager();
   mAvailableFeatures = new HashSet<String>();
   if (mPackageManager.getSystemAvailableFeatures() != null) {
     for (FeatureInfo feature : mPackageManager.getSystemAvailableFeatures()) {
       mAvailableFeatures.add(feature.name);
     }
   }
   mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
   mLocationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
   mSensorManager = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE);
   mTelephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
   mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
 }
Beispiel #28
0
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   mInstrumentation = getInstrumentation();
   mContext = mInstrumentation.getContext();
   mIntent = new Intent(Intent.ACTION_MAIN);
   mIntent.setComponent(new ComponentName(mContext, Configuration.class.getName()));
   mActivity = startActivity(mIntent, null, null);
   preferenceScreen = mActivity.getPreferenceScreen();
 }
  private void setupMockServer(HashMap<String, String> override_map) {
    HashMap<String, String> map = new HashMap<>(Util.RESPONSE_MAP);

    if (override_map != null) {
      for (String key : override_map.keySet()) {
        map.put(key, override_map.get(key));
      }
    }

    Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
    AndroidApplication app =
        (AndroidApplication) instrumentation.getTargetContext().getApplicationContext();

    // setup objectGraph to inject Mock API
    List modules = Collections.singletonList(new DummyAPIModule(map));
    ObjectGraph graph = ObjectGraph.create(modules.toArray());
    app.setObjectGraph(graph);
    app.getObjectGraph().inject(app);
  }
Beispiel #30
0
  public void testItemClick() throws Exception {
    ds.writeNote("Note 1", "test");
    start();
    Instrumentation.ActivityMonitor monitor =
        instrumentation.addMonitor(Editor.class.getName(), null, false);

    notes.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            listView.performItemClick(listView, 0, 0);
          }
        });

    instrumentation.waitForIdleSync();
    Activity editor = instrumentation.waitForMonitorWithTimeout(monitor, 3 * 1000);
    notes.finishActivity(1);
    assertNotNull("Editor not started in 3 sec.", editor);
  }