New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 648482 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

need to run ImeTest with and without ImeThread feature

Project Member Reported by changwan@chromium.org, Sep 20 2016

Issue description

Currently, tests are run with the default value of enabled / disabled as defined in content_features.cc and other places where features are defined.

We should be able to test both with and without features, when a feature is getting ready to be launched. We want to enable it but when launch fails for the milestone, we should be able to disable it safely.

For ImeThread feature, we'd like to run ImeTest.java with and without the feature, with some exceptions marked as @CommandLineFlags.Add("enable-features=ImeThread").

When we need to run some test with and without the feature, I hope we can annotate the test with something like the following:

@FeatureTest.EnableOnce(ContentFeatures.ImeThread)
@FeatureTest.DisableOnce(ContentFeatures.ImeThread)

And when we have a specific test that should only run with the feature, then we can annotate the test with

@FeatureTest.EnableOnce(ContentFeatures.ImeThread)


Is this feasible?

CommandLineFlags and BaseChromiumInstrumentationTestRunner has some mechanism to apply command line flags before we start a test.

And ContentShellTestBase has a mechanism to rerun a test: RerunWithUpdatedContainerView.

However, is it possible to have the combination of applying something early on and re-running a test? InstrumentationTestRunner does not seem to support rerun from Java side. Or Is it possible to replicate the test with a different option somehow?

If this annotation is not feasible, how can we test both with and without a feature?

 
It sounds like you're looking for parameterized testing. We currently support that w/ our own annotation, and it's used in a similar scenario to what you describe: for testing webview in both single-process and multi-process mode. https://codesearch.chromium.org/chromium/src/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java?rcl=0&l=56

You'd be looking for something like:

@ParameterizedTest.Set(tests = {
    @ParameterizedTest(parameters = {
        @Parameter(tag = CommandLineFlags.Parameter.PARAMETER_TAG)}),
    @ParameterizedTest(parameters = {
        @Parameter(
            tag = CommandLineFlags.Parameter.PARAMETER_TAG,
            arguments = {
                @Parameter.Argument(
                    name = CommandLineFlags.Parameter.ADD_ARG,
                    // You can use a constant here, too.
                    stringArray = {"enable-features=ImeThread"})
            }
        )}),
    })

% appropriate formatting.

Disabling would be pretty simple: just remove the annotation (or the part of the annotation that adds the enable-features=ImeThread flag).

Note that the implementation and the interface for this functionality are likely to change in the near- to medium-term with the switch to JUnit4, but we know there's a continuing need for it and will support that transition when we're ready to make it otherwise.
Summary: need to run ImeTest with and without ImeThread feature (was: need a Java annotation to test with / without a feature)
Thanks for the quick answer, John! This will perfectly serve our needs!

I've changed the title to make it specific to the ImeThread feature.
Project Member

Comment 3 by bugdroid1@chromium.org, Sep 21 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d6a84dbb67c7d6a8eb47d76a34d0e2627670f026

commit d6a84dbb67c7d6a8eb47d76a34d0e2627670f026
Author: changwan <changwan@chromium.org>
Date: Wed Sep 21 05:41:24 2016

Run IME tests with and without ImeThread feature

We are about to launch ImeThread (targeting M54), and in case we fail to
launch, we should be able to disable the feature safely.

BUG= 648482 

Review-Url: https://codereview.chromium.org/2349973008
Cr-Commit-Position: refs/heads/master@{#419980}

[modify] https://crrev.com/d6a84dbb67c7d6a8eb47d76a34d0e2627670f026/content/public/android/javatests/src/org/chromium/content/browser/input/ImeLollipopTest.java
[modify] https://crrev.com/d6a84dbb67c7d6a8eb47d76a34d0e2627670f026/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java

Status: Fixed (was: Started)

Comment 5 by yabinh@chromium.org, Oct 26 2016

Sometimes IME thread was not enabled when running ImeTest. I.E, each ImeTest ran twice, both with Ime Thread disabled.
In that case, the default content-shell-command-line is:
'_ --strict-mode=testing --disable-features=ImeThread --enable-features=ImeThread --enable-test-intents'

BTW, if it's '' or 'chrome --enable-features=ImeThread', it will work well.

Is it supposed to be that?

Sign in to add a comment