From 6c7a85cb3571845d568f86d8197459af98b0f813 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Mon, 29 Sep 2014 14:26:51 +0900 Subject: [PATCH] Quit using currentTimeMillis() for user history unit tests. Change-Id: I24bd81e6781148302d5679850ed0a9bda71a3d27 --- .../personalization/UserHistoryDictionaryTests.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java index 290c06752..766627334 100644 --- a/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java +++ b/tests/src/com/android/inputmethod/latin/personalization/UserHistoryDictionaryTests.java @@ -159,11 +159,11 @@ public class UserHistoryDictionaryTests extends AndroidTestCase { return new ArrayList<>(wordSet); } - private static void addToDict(final UserHistoryDictionary dict, final List words) { + private static void addToDict(final UserHistoryDictionary dict, final List words, + final int timestamp) { NgramContext ngramContext = NgramContext.EMPTY_PREV_WORDS_INFO; for (String word : words) { - UserHistoryDictionary.addToDictionary(dict, ngramContext, word, true, - (int)TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()), + UserHistoryDictionary.addToDictionary(dict, ngramContext, word, true, timestamp, DistracterFilter.EMPTY_DISTRACTER_FILTER); ngramContext = ngramContext.getNextNgramContext(new WordInfo(word)); } @@ -177,7 +177,7 @@ public class UserHistoryDictionaryTests extends AndroidTestCase { final int numberOfWords, final Random random, final boolean checkContents) { final List words = generateWords(numberOfWords, random); // Add random words to the user history dictionary. - addToDict(dict, words); + addToDict(dict, words, mCurrentTime); if (checkContents) { dict.waitAllTasksForTests(); for (int i = 0; i < numberOfWords; ++i) { @@ -308,6 +308,5 @@ public class UserHistoryDictionaryTests extends AndroidTestCase { for (final String word : words) { assertFalse(dict.isInDictionary(word)); } - stopTestModeInNativeCode(); } }