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

Issue 628964 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug

Blocked on:
issue 659869



Sign in to add a comment

Some IME tests are flaky

Project Member Reported by yabinh@chromium.org, Jul 18 2016

Issue description

2 tests in IME tests are flaky:

ImeTest#testImeStaysOnLongPressingDifferentNonEmptyInputs
Failure rate: ~ 30/400

ImeTest#testInputTextEvents_DeleteSurroundingText
Failure rate: ~ 8/400


C  369.748s Main  [FAIL] org.chromium.content.browser.input.ImeTest#testImeStaysOnLongPressingDifferentNonEmptyInputs:
C  369.748s Main  junit.framework.AssertionFailedError: Values did not match. Expected: true, actual: false
C  369.748s Main  	at org.chromium.content.browser.test.util.CriteriaHelper.pollInstrumentationThread(CriteriaHelper.java:74)
C  369.748s Main  	at org.chromium.content.browser.test.util.CriteriaHelper.pollUiThread(CriteriaHelper.java:112)
C  369.748s Main  	at org.chromium.content.browser.test.util.CriteriaHelper.pollUiThread(CriteriaHelper.java:133)
C  369.748s Main  	at org.chromium.content.browser.input.ImeTest.assertWaitForSelectActionBarStatus(ImeTest.java:1367)
C  369.748s Main  	at org.chromium.content.browser.input.ImeTest.testImeStaysOnLongPressingDifferentNonEmptyInputs(ImeTest.java:571)
C  369.748s Main  	at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
C  369.748s Main  	at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
C  369.748s Main  	at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
C  369.748s Main  	at org.chromium.content_shell_apk.ContentShellTestBase.runTest(ContentShellTestBase.java:233)
--
C  369.748s Main  	at org.chromium.base.test.BaseTestResult.run(BaseTestResult.java:124)
C  369.748s Main  	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
C  369.748s Main  	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
C  369.748s Main  	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
C  369.748s Main  	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1879)


C  388.068s Main  [FAIL] org.chromium.content.browser.input.ImeTest#testInputTextEvents_DeleteSurroundingText:
C  388.068s Main  junit.framework.AssertionFailedError: "keydown(229),input,selectionchange,selectionchange,keyup(229)"
C  388.068s Main  	at org.chromium.content.browser.test.util.CriteriaHelper.pollInstrumentationThread(CriteriaHelper.java:74)
C  388.068s Main  	at org.chromium.content.browser.test.util.CriteriaHelper.pollInstrumentationThread(CriteriaHelper.java:89)
C  388.068s Main  	at org.chromium.content.browser.input.ImeTest.waitForEventLogs(ImeTest.java:1246)
C  388.069s Main  	at org.chromium.content.browser.input.ImeTest.testInputTextEvents_DeleteSurroundingText(ImeTest.java:1232)
C  388.069s Main  	at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
C  388.069s Main  	at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
C  388.069s Main  	at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
C  388.069s Main  	at org.chromium.content_shell_apk.ContentShellTestBase.runTest(ContentShellTestBase.java:233)
C  388.069s Main  	at org.chromium.base.test.BaseTestResult.runParameterized(BaseTestResult.java:161)
C  388.069s Main  	at org.chromium.base.test.BaseTestResult.run(BaseTestResult.java:124)
C  388.069s Main  	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
C  388.069s Main  	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
C  388.069s Main  	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
C  388.069s Main  	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1879)
 

Comment 1 by yabinh@chromium.org, Aug 19 2016

 Issue 639127  has been merged into this issue.
Labels: -Pri-3 Pri-2
Owner: yabinh@chromium.org
Status: Assigned (was: Untriaged)
I sometimes run into testImeStaysOnLongPressingDifferentNonEmptyInputs tests failure. yabinh@, could you take a look?

Labels: OS-Android

Checked http://test-results.appspot.com/dashboards/flakiness_dashboard.html#showAllRuns=true&testType=content_shell_test_apk&tests=imetest

testImeStaysOnLongPressingDifferentNonEmptyInputs is flaky.
test*Events* are flaky.

