am 68069c55: Fix flaky unit test.

* commit '68069c55c49d21dcccd0a90369cd0fd61982d8cf':
  Fix flaky unit test.
main
Keisuke Kuroyanagi 2014-01-14 19:18:42 -08:00 committed by Android Git Automerger
commit e3fca57f58
2 changed files with 4 additions and 1 deletions

View File

@ -58,6 +58,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
private static final boolean DBG_STRESS_TEST = false; private static final boolean DBG_STRESS_TEST = false;
private static final int TIMEOUT_FOR_READ_OPS_IN_MILLISECONDS = 100; private static final int TIMEOUT_FOR_READ_OPS_IN_MILLISECONDS = 100;
private static final int TIMEOUT_FOR_READ_OPS_FOR_TESTS_IN_MILLISECONDS = 1000;
/** /**
* The maximum length of a word in this dictionary. * The maximum length of a word in this dictionary.
@ -761,7 +762,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
} }
} }
}); });
return holder.get(false, TIMEOUT_FOR_READ_OPS_IN_MILLISECONDS); return holder.get(false, TIMEOUT_FOR_READ_OPS_FOR_TESTS_IN_MILLISECONDS);
} }
@UsedForTesting @UsedForTesting

View File

@ -105,8 +105,10 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
final UserHistoryDictionary dict = final UserHistoryDictionary dict =
PersonalizationHelper.getUserHistoryDictionary(getContext(), PersonalizationHelper.getUserHistoryDictionary(getContext(),
new Locale(testFilenameSuffix)); new Locale(testFilenameSuffix));
dict.waitAllTasksForTests();
dict.clearAndFlushDictionary(); dict.clearAndFlushDictionary();
dict.close(); dict.close();
dict.waitAllTasksForTests();
} }
/** /**