aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-04-10 08:47:20 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-04-10 08:47:20 +0000
commit2e967f66074fdc13ba2bc9b1932f036897e3b00a (patch)
tree407124d4e3a0a286cc2695c0e774f65c16174487 /java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
parent9eec53a2c227c791f62659aebcbe18fcf517e65b (diff)
parent4370ff0998d3240cfda7745d08edbdd11703b984 (diff)
downloadlatinime-2e967f66074fdc13ba2bc9b1932f036897e3b00a.tar.gz
latinime-2e967f66074fdc13ba2bc9b1932f036897e3b00a.tar.xz
latinime-2e967f66074fdc13ba2bc9b1932f036897e3b00a.zip
Merge "Fix some flaky tests."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java')
-rw-r--r--java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index 7cf8c5e49..0754b1fa9 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -148,6 +148,17 @@ public final class InputLogic {
mInputLogicHandler.reset();
}
+ // Normally this class just gets out of scope after the process ends, but in unit tests, we
+ // create several instances of LatinIME in the same process, which results in several
+ // instances of InputLogic. This cleans up the associated handler so that tests don't leak
+ // handlers.
+ public void recycle() {
+ final InputLogicHandler inputLogicHandler = mInputLogicHandler;
+ mInputLogicHandler = InputLogicHandler.NULL_HANDLER;
+ inputLogicHandler.destroy();
+ mSuggest.mDictionaryFacilitator.closeDictionaries();
+ }
+
/**
* React to a string input.
*