As for other tests, I only checked some of them randomly, and found all the failures lie in setUp(), for example:

I  353.729s run_tests_on_device(009ef58c4b14b7bb)    Failure in testImePaste:
I  353.729s run_tests_on_device(009ef58c4b14b7bb)    junit.framework.AssertionFailedError: input connection should not be null.
I  353.729s run_tests_on_device(009ef58c4b14b7bb)    	at org.chromium.content.browser.test.util.CriteriaHelper.pollInstrumentationThread(CriteriaHelper.java:74)
I  353.729s run_tests_on_device(009ef58c4b14b7bb)    	at org.chromium.content.browser.test.util.CriteriaHelper.pollUiThread(CriteriaHelper.java:112)
I  353.729s run_tests_on_device(009ef58c4b14b7bb)    	at org.chromium.content.browser.test.util.CriteriaHelper.pollUiThread(CriteriaHelper.java:133)
I  353.729s run_tests_on_device(009ef58c4b14b7bb)    	at org.chromium.content.browser.input.ImeTest.assertWaitForKeyboardStatus(ImeTest.java:1373)
I  353.729s run_tests_on_device(009ef58c4b14b7bb)    	at org.chromium.content.browser.input.ImeTest.setUp(ImeTest.java:78)
I  353.729s run_tests_on_device(009ef58c4b14b7bb)    	at org.chromium.base.test.BaseTestResult.runParameterized(BaseTestResult.java:161)
I  353.729s run_tests_on_device(009ef58c4b14b7bb)    	at org.chromium.base.test.BaseTestResult.run(BaseTestResult.java:124)
I  353.729s run_tests_on_device(009ef58c4b14b7bb)    	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
I  353.729s run_tests_on_device(009ef58c4b14b7bb)    	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
I  353.729s run_tests_on_device(009ef58c4b14b7bb)    	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
I  353.729s run_tests_on_device(009ef58c4b14b7bb)    	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)

The above case could happen to every IME test.

Labels: -Pri-2 M-56 Pri-1
Marking as P1 as flaky tests have been disabled on trybots - now there are higher chances that a regression may be introduced.
Project Member

Comment 7 by bugdroid1@chromium.org, Sep 20 2016

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

commit f1522380549d64191081ef505466c43d32816b68
Author: yabinh <yabinh@chromium.org>
Date: Tue Sep 20 10:12:29 2016

Fix flaky ImeTest#testImeStaysOnLongPressingDifferentNonEmptyInputs

commitText() runs on ImeThread and focusNode() runs on UIThread, which
causes a race condition. We should make sure that focusNode() runs after
commitText() finished.

BUG= 628964 ,  646231 

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

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

Cc: amaralp@chromium.org
Pedro said that he saw the following stack trace in setup. Could you also investigate this?

[FAIL] org.chromium.content.browser.input.ImeTest#testContentEditableEvents_DeleteSurroundingText:
C   21.944s Main  junit.framework.AssertionFailedError: Failed to retrieve bounds for element: document.getElementById('input_text')
C   21.944s Main        at org.chromium.content.browser.test.util.DOMUtils.getNodeBoundsByJs(DOMUtils.java:499)
C   21.944s Main        at org.chromium.content.browser.test.util.DOMUtils.getNodeBounds(DOMUtils.java:186)
C   21.944s Main        at org.chromium.content.browser.test.util.DOMUtils$3.isSatisfied(DOMUtils.java:353)
C   21.944s Main        at org.chromium.content.browser.test.util.CriteriaHelper.pollInstrumentationThread(CriteriaHelper.java:68)
C   21.944s Main        at org.chromium.content.browser.test.util.CriteriaHelper.pollInstrumentationThread(CriteriaHelper.java:89)
C   21.944s Main        at org.chromium.content.browser.test.util.DOMUtils.waitForNonZeroNodeBounds(DOMUtils.java:349)
C   21.944s Main        at org.chromium.content.browser.input.ImeTest.setUp(ImeTest.java:78)
C   21.945s Main        at org.chromium.base.test.BaseTestResult.runParameterized(BaseTestResult.java:161)
C   21.945s Main        at org.chromium.base.test.BaseTestResult.run(BaseTestResult.java:124)
C   21.945s Main        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
C   21.945s Main        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
C   21.945s Main        at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
C   21.945s Main        at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1879)

