Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: content/public/android/javatests/src/org/chromium/content/browser/PopupZoomerTest.java

Issue 2931443003: Add support for Android spellcheck menu in Chrome/WebViews (Closed)
Patch Set: Simplify Mojo binding based on rockot@'s advice Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
11 import android.os.SystemClock; 11 import android.os.SystemClock;
12 import android.support.test.InstrumentationRegistry; 12 import android.support.test.InstrumentationRegistry;
13 import android.support.test.filters.SmallTest; 13 import android.support.test.filters.SmallTest;
14 import android.view.MotionEvent; 14 import android.view.MotionEvent;
15 import android.view.View; 15 import android.view.View;
16 16
17 import org.junit.Assert; 17 import org.junit.Assert;
18 import org.junit.Before; 18 import org.junit.Before;
19 import org.junit.Rule; 19 import org.junit.Rule;
20 import org.junit.Test; 20 import org.junit.Test;
21 import org.junit.runner.RunWith; 21 import org.junit.runner.RunWith;
22 22
23 import org.chromium.base.ThreadUtils; 23 import org.chromium.base.ThreadUtils;
24 import org.chromium.base.test.util.Feature; 24 import org.chromium.base.test.util.Feature;
25 import org.chromium.content.browser.input.ImeAdapter; 25 import org.chromium.content.browser.input.ImeAdapter;
26 import org.chromium.content.browser.input.TextSuggestionHost;
26 import org.chromium.content.browser.test.ContentJUnit4ClassRunner; 27 import org.chromium.content.browser.test.ContentJUnit4ClassRunner;
27 import org.chromium.content.browser.test.util.TestInputMethodManagerWrapper; 28 import org.chromium.content.browser.test.util.TestInputMethodManagerWrapper;
28 import org.chromium.content_public.browser.WebContents; 29 import org.chromium.content_public.browser.WebContents;
29 import org.chromium.content_shell_apk.ContentShellActivityTestRule; 30 import org.chromium.content_shell_apk.ContentShellActivityTestRule;
30 31
31 /** 32 /**
32 * Tests for PopupZoomer. 33 * Tests for PopupZoomer.
33 */ 34 */
34 @RunWith(ContentJUnit4ClassRunner.class) 35 @RunWith(ContentJUnit4ClassRunner.class)
35 public class PopupZoomerTest { 36 public class PopupZoomerTest {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 Context context = mActivityTestRule.getActivity(); 98 Context context = mActivityTestRule.getActivity();
98 WebContents webContents = mActivityTestRule.getContentViewCore() .getWebContents(); 99 WebContents webContents = mActivityTestRule.getContentViewCore() .getWebContents();
99 mContentViewCore = new ContentViewCore(context, ""); 100 mContentViewCore = new ContentViewCore(context, "");
100 mContentViewCore.setSelectionPopupControllerForTesting(new Selec tionPopupController( 101 mContentViewCore.setSelectionPopupControllerForTesting(new Selec tionPopupController(
101 context, null, webContents, null, mContentViewCore.getRe nderCoordinates())); 102 context, null, webContents, null, mContentViewCore.getRe nderCoordinates()));
102 mContentViewCore.setImeAdapterForTest(new ImeAdapter(webContents , 103 mContentViewCore.setImeAdapterForTest(new ImeAdapter(webContents ,
103 mActivityTestRule.getContentViewCore().getContainerView( ), 104 mActivityTestRule.getContentViewCore().getContainerView( ),
104 new TestInputMethodManagerWrapper(mContentViewCore))); 105 new TestInputMethodManagerWrapper(mContentViewCore)));
105 mPopupZoomer = createPopupZoomerForTest(InstrumentationRegistry. getTargetContext()); 106 mPopupZoomer = createPopupZoomerForTest(InstrumentationRegistry. getTargetContext());
106 mContentViewCore.setPopupZoomerForTest(mPopupZoomer); 107 mContentViewCore.setPopupZoomerForTest(mPopupZoomer);
108 mContentViewCore.setTextSuggestionHostForTesting(new TextSuggest ionHost(context,
109 webContents, mActivityTestRule.getContentViewCore().getC ontainerView(),
110 mContentViewCore, mContentViewCore.getRenderCoordinates( )));
107 } 111 }
108 }); 112 });
109 } 113 }
110 114
111 @Test 115 @Test
112 @SmallTest 116 @SmallTest
113 @Feature({"Navigation"}) 117 @Feature({"Navigation"})
114 public void testDefaultCreateState() throws Exception { 118 public void testDefaultCreateState() throws Exception {
115 Assert.assertEquals(View.INVISIBLE, mPopupZoomer.getVisibility()); 119 Assert.assertEquals(View.INVISIBLE, mPopupZoomer.getVisibility());
116 Assert.assertFalse(mPopupZoomer.isShowing()); 120 Assert.assertFalse(mPopupZoomer.isShowing());
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 mContentViewCore.onFocusChanged(false, true); 234 mContentViewCore.onFocusChanged(false, true);
231 235
232 // Wait for the hide animation to finish. 236 // Wait for the hide animation to finish.
233 mPopupZoomer.finishPendingDraws(); 237 mPopupZoomer.finishPendingDraws();
234 238
235 // Now that another view has been focused, the view should be invisible. 239 // Now that another view has been focused, the view should be invisible.
236 Assert.assertEquals(View.INVISIBLE, mPopupZoomer.getVisibility()); 240 Assert.assertEquals(View.INVISIBLE, mPopupZoomer.getVisibility());
237 Assert.assertFalse(mPopupZoomer.isShowing()); 241 Assert.assertFalse(mPopupZoomer.isShowing());
238 } 242 }
239 } 243 }
OLDNEW
« no previous file with comments | « content/public/android/java/strings/android_content_strings.grd ('k') | content/public/app/mojo/content_browser_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698