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; ...@@ -16,6 +16,7 @@ import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner; import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
import org.chromium.content_public.browser.test.util.TestInputMethodManagerWrapper; import org.chromium.content_public.browser.test.util.TestInputMethodManagerWrapper;
...@@ -24,6 +25,7 @@ import org.chromium.content_public.browser.test.util.TestInputMethodManagerWrapp ...@@ -24,6 +25,7 @@ import org.chromium.content_public.browser.test.util.TestInputMethodManagerWrapp
* Test for {@link CursorAnchorInfoController}. * Test for {@link CursorAnchorInfoController}.
*/ */
@RunWith(ContentJUnit4ClassRunner.class) @RunWith(ContentJUnit4ClassRunner.class)
@Batch(Batch.UNIT_TESTS)
public class CursorAnchorInfoControllerTest { public class CursorAnchorInfoControllerTest {
private static final class TestViewDelegate implements CursorAnchorInfoController.ViewDelegate { private static final class TestViewDelegate implements CursorAnchorInfoController.ViewDelegate {
public int locationX; public int locationX;
......
...@@ -8,12 +8,14 @@ import android.view.inputmethod.EditorInfo; ...@@ -8,12 +8,14 @@ import android.view.inputmethod.EditorInfo;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner; import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
...@@ -21,6 +23,7 @@ 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. * IME (input method editor) and text input tests.
*/ */
@RunWith(ContentJUnit4ClassRunner.class) @RunWith(ContentJUnit4ClassRunner.class)
@Batch(ImeTest.IME_BATCH)
public class ImeAutocapitalizeTest { public class ImeAutocapitalizeTest {
static final String AUTOCAPITALIZE_HTML = "content/test/data/android/input/autocapitalize.html"; static final String AUTOCAPITALIZE_HTML = "content/test/data/android/input/autocapitalize.html";
...@@ -32,6 +35,11 @@ public class ImeAutocapitalizeTest { ...@@ -32,6 +35,11 @@ public class ImeAutocapitalizeTest {
mRule.setUpForUrl(AUTOCAPITALIZE_HTML); mRule.setUpForUrl(AUTOCAPITALIZE_HTML);
} }
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test @Test
@SmallTest @SmallTest
@Feature({"TextInput"}) @Feature({"TextInput"})
......
...@@ -8,12 +8,14 @@ import android.view.inputmethod.EditorInfo; ...@@ -8,12 +8,14 @@ import android.view.inputmethod.EditorInfo;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner; import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
import org.chromium.ui.base.ime.TextInputAction; import org.chromium.ui.base.ime.TextInputAction;
...@@ -23,6 +25,7 @@ import org.chromium.ui.base.ime.TextInputType; ...@@ -23,6 +25,7 @@ import org.chromium.ui.base.ime.TextInputType;
* IME (input method editor) and text input tests for enterkeyhint attribute. * IME (input method editor) and text input tests for enterkeyhint attribute.
*/ */
@RunWith(ContentJUnit4ClassRunner.class) @RunWith(ContentJUnit4ClassRunner.class)
@Batch(ImeTest.IME_BATCH)
public class ImeInputActionTest { public class ImeInputActionTest {
@Rule @Rule
public ImeActivityTestRule mRule = new ImeActivityTestRule(); public ImeActivityTestRule mRule = new ImeActivityTestRule();
...@@ -32,6 +35,11 @@ public class ImeInputActionTest { ...@@ -32,6 +35,11 @@ public class ImeInputActionTest {
mRule.setUpForUrl(ImeActivityTestRule.INPUT_ACTION_HTML); 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) private void checkInputAction(String elementId, int type, int textAction, int editorAction)
throws Throwable { throws Throwable {
mRule.focusElement(elementId); mRule.focusElement(elementId);
......
...@@ -9,12 +9,14 @@ import android.view.inputmethod.EditorInfo; ...@@ -9,12 +9,14 @@ import android.view.inputmethod.EditorInfo;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.blink_public.web.WebTextInputMode; import org.chromium.blink_public.web.WebTextInputMode;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner; import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
...@@ -24,6 +26,7 @@ import org.chromium.ui.base.ime.TextInputType; ...@@ -24,6 +26,7 @@ import org.chromium.ui.base.ime.TextInputType;
* IME (input method editor) and text input tests for input-mode attribute. * IME (input method editor) and text input tests for input-mode attribute.
*/ */
@RunWith(ContentJUnit4ClassRunner.class) @RunWith(ContentJUnit4ClassRunner.class)
@Batch(ImeTest.IME_BATCH)
public class ImeInputModeTest { public class ImeInputModeTest {
@Rule @Rule
public ImeActivityTestRule mRule = new ImeActivityTestRule(); public ImeActivityTestRule mRule = new ImeActivityTestRule();
...@@ -33,6 +36,11 @@ public class ImeInputModeTest { ...@@ -33,6 +36,11 @@ public class ImeInputModeTest {
mRule.setUpForUrl(ImeActivityTestRule.INPUT_MODE_HTML); mRule.setUpForUrl(ImeActivityTestRule.INPUT_MODE_HTML);
} }
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test @Test
@SmallTest @SmallTest
@Feature({"TextInput"}) @Feature({"TextInput"})
......
...@@ -6,12 +6,14 @@ package org.chromium.content.browser.input; ...@@ -6,12 +6,14 @@ package org.chromium.content.browser.input;
import androidx.test.filters.MediumTest; import androidx.test.filters.MediumTest;
import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; 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.CommandLineFlags;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils; import org.chromium.base.test.util.UrlUtils;
...@@ -24,6 +26,7 @@ import org.chromium.content_public.browser.test.util.JavaScriptUtils; ...@@ -24,6 +26,7 @@ import org.chromium.content_public.browser.test.util.JavaScriptUtils;
*/ */
@RunWith(ContentJUnit4ClassRunner.class) @RunWith(ContentJUnit4ClassRunner.class)
@CommandLineFlags.Add({"enable-blink-features=VirtualKeyboard", "expose-internals-for-testing"}) @CommandLineFlags.Add({"enable-blink-features=VirtualKeyboard", "expose-internals-for-testing"})
@Batch(ImeTest.IME_BATCH)
public class ImeInputVKApiTest { public class ImeInputVKApiTest {
@Rule @Rule
public ImeActivityTestRule mRule = new ImeActivityTestRule(); public ImeActivityTestRule mRule = new ImeActivityTestRule();
...@@ -35,6 +38,11 @@ public class ImeInputVKApiTest { ...@@ -35,6 +38,11 @@ public class ImeInputVKApiTest {
mRule.setUpForUrl(ImeActivityTestRule.INPUT_VK_API_HTML); mRule.setUpForUrl(ImeActivityTestRule.INPUT_VK_API_HTML);
} }
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test @Test
@MediumTest @MediumTest
@Feature({"VKShowAndHide", "Main"}) @Feature({"VKShowAndHide", "Main"})
......
...@@ -10,12 +10,14 @@ import android.view.inputmethod.InputConnection; ...@@ -10,12 +10,14 @@ import android.view.inputmethod.InputConnection;
import androidx.test.filters.MediumTest; import androidx.test.filters.MediumTest;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner; import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.Criteria;
...@@ -28,6 +30,7 @@ import java.util.concurrent.Callable; ...@@ -28,6 +30,7 @@ import java.util.concurrent.Callable;
* Integration tests for text input for Android L (or above) features. * Integration tests for text input for Android L (or above) features.
*/ */
@RunWith(ContentJUnit4ClassRunner.class) @RunWith(ContentJUnit4ClassRunner.class)
@Batch(ImeTest.IME_BATCH)
public class ImeLollipopTest { public class ImeLollipopTest {
@Rule @Rule
public ImeActivityTestRule mRule = new ImeActivityTestRule(); public ImeActivityTestRule mRule = new ImeActivityTestRule();
...@@ -37,6 +40,11 @@ public class ImeLollipopTest { ...@@ -37,6 +40,11 @@ public class ImeLollipopTest {
mRule.setUpForUrl(ImeActivityTestRule.INPUT_FORM_HTML); mRule.setUpForUrl(ImeActivityTestRule.INPUT_FORM_HTML);
} }
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test @Test
@MediumTest @MediumTest
@Feature({"TextInput"}) @Feature({"TextInput"})
......
...@@ -8,12 +8,14 @@ import android.text.InputType; ...@@ -8,12 +8,14 @@ import android.text.InputType;
import androidx.test.filters.MediumTest; import androidx.test.filters.MediumTest;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; 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.CommandLineFlags;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner; import org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;
...@@ -24,6 +26,7 @@ import org.chromium.content_public.browser.test.util.JavaScriptUtils; ...@@ -24,6 +26,7 @@ import org.chromium.content_public.browser.test.util.JavaScriptUtils;
*/ */
@RunWith(ContentJUnit4ClassRunner.class) @RunWith(ContentJUnit4ClassRunner.class)
@CommandLineFlags.Add({"expose-internals-for-testing"}) @CommandLineFlags.Add({"expose-internals-for-testing"})
@Batch(ImeTest.IME_BATCH)
public class ImePasswordTest { public class ImePasswordTest {
@Rule @Rule
public ImeActivityTestRule mRule = new ImeActivityTestRule(); public ImeActivityTestRule mRule = new ImeActivityTestRule();
...@@ -33,6 +36,11 @@ public class ImePasswordTest { ...@@ -33,6 +36,11 @@ public class ImePasswordTest {
mRule.setUpForUrl(ImeActivityTestRule.PASSWORD_FORM_HTML); mRule.setUpForUrl(ImeActivityTestRule.PASSWORD_FORM_HTML);
} }
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test @Test
@MediumTest @MediumTest
@Feature({"TextInput", "Main"}) @Feature({"TextInput", "Main"})
......
...@@ -22,6 +22,7 @@ import androidx.test.filters.MediumTest; ...@@ -22,6 +22,7 @@ import androidx.test.filters.MediumTest;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
...@@ -29,6 +30,7 @@ import org.junit.Test; ...@@ -29,6 +30,7 @@ import org.junit.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith; 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.CommandLineFlags;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils; import org.chromium.base.test.util.UrlUtils;
...@@ -51,7 +53,12 @@ import java.util.concurrent.TimeoutException; ...@@ -51,7 +53,12 @@ import java.util.concurrent.TimeoutException;
*/ */
@RunWith(ContentJUnit4ClassRunner.class) @RunWith(ContentJUnit4ClassRunner.class)
@CommandLineFlags.Add({"expose-internals-for-testing"}) @CommandLineFlags.Add({"expose-internals-for-testing"})
@Batch(ImeTest.IME_BATCH)
public class ImeTest { 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 @Rule
public ImeActivityTestRule mRule = new ImeActivityTestRule(); public ImeActivityTestRule mRule = new ImeActivityTestRule();
@Rule @Rule
...@@ -62,6 +69,11 @@ public class ImeTest { ...@@ -62,6 +69,11 @@ public class ImeTest {
mRule.setUpForUrl(ImeActivityTestRule.INPUT_FORM_HTML); mRule.setUpForUrl(ImeActivityTestRule.INPUT_FORM_HTML);
} }
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test @Test
@MediumTest @MediumTest
@Feature({"TextInput", "Main"}) @Feature({"TextInput", "Main"})
......
...@@ -15,6 +15,7 @@ import org.junit.Test; ...@@ -15,6 +15,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.content.browser.picker.InputDialogContainer; import org.chromium.content.browser.picker.InputDialogContainer;
import org.chromium.ui.base.ime.TextInputType; import org.chromium.ui.base.ime.TextInputType;
...@@ -23,6 +24,7 @@ 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. * Unittests for the {@link org.chromium.content.browser.picker.InputDialogContainer} class.
*/ */
@RunWith(BaseJUnit4ClassRunner.class) @RunWith(BaseJUnit4ClassRunner.class)
@Batch(Batch.UNIT_TESTS)
public class InputDialogContainerTest { public class InputDialogContainerTest {
// Defined in third_party/WebKit/Source/platform/DateComponents.h // Defined in third_party/WebKit/Source/platform/DateComponents.h
private static final double DATE_DIALOG_DEFAULT_MIN = -62135596800000.0; private static final double DATE_DIALOG_DEFAULT_MIN = -62135596800000.0;
......
...@@ -14,12 +14,14 @@ import android.widget.TextView; ...@@ -14,12 +14,14 @@ import android.widget.TextView;
import androidx.test.filters.LargeTest; import androidx.test.filters.LargeTest;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; 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.CommandLineFlags;
import org.chromium.content.R; import org.chromium.content.R;
import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContents;
...@@ -39,6 +41,7 @@ import java.util.concurrent.TimeoutException; ...@@ -39,6 +41,7 @@ import java.util.concurrent.TimeoutException;
*/ */
@RunWith(ContentJUnit4ClassRunner.class) @RunWith(ContentJUnit4ClassRunner.class)
@CommandLineFlags.Add({"expose-internals-for-testing"}) @CommandLineFlags.Add({"expose-internals-for-testing"})
@Batch(ImeTest.IME_BATCH)
public class TextSuggestionMenuTest { public class TextSuggestionMenuTest {
private static final String URL = private static final String URL =
"data:text/html, <div contenteditable id=\"div\" /><span id=\"span\" />"; "data:text/html, <div contenteditable id=\"div\" /><span id=\"span\" />";
...@@ -52,6 +55,11 @@ public class TextSuggestionMenuTest { ...@@ -52,6 +55,11 @@ public class TextSuggestionMenuTest {
mRule.fullyLoadUrl(URL); mRule.fullyLoadUrl(URL);
} }
@After
public void tearDown() throws Exception {
mRule.getActivity().finish();
}
@Test @Test
@LargeTest @LargeTest
public void testDeleteWordMarkedWithSuggestionMarker() 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