Comment 9 by yabinh@chromium.org, Sep 21 2016

Pedro, can you provide more details? 

By the way, if content shell runs on a phone for the first time, it may not have the permission to read or write files. In that case, you can enable it manually.

Comment 10 by donnd@chromium.org, Sep 21 2016

Cc: pedrosim...@chromium.org
Pedro, do you remember #8?
I think they are referring to another Pedro (amaralp@) ;)
Yabin, I'm trying to run the ImeTest, testContentEditableEvents_DeleteSurroundingText, locally on my Nexus 6P but am running into problem during set up. The problem occurs on line 78 of ImeTest.java.

I may not have enabled reading or writing files on my device. Do you know how I can check?
Cc: -pedrosim...@chromium.org
Go to Settings->Apps->Content Shell->Permissions->Storage

If the failure rate is 100% and it also happens to other IME tests, then I'm pretty sure it's the permission problem. If not, please let me know.

Comment 15 by loyso@chromium.org, Sep 22 2016

Cc: -yabinh@chromium.org
Components: Tests>Flaky
testContentEditableEvents_SetComposingText is also flaky:
https://build.chromium.org/p/chromium.linux/builders/Android%20Tests/builds/32303
https://build.chromium.org/p/chromium.linux/builders/Android%20Tests/builds/32300
Project Member

Comment 16 by bugdroid1@chromium.org, Sep 22 2016

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

commit 611dec311f31ead13d9c8648febc34dad1409c38
Author: aelias <aelias@chromium.org>
Date: Thu Sep 22 23:39:49 2016

Disable flaky Android IME and selection tests.

These tests (*all* Selection tests, and a few of the IME tests) are
extremely flaky to the point that they often cause waterfall redness
despite @RetryOnFailure.  These areas are actively owned (amaralp@ owns
Android selection, and changwan@/yabinh@ own Android IME) and we plan to
circle back to reenable without @RetryOnFailure when they have been
fully deflaked.

The @FlakyTest annotation is deprecated so also replace existing uses of
it with @DisabledTest, and secondly don't comment out the other
annotations which seems to be unnecessary nowadays.

BUG= 649411 , 628964 , 592428 

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

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

I can get the error in comment#5:
Press the power button (the screen will sleep), and run the test. The failure rate is 100%.

Still investigating it.
The call stack is like:

The screen is locked -->
"input_text" isn't focused after calling DOMUtils.clickNode(this, mContentViewCore, "input_text") in ImeTest#setUp() -->
ImeAdapter#focusedNodeChanged is not called -->
ImeAdapter#restartInput is not called -->
mInputConnection == null

BTW, I've never seen this locally if I don't lock the screen.
As we talked offline, could you add assertions to clickNode() in ImeTest and some other places if you're suspicious of screen lock or some other click issue?
Project Member

Comment 20 by bugdroid1@chromium.org, Oct 14 2016

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

commit 52b14230af2ce6806a3ec1006e4b76a65b1d7db9
Author: yabinh <yabinh@chromium.org>
Date: Fri Oct 14 00:03:23 2016

Check whether touch event was dispatched succussfully in Ime Test.

Ime tests are flaky on trybot for the same reason: input conneciton is
null. The only way we found to repro it locally is to lock the screen
before running the test. In that case, the node is not focused, and it
fails to dispatch touch event. So we add assertion in Ime test to
check whether that's the case.

BUG= 628964 

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

[modify] https://crrev.com/52b14230af2ce6806a3ec1006e4b76a65b1d7db9/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
[modify] https://crrev.com/52b14230af2ce6806a3ec1006e4b76a65b1d7db9/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java
[modify] https://crrev.com/52b14230af2ce6806a3ec1006e4b76a65b1d7db9/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TouchCommon.java

Project Member

Comment 21 by bugdroid1@chromium.org, Oct 24 2016

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

commit d57d3f344c2526792bd5aa74e925e4c16a3bff9c
Author: yabinh <yabinh@chromium.org>
Date: Mon Oct 24 07:02:09 2016

Check whether screen is on when it fails to click node in ImeTest.

Sometimes ImeTest failed because it failed to click node. We suspect it's
because the screen is locked. So we add assertion to check whether that's
the case.

BUG= 628964 

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

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

Found several flaky tests, which all seem to be caused by racing condition. I'll upload a patch to fix it.

Tests failed at assertEquals(InputType.TYPE_TEXT_FLAG_CAP_WORDS,   assertEquals(InputType.TYPE_TEXT_FLAG_CAP_WORDS,getCursorCapsMode(InputType.TYPE_TEXT_FLAG_CAP_WORDS))

testGetCursorCapsMode
https://build.chromium.org/p/chromium.android/builders/Android%20Swarm%20Builder/builds/9363


Tests failed at assertWaitForSelectActionBarStatus():

testKeyboardNotDismissedAfterCopySelection
https://build.chromium.org/p/chromium.fyi/builders/Android%20Cloud%20Tests/builds/5682

testImeNotDismissedAfterCutSelection
https://build.chromium.org/p/chromium.android/builders/Lollipop%20Consumer%20Tester/builds/2645

testImeStaysOnLongPressingDifferentNonEmptyInputs
https://build.chromium.org/p/chromium.android/builders/Jelly%20Bean%20Tester/builds/6422

testLongPressInputWhileComposingText
https://build.chromium.org/p/chromium.fyi/builders/Android%20Cloud%20Tests/builds/5678

testSelectionClearedOnKeyEvent
https://build.chromium.org/p/chromium.android/builders/Lollipop%20Consumer%20Tester/builds/2597

testSelectActionBarShownOnLongPressingInput
https://build.chromium.org/p/chromium.android/builders/Lollipop%20Consumer%20Tester/builds/2345

testImeShownWhenLongPressOnAlreadySelectedText
https://build.chromium.org/p/chromium.fyi/builders/Android%20Cloud%20Tests/builds/5767

testSelectActionBarClearedOnTappingInput
https://build.chromium.org/p/chromium.fyi/builders/Android%20Cloud%20Tests/builds/5794

testSelectActionBarClearedOnTappingOutsideInput
https://build.chromium.org/p/chromium.fyi/builders/Android%20Cloud%20Tests/builds/5700

testTextHandlesPreservedWithDpadNavigation
https://build.chromium.org/p/chromium.fyi/builders/Android%20Cloud%20Tests/builds/5773
Found some similar flaky tests:

testNavigateTextWithDpadKeyCodes
testRestartInputWhileComposingText
testSelectionClearedOnKeyEvent
testImeCut

The pattern is: call commitText() or setComposition() at the beginning of test, and wait for selection updated. The selection stays 0 instead of the end of the text.
It happens when Ime thread is enabled. 
BTW, I haven't reproduced it locally so far.

See the details:

https://build.chromium.org/p/chromium.linux/builders/Android%20Tests/builds/33812
org.chromium.content.browser.input.ImeTest#testNavigateTextWithDpadKeyCodes with {--enable-features=ImeThread} (run #1):
junit.framework.AssertionFailedError: expected:<5> but was:<0>
	at org.chromium.content.browser.input.ImeTest.waitAndVerifyUpdateSelection(ImeTest.java:1660)
	at org.chromium.content.browser.input.ImeTest.testNavigateTextWithDpadKeyCodes(ImeTest.java:1221)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
	at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
	at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
	at org.chromium.content_shell_apk.ContentShellTestBase.runTest(ContentShellTestBase.java:233)
	at org.chromium.base.test.BaseTestResult.runParameterized(BaseTestResult.java:161)
	at org.chromium.base.test.BaseTestResult.run(BaseTestResult.java:124)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)

