| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 import android.graphics.Canvas; | 9 import android.graphics.Canvas; |
| 10 import android.graphics.Rect; | 10 import android.graphics.Rect; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 final long downEvent = SystemClock.uptimeMillis(); | 72 final long downEvent = SystemClock.uptimeMillis(); |
| 73 view.onTouchEvent( | 73 view.onTouchEvent( |
| 74 MotionEvent.obtain(downEvent, downEvent, MotionEvent.ACTION_DOWN
, x, y, 0)); | 74 MotionEvent.obtain(downEvent, downEvent, MotionEvent.ACTION_DOWN
, x, y, 0)); |
| 75 view.onTouchEvent( | 75 view.onTouchEvent( |
| 76 MotionEvent.obtain(downEvent, downEvent + 10, MotionEvent.ACTION
_UP, x, y, 0)); | 76 MotionEvent.obtain(downEvent, downEvent + 10, MotionEvent.ACTION
_UP, x, y, 0)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 @Override | 79 @Override |
| 80 public void setUp() throws Exception { | 80 public void setUp() throws Exception { |
| 81 super.setUp(); | 81 super.setUp(); |
| 82 mPopupZoomer = createPopupZoomerForTest(getInstrumentation().getTargetCo
ntext()); |
| 83 mContentViewCore = new ContentViewCore(getActivity(), ""); |
| 82 | 84 |
| 83 final Context context = getActivity(); | 85 final Context context = getActivity(); |
| 84 | 86 |
| 85 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 87 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 86 @Override | 88 @Override |
| 87 public void run() { | 89 public void run() { |
| 88 mPopupZoomer = createPopupZoomerForTest(getInstrumentation().get
TargetContext()); | 90 mPopupZoomer = createPopupZoomerForTest(getInstrumentation().get
TargetContext()); |
| 89 mContentViewCore = new ContentViewCore(context, ""); | 91 mContentViewCore = new ContentViewCore(context, ""); |
| 90 ImeAdapter imeAdapter = new ImeAdapter( | 92 ImeAdapter imeAdapter = new ImeAdapter(getContentViewCore().getW
ebContents(), |
| 91 new TestInputMethodManagerWrapper(mContentViewCore), | 93 new TestInputMethodManagerWrapper(mContentViewCore), |
| 92 new TestImeAdapterDelegate(getContentViewCore().getConta
inerView())); | 94 new TestImeAdapterDelegate(getContentViewCore().getConta
inerView())); |
| 93 mContentViewCore.setSelectionPopupControllerForTesting( | 95 mContentViewCore.setSelectionPopupControllerForTesting(new Selec
tionPopupController( |
| 94 new SelectionPopupController(context, null, null, null, | 96 context, null, null, null, mContentViewCore.getRenderCoo
rdinates())); |
| 95 mContentViewCore.getRenderCoordinates(), imeAdap
ter)); | |
| 96 mContentViewCore.setPopupZoomerForTest(mPopupZoomer); | 97 mContentViewCore.setPopupZoomerForTest(mPopupZoomer); |
| 97 mContentViewCore.setImeAdapterForTest(imeAdapter); | 98 mContentViewCore.setImeAdapterForTest(imeAdapter); |
| 98 } | 99 } |
| 99 }); | 100 }); |
| 100 } | 101 } |
| 101 | 102 |
| 102 @SmallTest | 103 @SmallTest |
| 103 @Feature({"Navigation"}) | 104 @Feature({"Navigation"}) |
| 104 public void testDefaultCreateState() throws Exception { | 105 public void testDefaultCreateState() throws Exception { |
| 105 assertEquals(View.INVISIBLE, mPopupZoomer.getVisibility()); | 106 assertEquals(View.INVISIBLE, mPopupZoomer.getVisibility()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 mContentViewCore.onFocusChanged(false, true); | 215 mContentViewCore.onFocusChanged(false, true); |
| 215 | 216 |
| 216 // Wait for the hide animation to finish. | 217 // Wait for the hide animation to finish. |
| 217 mPopupZoomer.finishPendingDraws(); | 218 mPopupZoomer.finishPendingDraws(); |
| 218 | 219 |
| 219 // Now that another view has been focused, the view should be invisible. | 220 // Now that another view has been focused, the view should be invisible. |
| 220 assertEquals(View.INVISIBLE, mPopupZoomer.getVisibility()); | 221 assertEquals(View.INVISIBLE, mPopupZoomer.getVisibility()); |
| 221 assertFalse(mPopupZoomer.isShowing()); | 222 assertFalse(mPopupZoomer.isShowing()); |
| 222 } | 223 } |
| 223 } | 224 } |
| OLD | NEW |