aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/InputLogicTests.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-02-07 02:28:12 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-02-07 02:28:12 -0800
commitcfec7e72fd650067c1589c0d26f3f089a45c3067 (patch)
tree601f4e5754276cdc7f0913597b55d1eedaaaab1e /tests/src/com/android/inputmethod/latin/InputLogicTests.java
parent4a3c0918dc3049e3e680a899f9c10b95e579368c (diff)
parent816a8a0fd85ca0327436f8bd1cfa6928600ebc5d (diff)
downloadlatinime-cfec7e72fd650067c1589c0d26f3f089a45c3067.tar.gz
latinime-cfec7e72fd650067c1589c0d26f3f089a45c3067.tar.xz
latinime-cfec7e72fd650067c1589c0d26f3f089a45c3067.zip
Merge "Fix a race condition that makes tests unstable"
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTests.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTests.java b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
index 693352c85..fef704a0e 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTests.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTests.java
@@ -111,6 +111,20 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
mLatinIME.onStartInputView(ei, false);
mLatinIME.onCreateInputMethodInterface().startInput(ic, ei);
mInputConnection = ic;
+ // Wait for the main dictionary to be loaded (we need it for auto-correction tests)
+ int remainingAttempts = 10;
+ while (remainingAttempts > 0 && !mLatinIME.mSuggest.hasMainDictionary()) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // Don't do much
+ } finally {
+ --remainingAttempts;
+ }
+ }
+ if (!mLatinIME.mSuggest.hasMainDictionary()) {
+ throw new RuntimeException("Can't initialize the main dictionary");
+ }
}
// type(int) and type(String): helper methods to send a code point resp. a string to LatinIME.