Add some info to test crashes to help diagnose flakiness
Bug: 11142685 Change-Id: Ic3a5d452f6c325248ac4e1bfa37774c58586f359main
parent
d5f5dd74c2
commit
dfbe2bfe08
|
@ -3253,8 +3253,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
// TODO: can this be removed somehow without breaking the tests?
|
// TODO: can this be removed somehow without breaking the tests?
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
/* package for test */ String getFirstSuggestedWord() {
|
/* package for test */ SuggestedWords getSuggestedWords() {
|
||||||
return mSuggestedWords.size() > 0 ? mSuggestedWords.getWord(0) : null;
|
// You may not use this method for anything else than debug
|
||||||
|
return DEBUG ? mSuggestedWords : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DO NOT USE THIS for any other purpose than testing. This is information private to LatinIME.
|
// DO NOT USE THIS for any other purpose than testing. This is information private to LatinIME.
|
||||||
|
@ -3263,12 +3264,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
return mSuggest.isCurrentlyWaitingForMainDictionary();
|
return mSuggest.isCurrentlyWaitingForMainDictionary();
|
||||||
}
|
}
|
||||||
|
|
||||||
// DO NOT USE THIS for any other purpose than testing. This is information private to LatinIME.
|
|
||||||
@UsedForTesting
|
|
||||||
/* package for test */ boolean hasMainDictionary() {
|
|
||||||
return mSuggest.hasMainDictionary();
|
|
||||||
}
|
|
||||||
|
|
||||||
// DO NOT USE THIS for any other purpose than testing. This can break the keyboard badly.
|
// DO NOT USE THIS for any other purpose than testing. This can break the keyboard badly.
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
/* package for test */ void replaceMainDictionaryForTest(final Locale locale) {
|
/* package for test */ void replaceMainDictionaryForTest(final Locale locale) {
|
||||||
|
|
|
@ -99,7 +99,8 @@ public class InputLogicTestsLanguageWithoutSpaces extends InputTestsBase {
|
||||||
assertEquals("predictions in lang without spaces", "Barack",
|
assertEquals("predictions in lang without spaces", "Barack",
|
||||||
mEditText.getText().toString());
|
mEditText.getText().toString());
|
||||||
// Test the first prediction is displayed
|
// Test the first prediction is displayed
|
||||||
|
final SuggestedWords suggestedWords = mLatinIME.getSuggestedWords();
|
||||||
assertEquals("predictions in lang without spaces", "Obama",
|
assertEquals("predictions in lang without spaces", "Obama",
|
||||||
mLatinIME.getFirstSuggestedWord());
|
suggestedWords.size() > 0 ? suggestedWords.getWord(0) : null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,8 +84,9 @@ public class InputLogicTestsNonEnglish extends InputTestsBase {
|
||||||
type(WORD_TO_TYPE);
|
type(WORD_TO_TYPE);
|
||||||
sleep(DELAY_TO_WAIT_FOR_UNDERLINE);
|
sleep(DELAY_TO_WAIT_FOR_UNDERLINE);
|
||||||
runMessages();
|
runMessages();
|
||||||
|
final SuggestedWords suggestedWords = mLatinIME.getSuggestedWords();
|
||||||
assertEquals("type word then type space yields predictions for French",
|
assertEquals("type word then type space yields predictions for French",
|
||||||
EXPECTED_RESULT, mLatinIME.getFirstSuggestedWord());
|
EXPECTED_RESULT, suggestedWords.size() > 0 ? suggestedWords.getWord(0) : null);
|
||||||
} finally {
|
} finally {
|
||||||
setBooleanPreference(NEXT_WORD_PREDICTION_OPTION, previousNextWordPredictionOption,
|
setBooleanPreference(NEXT_WORD_PREDICTION_OPTION, previousNextWordPredictionOption,
|
||||||
defaultNextWordPredictionOption);
|
defaultNextWordPredictionOption);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package com.android.inputmethod.latin;
|
package com.android.inputmethod.latin;
|
||||||
|
|
||||||
|
import android.provider.Settings.Secure;
|
||||||
import android.test.suitebuilder.annotation.LargeTest;
|
import android.test.suitebuilder.annotation.LargeTest;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.R;
|
import com.android.inputmethod.latin.R;
|
||||||
|
@ -153,7 +154,9 @@ public class PunctuationTests extends InputTestsBase {
|
||||||
final String WORD_TO_TYPE = "you'f ";
|
final String WORD_TO_TYPE = "you'f ";
|
||||||
final String EXPECTED_RESULT = "you'd ";
|
final String EXPECTED_RESULT = "you'd ";
|
||||||
type(WORD_TO_TYPE);
|
type(WORD_TO_TYPE);
|
||||||
assertEquals("auto-correction with single quote inside",
|
assertEquals("auto-correction with single quote inside. ID = "
|
||||||
|
+ Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID)
|
||||||
|
+ " ; Suggestions = " + mLatinIME.getSuggestedWords(),
|
||||||
EXPECTED_RESULT, mEditText.getText().toString());
|
EXPECTED_RESULT, mEditText.getText().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +164,9 @@ public class PunctuationTests extends InputTestsBase {
|
||||||
final String WORD_TO_TYPE = "'tgis' ";
|
final String WORD_TO_TYPE = "'tgis' ";
|
||||||
final String EXPECTED_RESULT = "'this' ";
|
final String EXPECTED_RESULT = "'this' ";
|
||||||
type(WORD_TO_TYPE);
|
type(WORD_TO_TYPE);
|
||||||
assertEquals("auto-correction with single quotes around",
|
assertEquals("auto-correction with single quotes around. ID = "
|
||||||
|
+ Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID)
|
||||||
|
+ " ; Suggestions = " + mLatinIME.getSuggestedWords(),
|
||||||
EXPECTED_RESULT, mEditText.getText().toString());
|
EXPECTED_RESULT, mEditText.getText().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue