@Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    final LinearLayout testBed = new LinearLayout(this);
    testBed.setOrientation(LinearLayout.VERTICAL);
    testBed.setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    final int cacheSize = ViewConfiguration.getMaximumDrawingCacheSize();
    final Display display = getWindowManager().getDefaultDisplay();
    final int screenWidth = display.getWidth();
    final int screenHeight = display.getHeight();

    final View tiny = new View(this);
    tiny.setId(R.id.a);
    tiny.setBackgroundColor(0xFFFF0000);
    tiny.setLayoutParams(new LinearLayout.LayoutParams(screenWidth, screenHeight));

    final View large = new View(this);
    large.setId(R.id.b);
    large.setBackgroundColor(0xFF00FF00);
    // Compute the height of the view assuming a cache size based on ARGB8888
    final int height = 2 * (cacheSize / 2) / screenWidth;
    large.setLayoutParams(new LinearLayout.LayoutParams(screenWidth, height));

    final ScrollView scroller = new ScrollView(this);
    scroller.setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    testBed.addView(tiny);
    testBed.addView(large);
    scroller.addView(testBed);

    setContentView(scroller);
  }
  @Test
  public void methodsShouldReturnAndroidConstants() {
    Activity context = new Activity();
    ViewConfiguration viewConfiguration = ViewConfiguration.get(context);

    assertEquals(10, ViewConfiguration.getScrollBarSize());
    assertEquals(250, ViewConfiguration.getScrollBarFadeDuration());
    assertEquals(300, ViewConfiguration.getScrollDefaultDelay());
    assertEquals(12, ViewConfiguration.getFadingEdgeLength());
    assertEquals(125, ViewConfiguration.getPressedStateDuration());
    assertEquals(500, ViewConfiguration.getLongPressTimeout());
    assertEquals(115, ViewConfiguration.getTapTimeout());
    assertEquals(500, ViewConfiguration.getJumpTapTimeout());
    assertEquals(300, ViewConfiguration.getDoubleTapTimeout());
    assertEquals(12, ViewConfiguration.getEdgeSlop());
    assertEquals(16, ViewConfiguration.getTouchSlop());
    assertEquals(16, ViewConfiguration.getWindowTouchSlop());
    assertEquals(50, ViewConfiguration.getMinimumFlingVelocity());
    assertEquals(4000, ViewConfiguration.getMaximumFlingVelocity());
    assertEquals(320 * 480 * 4, ViewConfiguration.getMaximumDrawingCacheSize());
    assertEquals(3000, ViewConfiguration.getZoomControlsTimeout());
    assertEquals(500, ViewConfiguration.getGlobalActionKeyTimeout());
    assertEquals(0.015f, ViewConfiguration.getScrollFriction());

    assertEquals(1f, context.getResources().getDisplayMetrics().density);

    assertEquals(10, viewConfiguration.getScaledScrollBarSize());
    assertEquals(12, viewConfiguration.getScaledFadingEdgeLength());
    assertEquals(12, viewConfiguration.getScaledEdgeSlop());
    assertEquals(16, viewConfiguration.getScaledTouchSlop());
    assertEquals(32, viewConfiguration.getScaledPagingTouchSlop());
    assertEquals(100, viewConfiguration.getScaledDoubleTapSlop());
    assertEquals(16, viewConfiguration.getScaledWindowTouchSlop());
    assertEquals(50, viewConfiguration.getScaledMinimumFlingVelocity());
    assertEquals(4000, viewConfiguration.getScaledMaximumFlingVelocity());
  }