diff options
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java b/tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java index c63193aeb..d76a55283 100644 --- a/tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java +++ b/tests/src/com/android/inputmethod/latin/BinaryDictionaryDecayingTests.java @@ -22,6 +22,7 @@ import android.util.Pair; import com.android.inputmethod.latin.makedict.CodePointUtils; import com.android.inputmethod.latin.makedict.FormatSpec; +import com.android.inputmethod.latin.utils.FileUtils; import java.io.File; import java.io.IOException; @@ -102,7 +103,7 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase { private File createEmptyDictionaryAndGetFile(final String dictId, final int formatVersion) throws IOException { - if (formatVersion == 4) { + if (formatVersion == FormatSpec.VERSION4) { return createEmptyVer4DictionaryAndGetFile(dictId); } else { throw new IOException("Dictionary format version " + formatVersion @@ -112,7 +113,7 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase { private File createEmptyVer4DictionaryAndGetFile(final String dictId) throws IOException { final File file = File.createTempFile(dictId, TEST_DICT_FILE_EXTENSION, getContext().getCacheDir()); - file.delete(); + FileUtils.deleteRecursively(file); file.mkdir(); Map<String, String> attributeMap = new HashMap<String, String>(); attributeMap.put(FormatSpec.FileHeader.SUPPORTS_DYNAMIC_UPDATE_ATTRIBUTE, @@ -123,10 +124,10 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase { FormatSpec.FileHeader.ATTRIBUTE_VALUE_TRUE); if (BinaryDictionary.createEmptyDictFile(file.getAbsolutePath(), FormatSpec.VERSION4, attributeMap)) { - return new File(file, FormatSpec.TRIE_FILE_EXTENSION); + return new File(file, FormatSpec.HEADER_FILE_EXTENSION); } else { throw new IOException("Empty dictionary " + file.getAbsolutePath() + " " - + FormatSpec.TRIE_FILE_EXTENSION + " cannot be created."); + + FormatSpec.HEADER_FILE_EXTENSION + " cannot be created."); } } @@ -140,11 +141,11 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase { binaryDictionary.getPropertyForTests(query); } - public void testControllCurrentTime() { - testControllCurrentTime(FormatSpec.VERSION4); + public void testControlCurrentTime() { + testControlCurrentTime(FormatSpec.VERSION4); } - private void testControllCurrentTime(final int formatVersion) { + private void testControlCurrentTime(final int formatVersion) { final int TEST_COUNT = 1000; final long seed = System.currentTimeMillis(); final Random random = new Random(seed); |