@SmallTest
  public void testReceiveBasicFavicon() throws Throwable {
    int callCount = mContentsClient.getFaviconHelper().getCallCount();

    final String faviconUrl =
        mWebServer.setResponseBase64(
            FAVICON1_URL,
            CommonResources.FAVICON_DATA_BASE64,
            CommonResources.getImagePngHeaders(true));
    final String pageUrl =
        mWebServer.setResponse(
            FAVICON1_PAGE_URL, FAVICON1_PAGE_HTML, CommonResources.getTextHtmlHeaders(true));

    loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), pageUrl);

    mContentsClient.getFaviconHelper().waitForCallback(callCount);
    assertEquals(1, mWebServer.getRequestCount(FAVICON1_URL));
    Object originalFaviconSource = (new URL(faviconUrl)).getContent();
    Bitmap originalFavicon = BitmapFactory.decodeStream((InputStream) originalFaviconSource);
    assertNotNull(originalFavicon);
    assertNotNull(mContentsClient.getFaviconHelper().getIcon());
    assertTrue(mContentsClient.getFaviconHelper().getIcon().sameAs(originalFavicon));

    // Make sure the request counter for favicon is incremented when the page is loaded again
    // successfully.
    loadUrlAsync(mAwContents, pageUrl);
    mContentsClient.getFaviconHelper().waitForCallback(callCount);
    assertEquals(2, mWebServer.getRequestCount(FAVICON1_URL));
  }
  @SmallTest
  public void testReceiveBasicTouchIconLinkRel() throws Throwable {
    int callCount = mContentsClient.getFaviconHelper().getCallCount();

    final String pageUrl =
        mWebServer.setResponse(
            TOUCHICON_REL_URL, TOUCHICON_REL_PAGE_HTML, CommonResources.getTextHtmlHeaders(true));

    loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), pageUrl);

    mContentsClient.getTouchIconHelper().waitForCallback(callCount, 2);
    assertEquals(2, mContentsClient.getTouchIconHelper().getTouchIconsCount());
    assertFalse(
        mContentsClient
            .getTouchIconHelper()
            .hasTouchIcon(mWebServer.getBaseUrl() + TOUCHICON_REL_LINK));
    assertFalse(
        mContentsClient
            .getTouchIconHelper()
            .hasTouchIcon(mWebServer.getBaseUrl() + TOUCHICON_REL_LINK_72));
  }