Merge "Use InstrumentationTestCase and get rid of AndroidTestCase.getTestContext call"

main
Tadashi G. Takaoka 2012-06-12 11:49:55 -07:00 committed by Android (Google) Code Review
commit 4b3ae50eef
1 changed files with 6 additions and 4 deletions

View File

@ -16,25 +16,27 @@
package com.android.inputmethod.keyboard.internal; package com.android.inputmethod.keyboard.internal;
import android.test.AndroidTestCase; import android.app.Instrumentation;
import android.test.InstrumentationTestCase;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale; import java.util.Locale;
public class KeySpecParserCsvTests extends AndroidTestCase { public class KeySpecParserCsvTests extends InstrumentationTestCase {
private final KeyboardTextsSet mTextsSet = new KeyboardTextsSet(); private final KeyboardTextsSet mTextsSet = new KeyboardTextsSet();
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
final Instrumentation instrumentation = getInstrumentation();
mTextsSet.setLanguage(Locale.ENGLISH.getLanguage()); mTextsSet.setLanguage(Locale.ENGLISH.getLanguage());
mTextsSet.loadStringResources(getContext()); mTextsSet.loadStringResources(instrumentation.getTargetContext());
final String[] testResourceNames = getAllResourceIdNames( final String[] testResourceNames = getAllResourceIdNames(
com.android.inputmethod.latin.tests.R.string.class); com.android.inputmethod.latin.tests.R.string.class);
mTextsSet.loadStringResourcesInternal(getTestContext(), mTextsSet.loadStringResourcesInternal(instrumentation.getContext(),
testResourceNames, testResourceNames,
com.android.inputmethod.latin.tests.R.string.empty_string); com.android.inputmethod.latin.tests.R.string.empty_string);
} }