Commit 62726fde authored by Michael Thiessen's avatar Michael Thiessen Committed by Commit Bot

Batch IME Instrumentation Tests

Batched the tests into either UNIT_TESTS or a shared IME_BATCH batch.

Further performance improvements could be gained by reusing the content
shell across tests, but while that looks possible it's not trivial so
I'll leave that as a TODO.

Bug: 989569
Change-Id: Idea445a7338ad669078732ac9e9822f7122a84a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2427067Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809993}
parent 2a4eb49a
......@@ -16,6 +16,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
import org.chromium.content_public.browser.test.util.TestInputMethodManagerWrapper;
......@@ -24,6 +25,7 @@ import org.chromium.content_public.browser.test.util.TestInputMethodManagerWrapp
* Test for {@link CursorAnchorInfoController}.
*/
@RunWith(ContentJUnit4ClassRunner.class)
@Batch(Batch.UNIT_TESTS)
public class CursorAnchorInfoControllerTest {
private static final class TestViewDelegate implements CursorAnchorInfoController.ViewDelegate {
public int locationX;
......
......@@ -8,12 +8,14 @@ import android.view.inputmethod.EditorInfo;
import androidx.test.filters.SmallTest;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
......@@ -21,6 +23,7 @@ import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
* IME (input method editor) and text input tests.
*/
@RunWith(ContentJUnit4ClassRunner.class)
@Batch(ImeTest.IME_BATCH)
public class ImeAutocapitalizeTest {
static final String AUTOCAPITALIZE_HTML = "content/test/data/android/input/autocapitalize.html";
......@@ -32,6 +35,11 @@ public class ImeAutocapitalizeTest {
mRule.setUpForUrl(AUTOCAPITALIZE_HTML);
}
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test
@SmallTest
@Feature({"TextInput"})
......
......@@ -8,12 +8,14 @@ import android.view.inputmethod.EditorInfo;
import androidx.test.filters.SmallTest;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
import org.chromium.ui.base.ime.TextInputAction;
......@@ -23,6 +25,7 @@ import org.chromium.ui.base.ime.TextInputType;
* IME (input method editor) and text input tests for enterkeyhint attribute.
*/
@RunWith(ContentJUnit4ClassRunner.class)
@Batch(ImeTest.IME_BATCH)
public class ImeInputActionTest {
@Rule
public ImeActivityTestRule mRule = new ImeActivityTestRule();
......@@ -32,6 +35,11 @@ public class ImeInputActionTest {
mRule.setUpForUrl(ImeActivityTestRule.INPUT_ACTION_HTML);
}
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
private void checkInputAction(String elementId, int type, int textAction, int editorAction)
throws Throwable {
mRule.focusElement(elementId);
......
......@@ -9,12 +9,14 @@ import android.view.inputmethod.EditorInfo;
import androidx.test.filters.SmallTest;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature;
import org.chromium.blink_public.web.WebTextInputMode;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
......@@ -24,6 +26,7 @@ import org.chromium.ui.base.ime.TextInputType;
* IME (input method editor) and text input tests for input-mode attribute.
*/
@RunWith(ContentJUnit4ClassRunner.class)
@Batch(ImeTest.IME_BATCH)
public class ImeInputModeTest {
@Rule
public ImeActivityTestRule mRule = new ImeActivityTestRule();
......@@ -33,6 +36,11 @@ public class ImeInputModeTest {
mRule.setUpForUrl(ImeActivityTestRule.INPUT_MODE_HTML);
}
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test
@SmallTest
@Feature({"TextInput"})
......
......@@ -6,12 +6,14 @@ package org.chromium.content.browser.input;
import androidx.test.filters.MediumTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils;
......@@ -24,6 +26,7 @@ import org.chromium.content_public.browser.test.util.JavaScriptUtils;
*/
@RunWith(ContentJUnit4ClassRunner.class)
@CommandLineFlags.Add({"enable-blink-features=VirtualKeyboard", "expose-internals-for-testing"})
@Batch(ImeTest.IME_BATCH)
public class ImeInputVKApiTest {
@Rule
public ImeActivityTestRule mRule = new ImeActivityTestRule();
......@@ -35,6 +38,11 @@ public class ImeInputVKApiTest {
mRule.setUpForUrl(ImeActivityTestRule.INPUT_VK_API_HTML);
}
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test
@MediumTest
@Feature({"VKShowAndHide", "Main"})
......
......@@ -10,12 +10,14 @@ import android.view.inputmethod.InputConnection;
import androidx.test.filters.MediumTest;
import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
import org.chromium.content_public.browser.test.util.Criteria;
......@@ -28,6 +30,7 @@ import java.util.concurrent.Callable;
* Integration tests for text input for Android L (or above) features.
*/
@RunWith(ContentJUnit4ClassRunner.class)
@Batch(ImeTest.IME_BATCH)
public class ImeLollipopTest {
@Rule
public ImeActivityTestRule mRule = new ImeActivityTestRule();
......@@ -37,6 +40,11 @@ public class ImeLollipopTest {
mRule.setUpForUrl(ImeActivityTestRule.INPUT_FORM_HTML);
}
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test
@MediumTest
@Feature({"TextInput"})
......
......@@ -8,12 +8,14 @@ import android.text.InputType;
import androidx.test.filters.MediumTest;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
......@@ -24,6 +26,7 @@ import org.chromium.content_public.browser.test.util.JavaScriptUtils;
*/
@RunWith(ContentJUnit4ClassRunner.class)
@CommandLineFlags.Add({"expose-internals-for-testing"})
@Batch(ImeTest.IME_BATCH)
public class ImePasswordTest {
@Rule
public ImeActivityTestRule mRule = new ImeActivityTestRule();
......@@ -33,6 +36,11 @@ public class ImePasswordTest {
mRule.setUpForUrl(ImeActivityTestRule.PASSWORD_FORM_HTML);
}
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test
@MediumTest
@Feature({"TextInput", "Main"})
......
......@@ -22,6 +22,7 @@ import androidx.test.filters.MediumTest;
import androidx.test.filters.SmallTest;
import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
......@@ -29,6 +30,7 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils;
......@@ -51,7 +53,12 @@ import java.util.concurrent.TimeoutException;
*/
@RunWith(ContentJUnit4ClassRunner.class)
@CommandLineFlags.Add({"expose-internals-for-testing"})
@Batch(ImeTest.IME_BATCH)
public class ImeTest {
/* package */ static final String IME_BATCH = "ImeTestBatch";
// TODO(https://crbug.com/989569): Find a way to re-use the content shell
// across tests?
@Rule
public ImeActivityTestRule mRule = new ImeActivityTestRule();
@Rule
......@@ -62,6 +69,11 @@ public class ImeTest {
mRule.setUpForUrl(ImeActivityTestRule.INPUT_FORM_HTML);
}
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test
@MediumTest
@Feature({"TextInput", "Main"})
......
......@@ -15,6 +15,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.picker.InputDialogContainer;
import org.chromium.ui.base.ime.TextInputType;
......@@ -23,6 +24,7 @@ import org.chromium.ui.base.ime.TextInputType;
* Unittests for the {@link org.chromium.content.browser.picker.InputDialogContainer} class.
*/
@RunWith(BaseJUnit4ClassRunner.class)
@Batch(Batch.UNIT_TESTS)
public class InputDialogContainerTest {
// Defined in third_party/WebKit/Source/platform/DateComponents.h
private static final double DATE_DIALOG_DEFAULT_MIN = -62135596800000.0;
......
......@@ -14,12 +14,14 @@ import android.widget.TextView;
import androidx.test.filters.LargeTest;
import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.content.R;
import org.chromium.content_public.browser.WebContents;
......@@ -39,6 +41,7 @@ import java.util.concurrent.TimeoutException;
*/
@RunWith(ContentJUnit4ClassRunner.class)
@CommandLineFlags.Add({"expose-internals-for-testing"})
@Batch(ImeTest.IME_BATCH)
public class TextSuggestionMenuTest {
private static final String URL =
"data:text/html, <div contenteditable id=\"div\" /><span id=\"span\" />";
......@@ -52,6 +55,11 @@ public class TextSuggestionMenuTest {
mRule.fullyLoadUrl(URL);
}
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test
@LargeTest
public void testDeleteWordMarkedWithSuggestionMarker()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment