aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-12-18 16:53:54 +0900
committerJean Chalard <jchalard@google.com>2013-12-18 18:10:56 +0900
commitdfbe2bfe089b301819039e9b3a7d2c307e6beac7 (patch)
treec77a5334a0a072c0b81bc1e9fc080bdd350c77b6
parentd5f5dd74c2e0946d4686a4f22cda1591b34b6729 (diff)
downloadlatinime-dfbe2bfe089b301819039e9b3a7d2c307e6beac7.tar.gz
latinime-dfbe2bfe089b301819039e9b3a7d2c307e6beac7.tar.xz
latinime-dfbe2bfe089b301819039e9b3a7d2c307e6beac7.zip
Add some info to test crashes to help diagnose flakiness
Bug: 11142685 Change-Id: Ic3a5d452f6c325248ac4e1bfa37774c58586f359
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java11
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTestsLanguageWithoutSpaces.java3
-rw-r--r--tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java3
-rw-r--r--tests/src/com/android/inputmethod/latin/PunctuationTests.java9
4 files changed, 14 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 67b570277..4b38c8871 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -3253,8 +3253,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// TODO: can this be removed somehow without breaking the tests?
@UsedForTesting
- /* package for test */ String getFirstSuggestedWord() {
- return mSuggestedWords.size() > 0 ? mSuggestedWords.getWord(0) : null;
+ /* package for test */ SuggestedWords getSuggestedWords() {
+ // 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.
@@ -3263,12 +3264,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
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.
@UsedForTesting
/* package for test */ void replaceMainDictionaryForTest(final Locale locale) {
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTestsLanguageWithoutSpaces.java b/tests/src/com/android/inputmethod/latin/InputLogicTestsLanguageWithoutSpaces.java
index 0f0ebafb9..89021b4e5 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTestsLanguageWithoutSpaces.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTestsLanguageWithoutSpaces.java
@@ -99,7 +99,8 @@ public class InputLogicTestsLanguageWithoutSpaces extends InputTestsBase {
assertEquals("predictions in lang without spaces", "Barack",
mEditText.getText().toString());
// Test the first prediction is displayed
+ final SuggestedWords suggestedWords = mLatinIME.getSuggestedWords();
assertEquals("predictions in lang without spaces", "Obama",
- mLatinIME.getFirstSuggestedWord());
+ suggestedWords.size() > 0 ? suggestedWords.getWord(0) : null);
}
}
diff --git a/tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java b/tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java
index 2d736e338..a474c6a8d 100644
--- a/tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java
+++ b/tests/src/com/android/inputmethod/latin/InputLogicTestsNonEnglish.java
@@ -84,8 +84,9 @@ public class InputLogicTestsNonEnglish extends InputTestsBase {
type(WORD_TO_TYPE);
sleep(DELAY_TO_WAIT_FOR_UNDERLINE);
runMessages();
+ final SuggestedWords suggestedWords = mLatinIME.getSuggestedWords();
assertEquals("type word then type space yields predictions for French",
- EXPECTED_RESULT, mLatinIME.getFirstSuggestedWord());
+ EXPECTED_RESULT, suggestedWords.size() > 0 ? suggestedWords.getWord(0) : null);
} finally {
setBooleanPreference(NEXT_WORD_PREDICTION_OPTION, previousNextWordPredictionOption,
defaultNextWordPredictionOption);
diff --git a/tests/src/com/android/inputmethod/latin/PunctuationTests.java b/tests/src/com/android/inputmethod/latin/PunctuationTests.java
index 84ff6b307..d5c06e223 100644
--- a/tests/src/com/android/inputmethod/latin/PunctuationTests.java
+++ b/tests/src/com/android/inputmethod/latin/PunctuationTests.java
@@ -16,6 +16,7 @@
package com.android.inputmethod.latin;
+import android.provider.Settings.Secure;
import android.test.suitebuilder.annotation.LargeTest;
import com.android.inputmethod.latin.R;
@@ -153,7 +154,9 @@ public class PunctuationTests extends InputTestsBase {
final String WORD_TO_TYPE = "you'f ";
final String EXPECTED_RESULT = "you'd ";
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());
}
@@ -161,7 +164,9 @@ public class PunctuationTests extends InputTestsBase {
final String WORD_TO_TYPE = "'tgis' ";
final String EXPECTED_RESULT = "'this' ";
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());
}
}