https://build.chromium.org/p/chromium.android/builders/Jelly%20Bean%20Tester/builds/6453
I  181.488s run_tests_on_device(059b100b)    Failure in testRestartInputWhileComposingText:
I  181.488s run_tests_on_device(059b100b)    junit.framework.AssertionFailedError: expected:<3> but was:<0>
I  181.489s run_tests_on_device(059b100b)    	at org.chromium.content.browser.input.ImeTest.waitAndVerifyUpdateSelection(ImeTest.java:1660)
I  181.489s run_tests_on_device(059b100b)    	at org.chromium.content.browser.input.ImeTest.testRestartInputWhileComposingText(ImeTest.java:1337)
I  181.489s run_tests_on_device(059b100b)    	at java.lang.reflect.Method.invokeNative(Native Method)
I  181.489s run_tests_on_device(059b100b)    	at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
I  181.489s run_tests_on_device(059b100b)    	at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
I  181.489s run_tests_on_device(059b100b)    	at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
I  181.489s run_tests_on_device(059b100b)    	at org.chromium.content_shell_apk.ContentShellTestBase.runTest(ContentShellTestBase.java:233)
I  181.489s run_tests_on_device(059b100b)    	at org.chromium.base.test.BaseTestResult.runParameterized(BaseTestResult.java:161)
I  181.489s run_tests_on_device(059b100b)    	at org.chromium.base.test.BaseTestResult.run(BaseTestResult.java:124)
I  181.489s run_tests_on_device(059b100b)    	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
I  181.489s run_tests_on_device(059b100b)    	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
I  181.490s run_tests_on_device(059b100b)    	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
I  181.490s run_tests_on_device(059b100b)    	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)

https://build.chromium.org/p/chromium.android/builders/KitKat%20Tablet%20Tester/builds/5885
I  296.848s run_tests_on_device(057ccb85)    Failure in testSelectionClearedOnKeyEvent:
I  296.848s run_tests_on_device(057ccb85)    junit.framework.AssertionFailedError: expected:<11> but was:<0>
I  296.848s run_tests_on_device(057ccb85)    	at org.chromium.content.browser.input.ImeTest.waitAndVerifyUpdateSelection(ImeTest.java:1656)
I  296.848s run_tests_on_device(057ccb85)    	at org.chromium.content.browser.input.ImeTest.testSelectionClearedOnKeyEvent(ImeTest.java:1304)
I  296.848s run_tests_on_device(057ccb85)    	at java.lang.reflect.Method.invokeNative(Native Method)
I  296.848s run_tests_on_device(057ccb85)    	at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
I  296.848s run_tests_on_device(057ccb85)    	at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
I  296.848s run_tests_on_device(057ccb85)    	at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
I  296.848s run_tests_on_device(057ccb85)    	at org.chromium.content_shell_apk.ContentShellTestBase.runTest(ContentShellTestBase.java:233)
I  296.848s run_tests_on_device(057ccb85)    	at org.chromium.base.test.BaseTestResult.runParameterized(BaseTestResult.java:161)
I  296.848s run_tests_on_device(057ccb85)    	at org.chromium.base.test.BaseTestResult.run(BaseTestResult.java:124)
I  296.848s run_tests_on_device(057ccb85)    	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
I  296.848s run_tests_on_device(057ccb85)    	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
I  296.848s run_tests_on_device(057ccb85)    	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
I  296.848s run_tests_on_device(057ccb85)    	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)

