@SmallTest
  @Feature({"AndroidWebView"})
  public void testOverScrollX() throws Throwable {
    final TestAwContentsClient contentsClient = new TestAwContentsClient();
    final ScrollTestContainerView testContainerView =
        (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient);
    final OverScrollByCallbackHelper overScrollByCallbackHelper =
        testContainerView.getOverScrollByCallbackHelper();
    enableJavaScriptOnUiThread(testContainerView.getAwContents());

    final int overScrollDeltaX = 30;
    final int oneStep = 1;

    loadTestPageAndWaitForFirstFrame(testContainerView, contentsClient, null, "");

    // Scroll separately in different dimensions because of vertical/horizontal scroll
    // snap.
    final int overScrollCallCount = overScrollByCallbackHelper.getCallCount();
    AwTestTouchUtils.dragCompleteView(
        testContainerView, 0, overScrollDeltaX, 0, 0, oneStep, null /* completionLatch */);
    overScrollByCallbackHelper.waitForCallback(overScrollCallCount);
    // Unfortunately the gesture detector seems to 'eat' some number of pixels. For now
    // checking that the value is < 0 (overscroll is reported as negative values) will have to
    // do.
    assertTrue(0 > overScrollByCallbackHelper.getDeltaX());
    assertEquals(0, overScrollByCallbackHelper.getDeltaY());

    assertScrollOnMainSync(testContainerView, 0, 0);
  }
  @SmallTest
  @Feature({"AndroidWebView"})
  public void testOverScrollY() throws Throwable {
    final TestAwContentsClient contentsClient = new TestAwContentsClient();
    final ScrollTestContainerView testContainerView =
        (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient);
    final OverScrollByCallbackHelper overScrollByCallbackHelper =
        testContainerView.getOverScrollByCallbackHelper();
    enableJavaScriptOnUiThread(testContainerView.getAwContents());

    final int overScrollDeltaY = 30;
    final int oneStep = 1;

    loadTestPageAndWaitForFirstFrame(testContainerView, contentsClient, null, "");

    int overScrollCallCount = overScrollByCallbackHelper.getCallCount();
    AwTestTouchUtils.dragCompleteView(
        testContainerView, 0, 0, 0, overScrollDeltaY, oneStep, null /* completionLatch */);
    overScrollByCallbackHelper.waitForCallback(overScrollCallCount);
    assertEquals(0, overScrollByCallbackHelper.getDeltaX());
    assertTrue(0 > overScrollByCallbackHelper.getDeltaY());

    assertScrollOnMainSync(testContainerView, 0, 0);
  }