diff options
author | 2014-01-08 11:03:01 +0000 | |
---|---|---|
committer | 2014-01-08 11:03:02 +0000 | |
commit | 5742a415f37a3f3d4ddba4c7cc0b47385db7ecc7 (patch) | |
tree | 1504654b47eab8b4d451ba8e5be3d0609bd1982d /tests/src | |
parent | b90fa0fb2ce195cfaec878dea9702261290176c2 (diff) | |
parent | 9f1fe87580adc9ca041fc044f88341fa262c82a2 (diff) | |
download | latinime-5742a415f37a3f3d4ddba4c7cc0b47385db7ecc7.tar.gz latinime-5742a415f37a3f3d4ddba4c7cc0b47385db7ecc7.tar.xz latinime-5742a415f37a3f3d4ddba4c7cc0b47385db7ecc7.zip |
Merge "Make reloadMainDict() private."
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/InputTestsBase.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/tests/src/com/android/inputmethod/latin/InputTestsBase.java b/tests/src/com/android/inputmethod/latin/InputTestsBase.java index cee73c917..84e8a862c 100644 --- a/tests/src/com/android/inputmethod/latin/InputTestsBase.java +++ b/tests/src/com/android/inputmethod/latin/InputTestsBase.java @@ -25,6 +25,7 @@ import android.text.InputType; import android.text.SpannableStringBuilder; import android.text.style.CharacterStyle; import android.text.style.SuggestionSpan; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -41,8 +42,10 @@ import com.android.inputmethod.latin.utils.LocaleUtils; import com.android.inputmethod.latin.utils.SubtypeLocaleUtils; import java.util.Locale; +import java.util.concurrent.TimeUnit; public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> { + private static final String TAG = InputTestsBase.class.getSimpleName(); private static final String PREF_DEBUG_MODE = "debug_mode"; private static final String PREF_AUTO_CORRECTION_THRESHOLD = "auto_correction_threshold"; @@ -54,6 +57,7 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> { protected static final int DELAY_TO_WAIT_FOR_UNDERLINE = 500; // The message that sets predictions is posted with a 200 ms delay protected static final int DELAY_TO_WAIT_FOR_PREDICTIONS = 200; + private final int TIMEOUT_TO_WAIT_FOR_LOADING_MAIN_DICTIONARY_IN_SECONDS = 60; protected LatinIME mLatinIME; protected Keyboard mKeyboard; @@ -260,15 +264,11 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> { } protected void waitForDictionaryToBeLoaded() { - int remainingAttempts = 300; - while (remainingAttempts > 0 && mLatinIME.isCurrentlyWaitingForMainDictionary()) { - try { - Thread.sleep(200); - } catch (InterruptedException e) { - // Don't do much - } finally { - --remainingAttempts; - } + try { + mLatinIME.waitForMainDictionary( + TIMEOUT_TO_WAIT_FOR_LOADING_MAIN_DICTIONARY_IN_SECONDS, TimeUnit.SECONDS); + } catch (InterruptedException e) { + Log.e(TAG, "Interrupted during waiting for loading main dictionary.", e); } } @@ -300,8 +300,7 @@ public class InputTestsBase extends ServiceTestCase<LatinIMEForTests> { final String dictLocale) { changeLanguage(keyboardLocale); if (!keyboardLocale.equals(dictLocale)) { - mLatinIME.replaceMainDictionaryForTest( - LocaleUtils.constructLocaleFromString(dictLocale)); + mLatinIME.replaceDictionariesForTest(LocaleUtils.constructLocaleFromString(dictLocale)); } waitForDictionaryToBeLoaded(); } |