am cfec7e72: Merge "Fix a race condition that makes tests unstable"
* commit 'cfec7e72fd650067c1589c0d26f3f089a45c3067': Fix a race condition that makes tests unstablemain
commit
618e75ef7f
|
@ -186,7 +186,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
private View mKeyPreviewBackingView;
|
private View mKeyPreviewBackingView;
|
||||||
private View mSuggestionsContainer;
|
private View mSuggestionsContainer;
|
||||||
private SuggestionsView mSuggestionsView;
|
private SuggestionsView mSuggestionsView;
|
||||||
private Suggest mSuggest;
|
/* package for tests */ Suggest mSuggest;
|
||||||
private CompletionInfo[] mApplicationSpecifiedCompletions;
|
private CompletionInfo[] mApplicationSpecifiedCompletions;
|
||||||
|
|
||||||
private InputMethodManagerCompatWrapper mImm;
|
private InputMethodManagerCompatWrapper mImm;
|
||||||
|
|
|
@ -111,6 +111,20 @@ public class InputLogicTests extends ServiceTestCase<LatinIME> {
|
||||||
mLatinIME.onStartInputView(ei, false);
|
mLatinIME.onStartInputView(ei, false);
|
||||||
mLatinIME.onCreateInputMethodInterface().startInput(ic, ei);
|
mLatinIME.onCreateInputMethodInterface().startInput(ic, ei);
|
||||||
mInputConnection = ic;
|
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.
|
// type(int) and type(String): helper methods to send a code point resp. a string to LatinIME.
|
||||||
|
|
Loading…
Reference in New Issue