// Initialize the distribution from the mock package.
 private Distribution initDistribution(String aPackagePath) {
   // Call Distribution.init with the mock package.
   Actions.EventExpecter distributionSetExpecter =
       mActions.expectGoannaEvent("Distribution:Set:OK");
   Distribution dist =
       Distribution.init(mActivity, aPackagePath, "prefs-" + System.currentTimeMillis());
   distributionSetExpecter.blockForEvent();
   distributionSetExpecter.unregisterListener();
   return dist;
 }
  private JSONObject clickTrackingTile(String text) throws JSONException {
    boolean tileFound = waitForText(text);
    mAsserter.ok(tileFound, "Found tile: " + text, null);

    Actions.EventExpecter loadExpecter = mActions.expectGoannaEvent("Robocop:TilesResponse");
    mSolo.clickOnText(text);
    String data = loadExpecter.blockForEventData();
    JSONObject dataJSON = new JSONObject(data);
    String response = dataJSON.getString("response");
    return new JSONObject(response);
  }
Example #3
0
  /**
   * Loads a set of tabs in the browser specified by the given session.
   *
   * @param session Session to load
   */
  protected void loadSessionTabs(Session session) {
    // Verify initial about:home tab
    verifyTabCount(1);
    verifyUrl(StringHelper.ABOUT_HOME_URL);

    SessionTab[] tabs = session.getItems();
    for (int i = 0; i < tabs.length; i++) {
      final SessionTab tab = tabs[i];
      final PageInfo[] pages = tab.getItems();

      // New tabs always start with about:home, so make sure about:home
      // is always the first entry.
      mAsserter.is(
          pages[0].url,
          StringHelper.ABOUT_HOME_URL,
          "first page in tab is " + StringHelper.ABOUT_HOME_URL);

      // If this is the first tab, the tab already exists, so no need to
      // create a new one. Otherwise, create a new tab if we're loading
      // the first the first page in the set.
      if (i > 0) {
        addTab();
      }

      for (int j = 1; j < pages.length; j++) {
        Actions.EventExpecter pageShowExpecter = mActions.expectGoannaEvent("Content:PageShow");

        loadUrl(pages[j].url);

        pageShowExpecter.blockForEvent();
        pageShowExpecter.unregisterListener();
      }

      final int index = tab.getIndex();
      for (int j = pages.length - 1; j > index; j--) {
        mNavigation.back();
      }
    }

    selectTabAt(session.getIndex());
  }