Esempio n. 1
0
 protected final void hitEnterAndWait() {
   Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
   mActions.sendSpecialKey(Actions.SpecialKey.ENTER);
   // wait for screen to load
   contentEventExpecter.blockForEvent();
   contentEventExpecter.unregisterListener();
 }
Esempio n. 2
0
 public void clearPrivateData() {
   selectSettingsItem(StringHelper.PRIVACY_SECTION_LABEL, StringHelper.CLEAR_PRIVATE_DATA_LABEL);
   Actions.EventExpecter clearData = mActions.expectGeckoEvent("Sanitize:Finished");
   mSolo.clickOnText("Clear data");
   clearData.blockForEvent();
   clearData.unregisterListener();
 }
Esempio n. 3
0
  /* Tap the "star" (bookmark) button to bookmark or un-bookmark the current page */
  public void toggleBookmark() {
    mActions.sendSpecialKey(Actions.SpecialKey.MENU);
    waitForText("Settings");

    // On ICS+ phones, there is no button labeled "Bookmarks"
    // instead we have to just dig through every button on the screen
    ArrayList<View> images = mSolo.getCurrentViews();
    for (int i = 0; i < images.size(); i++) {
      final View view = images.get(i);
      boolean found = false;
      found = "Bookmark".equals(view.getContentDescription());

      // on older android versions, try looking at the button's text
      if (!found) {
        if (view instanceof TextView) {
          found = "Bookmark".equals(((TextView) view).getText());
        }
      }

      if (found) {
        int[] xy = new int[2];
        view.getLocationOnScreen(xy);

        final int viewWidth = view.getWidth();
        final int viewHeight = view.getHeight();
        final float x = xy[0] + (viewWidth / 2.0f);
        float y = xy[1] + (viewHeight / 2.0f);

        mSolo.clickOnScreen(x, y);
      }
    }
  }
Esempio n. 4
0
  @SuppressWarnings({"unchecked", "non-varargs"})
  public void SqliteCompare(String dbName, String sqlCommand, ContentValues[] cvs) {
    File profile = new File(mProfile);
    String dbPath = new File(profile, dbName).getPath();

    Cursor c = mActions.querySql(dbPath, sqlCommand);
    SqliteCompare(c, cvs);
  }
Esempio n. 5
0
 protected void blockForGeckoReady() {
   try {
     Actions.EventExpecter geckoReadyExpector = mActions.expectGeckoEvent("Gecko:Ready");
     if (!GeckoThread.checkLaunchState(LaunchState.GeckoRunning)) {
       geckoReadyExpector.blockForEvent(GECKO_READY_WAIT_MS, true);
     }
     geckoReadyExpector.unregisterListener();
   } catch (Exception e) {
     mAsserter.dumpLog("Exception in blockForGeckoReady", e);
   }
 }
Esempio n. 6
0
 public final void selectMenuItem(String menuItemName) {
   // build the item name ready to be used
   String itemName = "^" + menuItemName + "$";
   mActions.sendSpecialKey(Actions.SpecialKey.MENU);
   if (waitForText(itemName)) {
     mSolo.clickOnText(itemName);
   } else {
     // Older versions of Android have additional settings under "More",
     // including settings that newer versions have under "Tools."
     if (mSolo.searchText("(^More$|^Tools$)")) {
       mSolo.clickOnText("(^More$|^Tools$)");
     }
     waitForText(itemName);
     mSolo.clickOnText(itemName);
   }
 }