Merge "Remove check for result of IMM#showSoftInput and hideSoftInput" into udc-dev
This commit is contained in:
@@ -199,8 +199,7 @@ public final class AutoShowTest {
|
|||||||
Collections.singletonList(REQUEST_FOCUS_ON_CREATE));
|
Collections.singletonList(REQUEST_FOCUS_ON_CREATE));
|
||||||
TestActivity firstActivity = TestActivity.start(intent1);
|
TestActivity firstActivity = TestActivity.start(intent1);
|
||||||
// Show Ime with InputMethodManager to ensure the keyboard is on.
|
// Show Ime with InputMethodManager to ensure the keyboard is on.
|
||||||
boolean succ = callOnMainSync(firstActivity::showImeWithInputMethodManager);
|
callOnMainSync(firstActivity::showImeWithInputMethodManager);
|
||||||
assertThat(succ).isTrue();
|
|
||||||
SystemClock.sleep(1000);
|
SystemClock.sleep(1000);
|
||||||
mInstrumentation.waitForIdleSync();
|
mInstrumentation.waitForIdleSync();
|
||||||
|
|
||||||
@@ -264,8 +263,7 @@ public final class AutoShowTest {
|
|||||||
Collections.singletonList(REQUEST_FOCUS_ON_CREATE));
|
Collections.singletonList(REQUEST_FOCUS_ON_CREATE));
|
||||||
ImeStressTestUtil.TestActivity secondActivity = activity.startSecondTestActivity(intent2);
|
ImeStressTestUtil.TestActivity secondActivity = activity.startSecondTestActivity(intent2);
|
||||||
// Show Ime with InputMethodManager to ensure the keyboard is shown on the second activity
|
// Show Ime with InputMethodManager to ensure the keyboard is shown on the second activity
|
||||||
boolean succ = callOnMainSync(secondActivity::showImeWithInputMethodManager);
|
callOnMainSync(secondActivity::showImeWithInputMethodManager);
|
||||||
assertThat(succ).isTrue();
|
|
||||||
SystemClock.sleep(1000);
|
SystemClock.sleep(1000);
|
||||||
mInstrumentation.waitForIdleSync();
|
mInstrumentation.waitForIdleSync();
|
||||||
// Close the second activity
|
// Close the second activity
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ import static com.android.inputmethod.stresstest.ImeStressTestUtil.verifyWindowA
|
|||||||
import static com.android.inputmethod.stresstest.ImeStressTestUtil.waitOnMainUntilImeIsHidden;
|
import static com.android.inputmethod.stresstest.ImeStressTestUtil.waitOnMainUntilImeIsHidden;
|
||||||
import static com.android.inputmethod.stresstest.ImeStressTestUtil.waitOnMainUntilImeIsShown;
|
import static com.android.inputmethod.stresstest.ImeStressTestUtil.waitOnMainUntilImeIsShown;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.platform.test.annotations.RootPermissionTest;
|
import android.platform.test.annotations.RootPermissionTest;
|
||||||
import android.platform.test.rule.UnlockScreenRule;
|
import android.platform.test.rule.UnlockScreenRule;
|
||||||
@@ -83,14 +81,11 @@ public final class DefaultImeVisibilityTest {
|
|||||||
ImeStressTestUtil.TestActivity activity = ImeStressTestUtil.TestActivity.start(intent);
|
ImeStressTestUtil.TestActivity activity = ImeStressTestUtil.TestActivity.start(intent);
|
||||||
EditText editText = activity.getEditText();
|
EditText editText = activity.getEditText();
|
||||||
for (int i = 0; i < NUM_TEST_ITERATIONS; i++) {
|
for (int i = 0; i < NUM_TEST_ITERATIONS; i++) {
|
||||||
|
callOnMainSync(activity::showImeWithInputMethodManager);
|
||||||
boolean showResult = callOnMainSync(activity::showImeWithInputMethodManager);
|
|
||||||
assertThat(showResult).isTrue();
|
|
||||||
verifyWindowAndViewFocus(editText, true, true);
|
verifyWindowAndViewFocus(editText, true, true);
|
||||||
waitOnMainUntilImeIsShown(editText);
|
waitOnMainUntilImeIsShown(editText);
|
||||||
|
|
||||||
boolean hideResult = callOnMainSync(activity::hideImeWithInputMethodManager);
|
callOnMainSync(activity::hideImeWithInputMethodManager);
|
||||||
assertThat(hideResult).isTrue();
|
|
||||||
waitOnMainUntilImeIsHidden(editText);
|
waitOnMainUntilImeIsHidden(editText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,12 +102,10 @@ public final class ImeOpenCloseStressTest {
|
|||||||
for (int i = 0; i < iterNum; i++) {
|
for (int i = 0; i < iterNum; i++) {
|
||||||
String msgPrefix = "Iteration #" + i + " ";
|
String msgPrefix = "Iteration #" + i + " ";
|
||||||
Log.i(TAG, msgPrefix + "start");
|
Log.i(TAG, msgPrefix + "start");
|
||||||
boolean showResult = callOnMainSync(activity::showImeWithInputMethodManager);
|
callOnMainSync(activity::showImeWithInputMethodManager);
|
||||||
assertThat(showResult).isEqualTo(!(hasUnfocusableWindowFlags(activity)));
|
|
||||||
verifyShowBehavior(activity);
|
verifyShowBehavior(activity);
|
||||||
|
|
||||||
boolean hideResult = callOnMainSync(activity::hideImeWithInputMethodManager);
|
callOnMainSync(activity::hideImeWithInputMethodManager);
|
||||||
assertThat(hideResult).isEqualTo(!(hasUnfocusableWindowFlags(activity)));
|
|
||||||
|
|
||||||
verifyHideBehavior(activity);
|
verifyHideBehavior(activity);
|
||||||
}
|
}
|
||||||
@@ -128,14 +126,12 @@ public final class ImeOpenCloseStressTest {
|
|||||||
for (int i = 0; i < NUM_TEST_ITERATIONS; i++) {
|
for (int i = 0; i < NUM_TEST_ITERATIONS; i++) {
|
||||||
String msgPrefix = "Iteration #" + i + " ";
|
String msgPrefix = "Iteration #" + i + " ";
|
||||||
Log.i(TAG, msgPrefix + "start");
|
Log.i(TAG, msgPrefix + "start");
|
||||||
boolean showResult = callOnMainSync(activity::showImeWithInputMethodManager);
|
callOnMainSync(activity::showImeWithInputMethodManager);
|
||||||
assertThat(showResult).isTrue();
|
|
||||||
waitOnMainUntil(
|
waitOnMainUntil(
|
||||||
msgPrefix + "IME should be visible",
|
msgPrefix + "IME should be visible",
|
||||||
() -> !activity.isAnimating() && isImeShown(editText));
|
() -> !activity.isAnimating() && isImeShown(editText));
|
||||||
|
|
||||||
boolean hideResult = callOnMainSync(activity::hideImeWithInputMethodManager);
|
callOnMainSync(activity::hideImeWithInputMethodManager);
|
||||||
assertThat(hideResult).isTrue();
|
|
||||||
waitOnMainUntil(
|
waitOnMainUntil(
|
||||||
msgPrefix + "IME should be hidden",
|
msgPrefix + "IME should be hidden",
|
||||||
() -> !activity.isAnimating() && !isImeShown(editText));
|
() -> !activity.isAnimating() && !isImeShown(editText));
|
||||||
@@ -156,17 +152,13 @@ public final class ImeOpenCloseStressTest {
|
|||||||
List<Integer> intervals = new ArrayList<>();
|
List<Integer> intervals = new ArrayList<>();
|
||||||
for (int i = 10; i < 100; i += 10) intervals.add(i);
|
for (int i = 10; i < 100; i += 10) intervals.add(i);
|
||||||
for (int i = 100; i < 1000; i += 50) intervals.add(i);
|
for (int i = 100; i < 1000; i += 50) intervals.add(i);
|
||||||
boolean firstHide = false;
|
|
||||||
for (int intervalMillis : intervals) {
|
for (int intervalMillis : intervals) {
|
||||||
String msgPrefix = "Interval = " + intervalMillis + " ";
|
String msgPrefix = "Interval = " + intervalMillis + " ";
|
||||||
Log.i(TAG, msgPrefix + " start");
|
Log.i(TAG, msgPrefix + " start");
|
||||||
boolean hideResult = callOnMainSync(activity::hideImeWithInputMethodManager);
|
callOnMainSync(activity::hideImeWithInputMethodManager);
|
||||||
assertThat(hideResult).isEqualTo(firstHide);
|
|
||||||
firstHide = true;
|
|
||||||
SystemClock.sleep(intervalMillis);
|
SystemClock.sleep(intervalMillis);
|
||||||
|
|
||||||
boolean showResult = callOnMainSync(activity::showImeWithInputMethodManager);
|
callOnMainSync(activity::showImeWithInputMethodManager);
|
||||||
assertThat(showResult).isTrue();
|
|
||||||
verifyShowBehavior(activity);
|
verifyShowBehavior(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,8 +239,7 @@ public final class ImeOpenCloseStressTest {
|
|||||||
TestActivity activity = TestActivity.start(intent);
|
TestActivity activity = TestActivity.start(intent);
|
||||||
|
|
||||||
// Show InputMethodManager without requesting focus
|
// Show InputMethodManager without requesting focus
|
||||||
boolean showResult = callOnMainSync(activity::showImeWithInputMethodManager);
|
callOnMainSync(activity::showImeWithInputMethodManager);
|
||||||
assertThat(showResult).isFalse();
|
|
||||||
|
|
||||||
int windowFlags = activity.getWindow().getAttributes().flags;
|
int windowFlags = activity.getWindow().getAttributes().flags;
|
||||||
EditText editText = activity.getEditText();
|
EditText editText = activity.getEditText();
|
||||||
@@ -474,8 +465,7 @@ public final class ImeOpenCloseStressTest {
|
|||||||
Collections.singletonList(REQUEST_FOCUS_ON_CREATE));
|
Collections.singletonList(REQUEST_FOCUS_ON_CREATE));
|
||||||
TestActivity activity = TestActivity.start(intent1);
|
TestActivity activity = TestActivity.start(intent1);
|
||||||
// Show Ime with InputMethodManager to ensure the keyboard is shown on the second activity
|
// Show Ime with InputMethodManager to ensure the keyboard is shown on the second activity
|
||||||
boolean showResult = callOnMainSync(activity::showImeWithInputMethodManager);
|
callOnMainSync(activity::showImeWithInputMethodManager);
|
||||||
assertThat(showResult).isEqualTo(!(hasUnfocusableWindowFlags(activity)));
|
|
||||||
|
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
verifyShowBehavior(activity);
|
verifyShowBehavior(activity);
|
||||||
@@ -503,8 +493,7 @@ public final class ImeOpenCloseStressTest {
|
|||||||
Collections.singletonList(REQUEST_FOCUS_ON_CREATE));
|
Collections.singletonList(REQUEST_FOCUS_ON_CREATE));
|
||||||
TestActivity activity = TestActivity.start(intent);
|
TestActivity activity = TestActivity.start(intent);
|
||||||
// Show Ime with InputMethodManager to ensure the keyboard is shown on the second activity
|
// Show Ime with InputMethodManager to ensure the keyboard is shown on the second activity
|
||||||
boolean showResult = callOnMainSync(activity::showImeWithInputMethodManager);
|
callOnMainSync(activity::showImeWithInputMethodManager);
|
||||||
assertThat(showResult).isEqualTo(!(hasUnfocusableWindowFlags(activity)));
|
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
verifyShowBehavior(activity);
|
verifyShowBehavior(activity);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user