diff options
author | 2012-02-07 19:22:37 +0900 | |
---|---|---|
committer | 2012-02-07 19:22:37 +0900 | |
commit | 816a8a0fd85ca0327436f8bd1cfa6928600ebc5d (patch) | |
tree | ad1d0092e58b6b668c1908a5cd03421d73ac521f /tests/src/com/android/inputmethod/latin/InputLogicTests.java | |
parent | 4c5daa8a5574628204be602578794035ab8686f0 (diff) | |
download | latinime-816a8a0fd85ca0327436f8bd1cfa6928600ebc5d.tar.gz latinime-816a8a0fd85ca0327436f8bd1cfa6928600ebc5d.tar.xz latinime-816a8a0fd85ca0327436f8bd1cfa6928600ebc5d.zip |
Fix a race condition that makes tests unstable
Change-Id: Ic19d380eb64855884bc6ded8547c200dd772ffe9
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/InputLogicTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/InputLogicTests.java | 14 |
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. |