diff options
author | 2012-02-07 02:29:58 -0800 | |
---|---|---|
committer | 2012-02-07 02:29:58 -0800 | |
commit | 618e75ef7f0cfdeecfefb3ed75e2c59c7edb16eb (patch) | |
tree | 601f4e5754276cdc7f0913597b55d1eedaaaab1e | |
parent | 97d6c71d857917cb151eac44986b309a9468be20 (diff) | |
parent | cfec7e72fd650067c1589c0d26f3f089a45c3067 (diff) | |
download | latinime-618e75ef7f0cfdeecfefb3ed75e2c59c7edb16eb.tar.gz latinime-618e75ef7f0cfdeecfefb3ed75e2c59c7edb16eb.tar.xz latinime-618e75ef7f0cfdeecfefb3ed75e2c59c7edb16eb.zip |
am cfec7e72: Merge "Fix a race condition that makes tests unstable"
* commit 'cfec7e72fd650067c1589c0d26f3f089a45c3067':
Fix a race condition that makes tests unstable
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 2 | ||||
-rw-r--r-- | tests/src/com/android/inputmethod/latin/InputLogicTests.java | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 34080750c..20ec090d2 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -186,7 +186,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private View mKeyPreviewBackingView; private View mSuggestionsContainer; private SuggestionsView mSuggestionsView; - private Suggest mSuggest; + /* package for tests */ Suggest mSuggest; private CompletionInfo[] mApplicationSpecifiedCompletions; private InputMethodManagerCompatWrapper mImm; 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. |