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(), ""); | |
84 | 82 |
85 final Context context = getActivity(); | 83 final Context context = getActivity(); |
86 | 84 |
87 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 85 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
88 @Override | 86 @Override |
89 public void run() { | 87 public void run() { |
90 mPopupZoomer = createPopupZoomerForTest(getInstrumentation().get
TargetContext()); | 88 mPopupZoomer = createPopupZoomerForTest(getInstrumentation().get
TargetContext()); |
91 mContentViewCore = new ContentViewCore(context, ""); | 89 mContentViewCore = new ContentViewCore(context, ""); |
92 ImeAdapter imeAdapter = new ImeAdapter(getContentViewCore().getW
ebContents(), | 90 ImeAdapter imeAdapter = new ImeAdapter( |
93 new TestInputMethodManagerWrapper(mContentViewCore), | 91 new TestInputMethodManagerWrapper(mContentViewCore), |
94 new TestImeAdapterDelegate(getContentViewCore().getConta
inerView())); | 92 new TestImeAdapterDelegate(getContentViewCore().getConta
inerView())); |
95 mContentViewCore.setSelectionPopupControllerForTesting(new Selec
tionPopupController( | 93 mContentViewCore.setSelectionPopupControllerForTesting( |
96 context, null, null, null, mContentViewCore.getRenderCoo
rdinates())); | 94 new SelectionPopupController(context, null, null, null, |
| 95 mContentViewCore.getRenderCoordinates(), imeAdap
ter)); |
97 mContentViewCore.setPopupZoomerForTest(mPopupZoomer); | 96 mContentViewCore.setPopupZoomerForTest(mPopupZoomer); |
98 mContentViewCore.setImeAdapterForTest(imeAdapter); | 97 mContentViewCore.setImeAdapterForTest(imeAdapter); |
99 } | 98 } |
100 }); | 99 }); |
101 } | 100 } |
102 | 101 |
103 @SmallTest | 102 @SmallTest |
104 @Feature({"Navigation"}) | 103 @Feature({"Navigation"}) |
105 public void testDefaultCreateState() throws Exception { | 104 public void testDefaultCreateState() throws Exception { |
106 assertEquals(View.INVISIBLE, mPopupZoomer.getVisibility()); | 105 assertEquals(View.INVISIBLE, mPopupZoomer.getVisibility()); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 mContentViewCore.onFocusChanged(false, true); | 214 mContentViewCore.onFocusChanged(false, true); |
216 | 215 |
217 // Wait for the hide animation to finish. | 216 // Wait for the hide animation to finish. |
218 mPopupZoomer.finishPendingDraws(); | 217 mPopupZoomer.finishPendingDraws(); |
219 | 218 |
220 // Now that another view has been focused, the view should be invisible. | 219 // Now that another view has been focused, the view should be invisible. |
221 assertEquals(View.INVISIBLE, mPopupZoomer.getVisibility()); | 220 assertEquals(View.INVISIBLE, mPopupZoomer.getVisibility()); |
222 assertFalse(mPopupZoomer.isShowing()); | 221 assertFalse(mPopupZoomer.isShowing()); |
223 } | 222 } |
224 } | 223 } |
OLD | NEW |