예제 #1
0
  @Override
  public void setUp() throws Exception {
    super.setUp();
    WebappRegistry.refreshSharedPrefsForTesting();

    // Register the webapps so when the data storage is opened, the test doesn't crash. There is
    // no race condition with the retrieval as AsyncTasks are run sequentially on the background
    // thread.
    WebappRegistry.getInstance()
        .register(
            WEBAPP_1_ID,
            new WebappRegistry.FetchWebappDataStorageCallback() {
              @Override
              public void onWebappDataStorageRetrieved(WebappDataStorage storage) {
                storage.updateFromShortcutIntent(
                    createIntent(WEBAPP_1_ID, WEBAPP_1_URL, WEBAPP_1_TITLE, WEBAPP_ICON, true));
              }
            });
    WebappRegistry.getInstance()
        .register(
            WEBAPP_2_ID,
            new WebappRegistry.FetchWebappDataStorageCallback() {
              @Override
              public void onWebappDataStorageRetrieved(WebappDataStorage storage) {
                storage.updateFromShortcutIntent(
                    createIntent(WEBAPP_1_ID, WEBAPP_1_URL, WEBAPP_1_TITLE, WEBAPP_ICON, true));
              }
            });
  }
예제 #2
0
  @Override
  public void setUp() throws Exception {
    super.setUp();

    // Register the webapps so when the data storage is opened, the test doesn't crash. There is
    // no race condition with the retrival as AsyncTasks are run sequentially on the background
    // thread.
    WebappRegistry.registerWebapp(getInstrumentation().getTargetContext(), WEBAPP_1_ID);
    WebappRegistry.registerWebapp(getInstrumentation().getTargetContext(), WEBAPP_2_ID);
  }