am 82be1873
: Merge "Add additional wait for writing file in testAddManyWords()."
* commit '82be1873f140db8cafdf1c6f3ac3998515c21727': Add additional wait for writing file in testAddManyWords().
This commit is contained in:
commit
4146db552f
2 changed files with 11 additions and 1 deletions
|
@ -647,7 +647,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
|
||||||
@UsedForTesting
|
@UsedForTesting
|
||||||
public void waitAllTasksForTests() {
|
public void waitAllTasksForTests() {
|
||||||
final CountDownLatch countDownLatch = new CountDownLatch(1);
|
final CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||||
ExecutorUtils.getExecutor(mDictName).execute(new Runnable() {
|
asyncExecuteTaskWithWriteLock(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
countDownLatch.countDown();
|
countDownLatch.countDown();
|
||||||
|
|
|
@ -41,6 +41,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public class UserHistoryDictionaryTests extends AndroidTestCase {
|
public class UserHistoryDictionaryTests extends AndroidTestCase {
|
||||||
private static final String TAG = UserHistoryDictionaryTests.class.getSimpleName();
|
private static final String TAG = UserHistoryDictionaryTests.class.getSimpleName();
|
||||||
|
private static final int WAIT_FOR_WRITING_FILE_IN_MILLISECONDS = 3000;
|
||||||
|
|
||||||
private static final String[] CHARACTERS = {
|
private static final String[] CHARACTERS = {
|
||||||
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
|
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
|
||||||
|
@ -248,6 +249,15 @@ public class UserHistoryDictionaryTests extends AndroidTestCase {
|
||||||
} finally {
|
} finally {
|
||||||
Log.d(TAG, "waiting for writing ...");
|
Log.d(TAG, "waiting for writing ...");
|
||||||
waitForWriting(dummyLocale);
|
waitForWriting(dummyLocale);
|
||||||
|
if (!dictFile.exists()) {
|
||||||
|
try {
|
||||||
|
Log.d(TAG, dictFile +" is not existing. Wait "
|
||||||
|
+ WAIT_FOR_WRITING_FILE_IN_MILLISECONDS + " ms for writing.");
|
||||||
|
Thread.sleep(WAIT_FOR_WRITING_FILE_IN_MILLISECONDS);
|
||||||
|
} catch (final InterruptedException e) {
|
||||||
|
Log.e(TAG, "Interrupted during waiting for writing the dict file.");
|
||||||
|
}
|
||||||
|
}
|
||||||
assertTrue("check exisiting of " + dictFile, dictFile.exists());
|
assertTrue("check exisiting of " + dictFile, dictFile.exists());
|
||||||
FileUtils.deleteRecursively(dictFile);
|
FileUtils.deleteRecursively(dictFile);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue