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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/input/RecreateInputConnectionTest.java

Issue 1278593004: Introduce ThreadedInputConnection behind a switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed ImeTest#testDoesNotHang_rendererCrashes which does not test anything Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/javatests/src/org/chromium/content/browser/input/RecreateInputConnectionTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/RecreateInputConnectionTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/RecreateInputConnectionTest.java
deleted file mode 100644
index 4083a46fffc21fcb0eaeb8ee350d209b14298576..0000000000000000000000000000000000000000
--- a/content/public/android/javatests/src/org/chromium/content/browser/input/RecreateInputConnectionTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.content.browser.input;
-
-import android.test.suitebuilder.annotation.SmallTest;
-import android.view.inputmethod.EditorInfo;
-
-import org.chromium.content.browser.ContentViewCore;
-import org.chromium.content.browser.test.util.TestInputMethodManagerWrapper;
-import org.chromium.content_shell_apk.ContentShellTestBase;
-import org.chromium.ui.base.ime.TextInputType;
-
-/**
- * Tests that when InputConnection is recreated, the text is still retained.
- */
-public class RecreateInputConnectionTest extends ContentShellTestBase {
- private ContentViewCore mContentViewCore;
- private TestImeAdapter mImeAdapter;
- private TestInputMethodManagerWrapper mInputMethodManagerWrapper;
-
- private static class TestImeAdapter extends ImeAdapter {
- public TestImeAdapter(
- InputMethodManagerWrapper immw, ImeAdapterDelegate imeAdapterDelegate) {
- super(immw, imeAdapterDelegate);
- }
- @Override
- public boolean hasTextInputType() {
- return true;
- }
- }
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- mContentViewCore = new ContentViewCore(getActivity());
- mContentViewCore.createContentViewAndroidDelegate();
- mContentViewCore.setContainerView(getActivity().getActiveShell().getContentView());
- mInputMethodManagerWrapper = new TestInputMethodManagerWrapper(mContentViewCore);
- mImeAdapter = new TestImeAdapter(mInputMethodManagerWrapper,
- new TestImeAdapterDelegate(mContentViewCore.getContainerView()));
- mImeAdapter.setInputMethodManagerWrapperForTest(
- new TestInputMethodManagerWrapper(mContentViewCore));
- mContentViewCore.setImeAdapterForTest(mImeAdapter);
- }
-
- /**
- * When creating a new InputConnection (e.g. after switching software keyboard), make sure the
- * text content in the Editable is not lost.
- */
- @SmallTest
- @RerunWithUpdatedContainerView
- public void testRecreateInputConnection() throws Exception {
- EditorInfo info = new EditorInfo();
-
- mImeAdapter.setInputTypeForTest(TextInputType.TEXT);
- mContentViewCore.onCreateInputConnection(info);
- AdapterInputConnection inputConnection = mImeAdapter.getInputConnectionForTest();
- inputConnection.updateState("Is this text restored?", 0, 0, 0, 0, true);
-
- String text = mContentViewCore.getImeAdapterForTest().getEditable().toString();
- assertEquals("Check if the initial text is stored.", "Is this text restored?", text);
-
- // Create a new InputConnection.
- EditorInfo info2 = new EditorInfo();
- mContentViewCore.onCreateInputConnection(info2);
-
- String newtext = mContentViewCore.getImeAdapterForTest().getEditable().toString();
- assertEquals("Check if the string is restored.", "Is this text restored?", newtext);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698