https://build.chromium.org/p/chromium.android/builders/Lollipop%20Low-end%20Tester/builds/4211
I  389.401s run_tests_on_device(AG86044202E68GC)    INSTRUMENTATION_STATUS: test=testImeCut
I  389.401s run_tests_on_device(AG86044202E68GC)    INSTRUMENTATION_STATUS: class=org.chromium.content.browser.input.ImeTest
I  389.401s run_tests_on_device(AG86044202E68GC)    INSTRUMENTATION_STATUS: stack=junit.framework.AssertionFailedError: expected:<7> but was:<0>
I  389.401s run_tests_on_device(AG86044202E68GC)    	at org.chromium.content.browser.input.ImeTest.waitAndVerifyUpdateSelection(ImeTest.java:1661)
I  389.401s run_tests_on_device(AG86044202E68GC)    	at org.chromium.content.browser.input.ImeTest.testImeCut(ImeTest.java:769)
I  389.402s run_tests_on_device(AG86044202E68GC)    	at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
I  389.402s run_tests_on_device(AG86044202E68GC)    	at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
I  389.402s run_tests_on_device(AG86044202E68GC)    	at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
I  389.402s run_tests_on_device(AG86044202E68GC)    	at org.chromium.content_shell_apk.ContentShellTestBase.runTest(ContentShellTestBase.java:233)
I  389.402s run_tests_on_device(AG86044202E68GC)    	at org.chromium.base.test.BaseTestResult.runParameterized(BaseTestResult.java:161)
I  389.402s run_tests_on_device(AG86044202E68GC)    	at org.chromium.base.test.BaseTestResult.run(BaseTestResult.java:124)
I  389.402s run_tests_on_device(AG86044202E68GC)    	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
I  389.402s run_tests_on_device(AG86044202E68GC)    	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
I  389.402s run_tests_on_device(AG86044202E68GC)    	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
I  389.402s run_tests_on_device(AG86044202E68GC)    	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1853)
Summary:


There are still at least 4 kind of flaky tests:


1. Every Ime test is flaky because the screen is locked. It's tracked by https://bugs.chromium.org/p/chromium/issues/detail?id=659869


2. 6 Ime tests (events test, e.g. testInputTextEvents_DeleteSurroundingText) are flaky. "keyup" event comes after "selectionchange" event incorrectly.


