Fix InputMethodServiceLifecycleTest
Behavior changed after Ibf9dab3d9c138b5f04e053d41ee4fd248c78e4da. Fixed
the test accordingly.
Bug: 72399950
Test: atest InputMethodServiceLifecycleTest
Change-Id: Ief94128349f4e57b6087bc48390ec28ed0d7a532
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java
index b1f16e5..5245612 100644
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java
@@ -58,14 +58,13 @@
public void testCreateIme1() throws Throwable {
final TestHelper helper = new TestHelper(getClass(), DeviceTestConstants.TEST_CREATE_IME1);
+ final long startActivityTime = SystemClock.uptimeMillis();
+ helper.launchActivity(DeviceTestConstants.PACKAGE, DeviceTestConstants.TEST_ACTIVITY_CLASS);
+
pollingCheck(() -> helper.queryAllEvents()
.collect(startingFrom(helper.isStartOfTest()))
.anyMatch(isFrom(Ime1Constants.CLASS).and(isType(ON_CREATE))),
TIMEOUT, "CtsInputMethod1.onCreate is called");
-
- final long startActivityTime = SystemClock.uptimeMillis();
- helper.launchActivity(DeviceTestConstants.PACKAGE, DeviceTestConstants.TEST_ACTIVITY_CLASS);
-
pollingCheck(() -> helper.queryAllEvents()
.filter(isNewerThan(startActivityTime))
.anyMatch(isFrom(Ime1Constants.CLASS).and(isType(ON_START_INPUT))),
@@ -78,14 +77,13 @@
final TestHelper helper = new TestHelper(
getClass(), DeviceTestConstants.TEST_SWITCH_IME1_TO_IME2);
+ final long startActivityTime = SystemClock.uptimeMillis();
+ helper.launchActivity(DeviceTestConstants.PACKAGE, DeviceTestConstants.TEST_ACTIVITY_CLASS);
+
pollingCheck(() -> helper.queryAllEvents()
.collect(startingFrom(helper.isStartOfTest()))
.anyMatch(isFrom(Ime1Constants.CLASS).and(isType(ON_CREATE))),
TIMEOUT, "CtsInputMethod1.onCreate is called");
-
- final long startActivityTime = SystemClock.uptimeMillis();
- helper.launchActivity(DeviceTestConstants.PACKAGE, DeviceTestConstants.TEST_ACTIVITY_CLASS);
-
pollingCheck(() -> helper.queryAllEvents()
.filter(isNewerThan(startActivityTime))
.anyMatch(isFrom(Ime1Constants.CLASS).and(isType(ON_START_INPUT))),