3. 10 Ime tests (see comment#22) are flaky because the selection bar isn't showed after longPressNode. ContentViewCoreSelectionTest has the same problem. See  https://bugs.chromium.org/p/chromium/issues/detail?id=592428


4. 4 (at least) tests are flaky because the selection is wrong after commitText() or setComposition(). See comment#23
Cc: yabinh@chromium.org
 Issue 650691  has been merged into this issue.
Project Member

Comment 26 by bugdroid1@chromium.org, Nov 4 2016

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

commit 4d1708cdd327cc4f038addd36153e0b86082bf2d
Author: yabinh <yabinh@chromium.org>
Date: Fri Nov 04 06:30:15 2016

Fix some flaky event tests in ImeTest

Some Ime tests are flaky because the event order is incorrect. Since
selectionchange event is queued, it's delayed and often comes after other
event, e.g. keyup event. As a workaround, we can ignore the order of
selectionchange event.

BUG= 650691 , 628964 

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

[modify] https://crrev.com/4d1708cdd327cc4f038addd36153e0b86082bf2d/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
[modify] https://crrev.com/4d1708cdd327cc4f038addd36153e0b86082bf2d/content/test/data/android/input/input_forms.html

testImeStaysOnLongPressingDifferentNonEmptyInputs is flaky only when ImeThread is disabled. See http://test-results.appspot.com/dashboards/flakiness_dashboard.html#showAllRuns=true&testType=content_shell_test_apk&tests=testImeStaysOnLongPressingDifferentNonEmptyInputs
(The tests mentioned in comment#22 have similar problem.)

It fails at the line:
assertWaitForSelectActionBarStatus(true);

I saw one failure case on the phone: the text of "input_text" is still null after the focus changes to "textarea". (It should be "Sample Text".) So when we long press an empty inputbox, the SelectActionBar won't get shown.

I think the reason is that, when ImeThread is disabled, commitText() will run on Ime Thread, DOMUtils.focusNode() will run on UI thread, so there will be a race condition. Even though we have waitAndVerifyUpdateSelection()(pollUiThread) after commitText(), it's not enough.
When ImeThread is enabled, commitText() will run on UI thread. No race condition.

Since we will delete ReplicaInputConnection in the future, I think we can restrict those tests to run with Ime Thread enabled.
Project Member

Comment 28 by bugdroid1@chromium.org, Nov 10 2016

Update:

Most of the flaky tests have been fixed so far, except for 2 trybot failures:

https://build.chromium.org/p/chromium.android/builders/Marshmallow%20Tablet%20Tester/builds/6451
I  204.647s run_tests_on_device(0af4e7ad)    Failure in testImeStaysOnLongPressingDifferentNonEmptyInputs:
I  204.648s run_tests_on_device(0af4e7ad)    junit.framework.AssertionFailedError: expected:<11> but was:<0>
I  204.648s run_tests_on_device(0af4e7ad)    	at org.chromium.content.browser.input.ImeTest.waitAndVerifyUpdateSelection(ImeTest.java:1544)
I  204.648s run_tests_on_device(0af4e7ad)    	at org.chromium.content.browser.input.ImeTest.testImeStaysOnLongPressingDifferentNonEmptyInputs(ImeTest.java:714)
Check the dashboard:
http://test-results.appspot.com/dashboards/flakiness_dashboard.html#showAllRuns=true&testType=content_shell_test_apk&tests=estImeStaysOnLongPressingDifferentNonEmptyInputs

https://build.chromium.org/p/chromium.android/builders/KitKat%20Tablet%20Tester/builds/6051
I  309.259s run_tests_on_device(05984fda)    Failure in testSetSelectionCommitTextOrder:
I  309.259s run_tests_on_device(05984fda)    junit.framework.AssertionFailedError: expected:<7> but was:<0>
I  309.259s run_tests_on_device(05984fda)    	at org.chromium.content.browser.input.ImeTest.waitAndVerifyUpdateSelection(ImeTest.java:1544)
I  309.259s run_tests_on_device(05984fda)    	at org.chromium.content.browser.input.ImeTest.testSetSelectionCommitTextOrder(ImeTest.java:1453)
Check the dashboard:
http://test-results.appspot.com/dashboards/flakiness_dashboard.html#showAllRuns=true&testType=content_shell_test_apk&tests=testSetSelectionCommitTextOrder

The first one is the same with Comment#24 Case#4.
 Issue 673140  has been merged into this issue.
 Issue 673588  has been merged into this issue.
Update:

The problem mentioned in comment#23 is getting worse. A lot of tests are flaky on trybot, and they're reproducible locally now (though very low, about 1 in several hundred times).

I checked some similar tests, like testCommitEnterKeyWhileComposingText, testFinishComposingText, testSetComposingRegionOutOfBounds, etc. They are not flaky at all. The only difference is that we focus on "textarea" and resetUpdateSelectionList in these tests.

I talked with changwan@, we suspect that although we reset the list in setUp(), but it's not enough. The selection update may come after we reset the state. If that's the case, we should wait for selection update before we reset the state.

Some evidence: we used to wait for selection update when IME thread is disabled, and these tests were not flaky in that case.

I'll land a CL to verify the assumption.
Blockedon: 659869
Project Member

Comment 34 by bugdroid1@chromium.org, Dec 22 2016

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

commit 6a72722a3b04df4326bbf805676fca794fe33906
Author: yabinh <yabinh@chromium.org>
Date: Thu Dec 22 11:22:03 2016

Fix some flaky IME tests caused by incorrect selection update

Some IME tests are flaky because of wrong selection update. We suspect
it's because sometimes when we focus on input_text, the selection update
comes after reseting the state. We should wait to ensure the correct order.

BUG= 628964 

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

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

Project Member

Comment 35 by bugdroid1@chromium.org, Dec 28 2016

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

commit c3fe81c87f6e16071f9b3b3ca9d57d023b58cbb6
Author: yabinh <yabinh@chromium.org>
Date: Wed Dec 28 07:43:12 2016

Remove @RetryOnFailure in IME test

A lot of IME tests were flaky and marked with @RetryOnFailure. Now they
are (almost) all deflaked, so we don't need @RetryOnFailure any more.

BUG= 628964 , 603991 

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

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

Note that  issue 682080  refers to flakiness in testLongPressInputWhileComposingText.

Status: Fixed (was: Assigned)
Checked the flaky dashboard:
 http://test-results.appspot.com/dashboards/flakiness_dashboard.html#showAllRuns=true&testType=content_shell_test_apk&tests=imetest
No flaky test so far. So I'm closing this issue.

Sign in to add a comment