diff options
author | 2016-01-27 18:09:50 -0800 | |
---|---|---|
committer | 2016-01-27 18:09:58 -0800 | |
commit | b51617f4668ef8cf0e6d8d0fc3284eae51dbd8ca (patch) | |
tree | 9e66ea505482770b09a33c338d008ab549357b91 | |
parent | d11c15d418d776d1db33f7664fad2671de0e6669 (diff) |
Deprecated platform Android testing APIs
- Deprecated most android.test.* APIs
- Kept ProviderTestCase2 and LoaderTestCase since we don't have a
replacement yet
- Deprecated android.test.suitebuilder
- Added Javadoc to all deprecated APIs with links to corresponding
Android Testing Support Library APIs
- Removed all trailing whitespace
Bug: 22314304
Change-Id: I1b1f0dd5132364110f1dfd4e3eb2dd044700d859
57 files changed, 548 insertions, 374 deletions
diff --git a/api/current.txt b/api/current.txt index c1cd9207ba7a..e397476c1ed1 100644 --- a/api/current.txt +++ b/api/current.txt @@ -36793,7 +36793,7 @@ package android.test { method public void testActivityTestCaseSetUpProperly() throws java.lang.Exception; } - public abstract class ActivityInstrumentationTestCase2 extends android.test.ActivityTestCase { + public abstract deprecated class ActivityInstrumentationTestCase2 extends android.test.ActivityTestCase { ctor public deprecated ActivityInstrumentationTestCase2(java.lang.String, java.lang.Class<T>); ctor public ActivityInstrumentationTestCase2(java.lang.Class<T>); method public T getActivity(); @@ -36801,14 +36801,14 @@ package android.test { method public void setActivityIntent(android.content.Intent); } - public abstract class ActivityTestCase extends android.test.InstrumentationTestCase { + public abstract deprecated class ActivityTestCase extends android.test.InstrumentationTestCase { ctor public ActivityTestCase(); method protected android.app.Activity getActivity(); method protected void scrubClass(java.lang.Class<?>) throws java.lang.IllegalAccessException; method protected void setActivity(android.app.Activity); } - public abstract class ActivityUnitTestCase extends android.test.ActivityTestCase { + public abstract deprecated class ActivityUnitTestCase extends android.test.ActivityTestCase { ctor public ActivityUnitTestCase(java.lang.Class<T>); method public T getActivity(); method public int getFinishedActivityRequest(); @@ -36821,7 +36821,7 @@ package android.test { method protected T startActivity(android.content.Intent, android.os.Bundle, java.lang.Object); } - public class AndroidTestCase extends junit.framework.TestCase { + public deprecated class AndroidTestCase extends junit.framework.TestCase { ctor public AndroidTestCase(); method public void assertActivityRequiresPermission(java.lang.String, java.lang.String, java.lang.String); method public void assertReadingContentUriRequiresPermission(android.net.Uri, java.lang.String); @@ -36833,7 +36833,7 @@ package android.test { field protected android.content.Context mContext; } - public class AndroidTestRunner extends junit.runner.BaseTestRunner { + public deprecated class AndroidTestRunner extends junit.runner.BaseTestRunner { ctor public AndroidTestRunner(); method public void addTestListener(junit.framework.TestListener); method public void clearTestListeners(); @@ -36854,7 +36854,7 @@ package android.test { method public void testStarted(java.lang.String); } - public abstract class ApplicationTestCase extends android.test.AndroidTestCase { + public abstract deprecated class ApplicationTestCase extends android.test.AndroidTestCase { ctor public ApplicationTestCase(java.lang.Class<T>); method protected final void createApplication(); method public T getApplication(); @@ -36872,10 +36872,10 @@ package android.test { ctor public ComparisonFailure(java.lang.String, java.lang.String, java.lang.String); } - public abstract class FlakyTest implements java.lang.annotation.Annotation { + public abstract deprecated class FlakyTest implements java.lang.annotation.Annotation { } - public class InstrumentationTestCase extends junit.framework.TestCase { + public deprecated class InstrumentationTestCase extends junit.framework.TestCase { ctor public InstrumentationTestCase(); method public android.app.Instrumentation getInstrumentation(); method public deprecated void injectInsrumentation(android.app.Instrumentation); @@ -36888,7 +36888,7 @@ package android.test { method public void sendRepeatedKeys(int...); } - public class InstrumentationTestRunner extends android.app.Instrumentation implements android.test.TestSuiteProvider { + public deprecated class InstrumentationTestRunner extends android.app.Instrumentation implements android.test.TestSuiteProvider { ctor public InstrumentationTestRunner(); method public junit.framework.TestSuite getAllTests(); method protected android.test.AndroidTestRunner getAndroidTestRunner(); @@ -36907,14 +36907,14 @@ package android.test { field public static final int REPORT_VALUE_RESULT_START = 1; // 0x1 } - public class InstrumentationTestSuite extends junit.framework.TestSuite { + public deprecated class InstrumentationTestSuite extends junit.framework.TestSuite { ctor public InstrumentationTestSuite(android.app.Instrumentation); ctor public InstrumentationTestSuite(java.lang.String, android.app.Instrumentation); ctor public InstrumentationTestSuite(java.lang.Class, android.app.Instrumentation); method public void addTestSuite(java.lang.Class); } - public class IsolatedContext extends android.content.ContextWrapper { + public deprecated class IsolatedContext extends android.content.ContextWrapper { ctor public IsolatedContext(android.content.ContentResolver, android.content.Context); method public java.util.List<android.content.Intent> getAndClearBroadcastIntents(); } @@ -36924,7 +36924,7 @@ package android.test { method public T getLoaderResultSynchronously(android.content.Loader<T>); } - public final class MoreAsserts { + public final deprecated class MoreAsserts { method public static void assertAssignableFrom(java.lang.Class<?>, java.lang.Object); method public static void assertAssignableFrom(java.lang.Class<?>, java.lang.Class<?>); method public static java.util.regex.MatchResult assertContainsRegex(java.lang.String, java.lang.String, java.lang.String); @@ -36963,7 +36963,7 @@ package android.test { method public static void checkEqualsAndHashCodeMethods(java.lang.Object, java.lang.Object, boolean); } - public abstract interface PerformanceTestCase { + public abstract deprecated interface PerformanceTestCase { method public abstract boolean isPerformanceOnly(); method public abstract int startPerformance(android.test.PerformanceTestCase.Intermediates); } @@ -36992,7 +36992,7 @@ package android.test { method public static android.content.ContentResolver newResolverWithContentProviderFromSql(android.content.Context, java.lang.String, java.lang.Class<T>, java.lang.String, java.lang.String, int, java.lang.String) throws java.lang.IllegalAccessException, java.lang.InstantiationException; } - public class RenamingDelegatingContext extends android.content.ContextWrapper { + public deprecated class RenamingDelegatingContext extends android.content.ContextWrapper { ctor public RenamingDelegatingContext(android.content.Context, java.lang.String); ctor public RenamingDelegatingContext(android.content.Context, android.content.Context, java.lang.String); method public java.lang.String getDatabasePrefix(); @@ -37001,7 +37001,7 @@ package android.test { method public static T providerWithRenamedContext(java.lang.Class<T>, android.content.Context, java.lang.String, boolean) throws java.lang.IllegalAccessException, java.lang.InstantiationException; } - public abstract class ServiceTestCase extends android.test.AndroidTestCase { + public abstract deprecated class ServiceTestCase extends android.test.AndroidTestCase { ctor public ServiceTestCase(java.lang.Class<T>); method protected android.os.IBinder bindService(android.content.Intent); method public android.app.Application getApplication(); @@ -37014,23 +37014,23 @@ package android.test { method public void testServiceTestCaseSetUpProperly() throws java.lang.Exception; } - public abstract class SingleLaunchActivityTestCase extends android.test.InstrumentationTestCase { + public abstract deprecated class SingleLaunchActivityTestCase extends android.test.InstrumentationTestCase { ctor public SingleLaunchActivityTestCase(java.lang.String, java.lang.Class<T>); method public T getActivity(); method public void testActivityTestCaseSetUpProperly() throws java.lang.Exception; } - public class SyncBaseInstrumentation extends android.test.InstrumentationTestCase { + public deprecated class SyncBaseInstrumentation extends android.test.InstrumentationTestCase { ctor public SyncBaseInstrumentation(); method protected void cancelSyncsandDisableAutoSync(); method protected void syncProvider(android.net.Uri, java.lang.String, java.lang.String) throws java.lang.Exception; } - public abstract interface TestSuiteProvider { + public abstract deprecated interface TestSuiteProvider { method public abstract junit.framework.TestSuite getTestSuite(); } - public class TouchUtils { + public deprecated class TouchUtils { ctor public TouchUtils(); method public static void clickView(android.test.InstrumentationTestCase, android.view.View); method public static deprecated void drag(android.test.ActivityInstrumentationTestCase, float, float, float, float, int); @@ -37065,10 +37065,10 @@ package android.test { method public static void touchAndCancelView(android.test.InstrumentationTestCase, android.view.View); } - public abstract class UiThreadTest implements java.lang.annotation.Annotation { + public abstract deprecated class UiThreadTest implements java.lang.annotation.Annotation { } - public class ViewAsserts { + public deprecated class ViewAsserts { method public static void assertBaselineAligned(android.view.View, android.view.View); method public static void assertBottomAligned(android.view.View, android.view.View); method public static void assertBottomAligned(android.view.View, android.view.View, int); @@ -37093,11 +37093,11 @@ package android.test { package android.test.mock { - public class MockApplication extends android.app.Application { + public deprecated class MockApplication extends android.app.Application { ctor public MockApplication(); } - public class MockContentProvider extends android.content.ContentProvider { + public deprecated class MockContentProvider extends android.content.ContentProvider { ctor protected MockContentProvider(); ctor public MockContentProvider(android.content.Context); ctor public MockContentProvider(android.content.Context, java.lang.String, java.lang.String, android.content.pm.PathPermission[]); @@ -37109,13 +37109,13 @@ package android.test.mock { method public int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]); } - public class MockContentResolver extends android.content.ContentResolver { + public deprecated class MockContentResolver extends android.content.ContentResolver { ctor public MockContentResolver(); ctor public MockContentResolver(android.content.Context); method public void addProvider(java.lang.String, android.content.ContentProvider); } - public class MockContext extends android.content.Context { + public deprecated class MockContext extends android.content.Context { ctor public MockContext(); method public boolean bindService(android.content.Intent, android.content.ServiceConnection, int); method public int checkCallingOrSelfPermission(java.lang.String); @@ -37215,7 +37215,7 @@ package android.test.mock { method public void unregisterReceiver(android.content.BroadcastReceiver); } - public class MockCursor implements android.database.Cursor { + public deprecated class MockCursor implements android.database.Cursor { ctor public MockCursor(); method public void close(); method public void copyStringToBuffer(int, android.database.CharArrayBuffer); @@ -37260,13 +37260,13 @@ package android.test.mock { method public void unregisterDataSetObserver(android.database.DataSetObserver); } - public class MockDialogInterface implements android.content.DialogInterface { + public deprecated class MockDialogInterface implements android.content.DialogInterface { ctor public MockDialogInterface(); method public void cancel(); method public void dismiss(); } - public class MockPackageManager extends android.content.pm.PackageManager { + public deprecated class MockPackageManager extends android.content.pm.PackageManager { ctor public MockPackageManager(); method public void addPackageToPreferred(java.lang.String); method public boolean addPermission(android.content.pm.PermissionInfo); @@ -37353,7 +37353,7 @@ package android.test.mock { method public void verifyPendingInstall(int, int); } - public class MockResources extends android.content.res.Resources { + public deprecated class MockResources extends android.content.res.Resources { ctor public MockResources(); } @@ -37394,19 +37394,19 @@ package android.test.suitebuilder { package android.test.suitebuilder.annotation { - public abstract class LargeTest implements java.lang.annotation.Annotation { + public abstract deprecated class LargeTest implements java.lang.annotation.Annotation { } - public abstract class MediumTest implements java.lang.annotation.Annotation { + public abstract deprecated class MediumTest implements java.lang.annotation.Annotation { } - public abstract class SmallTest implements java.lang.annotation.Annotation { + public abstract deprecated class SmallTest implements java.lang.annotation.Annotation { } - public abstract class Smoke implements java.lang.annotation.Annotation { + public abstract deprecated class Smoke implements java.lang.annotation.Annotation { } - public abstract class Suppress implements java.lang.annotation.Annotation { + public abstract deprecated class Suppress implements java.lang.annotation.Annotation { } } diff --git a/api/removed.txt b/api/removed.txt index 6b7961e9f1f6..2c6729d2c159 100644 --- a/api/removed.txt +++ b/api/removed.txt @@ -201,7 +201,7 @@ package android.provider { package android.test.mock { - public class MockPackageManager extends android.content.pm.PackageManager { + public deprecated class MockPackageManager extends android.content.pm.PackageManager { method public deprecated java.lang.String getDefaultBrowserPackageName(int); method public deprecated boolean setDefaultBrowserPackageName(java.lang.String, int); } diff --git a/api/system-current.txt b/api/system-current.txt index 8a413499e938..edd3609a9b92 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -39245,7 +39245,7 @@ package android.test { method public void testActivityTestCaseSetUpProperly() throws java.lang.Exception; } - public abstract class ActivityInstrumentationTestCase2 extends android.test.ActivityTestCase { + public abstract deprecated class ActivityInstrumentationTestCase2 extends android.test.ActivityTestCase { ctor public deprecated ActivityInstrumentationTestCase2(java.lang.String, java.lang.Class<T>); ctor public ActivityInstrumentationTestCase2(java.lang.Class<T>); method public T getActivity(); @@ -39253,14 +39253,14 @@ package android.test { method public void setActivityIntent(android.content.Intent); } - public abstract class ActivityTestCase extends android.test.InstrumentationTestCase { + public abstract deprecated class ActivityTestCase extends android.test.InstrumentationTestCase { ctor public ActivityTestCase(); method protected android.app.Activity getActivity(); method protected void scrubClass(java.lang.Class<?>) throws java.lang.IllegalAccessException; method protected void setActivity(android.app.Activity); } - public abstract class ActivityUnitTestCase extends android.test.ActivityTestCase { + public abstract deprecated class ActivityUnitTestCase extends android.test.ActivityTestCase { ctor public ActivityUnitTestCase(java.lang.Class<T>); method public T getActivity(); method public int getFinishedActivityRequest(); @@ -39273,7 +39273,7 @@ package android.test { method protected T startActivity(android.content.Intent, android.os.Bundle, java.lang.Object); } - public class AndroidTestCase extends junit.framework.TestCase { + public deprecated class AndroidTestCase extends junit.framework.TestCase { ctor public AndroidTestCase(); method public void assertActivityRequiresPermission(java.lang.String, java.lang.String, java.lang.String); method public void assertReadingContentUriRequiresPermission(android.net.Uri, java.lang.String); @@ -39285,7 +39285,7 @@ package android.test { field protected android.content.Context mContext; } - public class AndroidTestRunner extends junit.runner.BaseTestRunner { + public deprecated class AndroidTestRunner extends junit.runner.BaseTestRunner { ctor public AndroidTestRunner(); method public void addTestListener(junit.framework.TestListener); method public void clearTestListeners(); @@ -39306,7 +39306,7 @@ package android.test { method public void testStarted(java.lang.String); } - public abstract class ApplicationTestCase extends android.test.AndroidTestCase { + public abstract deprecated class ApplicationTestCase extends android.test.AndroidTestCase { ctor public ApplicationTestCase(java.lang.Class<T>); method protected final void createApplication(); method public T getApplication(); @@ -39324,10 +39324,10 @@ package android.test { ctor public ComparisonFailure(java.lang.String, java.lang.String, java.lang.String); } - public abstract class FlakyTest implements java.lang.annotation.Annotation { + public abstract deprecated class FlakyTest implements java.lang.annotation.Annotation { } - public class InstrumentationTestCase extends junit.framework.TestCase { + public deprecated class InstrumentationTestCase extends junit.framework.TestCase { ctor public InstrumentationTestCase(); method public android.app.Instrumentation getInstrumentation(); method public deprecated void injectInsrumentation(android.app.Instrumentation); @@ -39340,7 +39340,7 @@ package android.test { method public void sendRepeatedKeys(int...); } - public class InstrumentationTestRunner extends android.app.Instrumentation implements android.test.TestSuiteProvider { + public deprecated class InstrumentationTestRunner extends android.app.Instrumentation implements android.test.TestSuiteProvider { ctor public InstrumentationTestRunner(); method public junit.framework.TestSuite getAllTests(); method protected android.test.AndroidTestRunner getAndroidTestRunner(); @@ -39359,14 +39359,14 @@ package android.test { field public static final int REPORT_VALUE_RESULT_START = 1; // 0x1 } - public class InstrumentationTestSuite extends junit.framework.TestSuite { + public deprecated class InstrumentationTestSuite extends junit.framework.TestSuite { ctor public InstrumentationTestSuite(android.app.Instrumentation); ctor public InstrumentationTestSuite(java.lang.String, android.app.Instrumentation); ctor public InstrumentationTestSuite(java.lang.Class, android.app.Instrumentation); method public void addTestSuite(java.lang.Class); } - public class IsolatedContext extends android.content.ContextWrapper { + public deprecated class IsolatedContext extends android.content.ContextWrapper { ctor public IsolatedContext(android.content.ContentResolver, android.content.Context); method public java.util.List<android.content.Intent> getAndClearBroadcastIntents(); } @@ -39376,7 +39376,7 @@ package android.test { method public T getLoaderResultSynchronously(android.content.Loader<T>); } - public final class MoreAsserts { + public final deprecated class MoreAsserts { method public static void assertAssignableFrom(java.lang.Class<?>, java.lang.Object); method public static void assertAssignableFrom(java.lang.Class<?>, java.lang.Class<?>); method public static java.util.regex.MatchResult assertContainsRegex(java.lang.String, java.lang.String, java.lang.String); @@ -39415,7 +39415,7 @@ package android.test { method public static void checkEqualsAndHashCodeMethods(java.lang.Object, java.lang.Object, boolean); } - public abstract interface PerformanceTestCase { + public abstract deprecated interface PerformanceTestCase { method public abstract boolean isPerformanceOnly(); method public abstract int startPerformance(android.test.PerformanceTestCase.Intermediates); } @@ -39444,7 +39444,7 @@ package android.test { method public static android.content.ContentResolver newResolverWithContentProviderFromSql(android.content.Context, java.lang.String, java.lang.Class<T>, java.lang.String, java.lang.String, int, java.lang.String) throws java.lang.IllegalAccessException, java.lang.InstantiationException; } - public class RenamingDelegatingContext extends android.content.ContextWrapper { + public deprecated class RenamingDelegatingContext extends android.content.ContextWrapper { ctor public RenamingDelegatingContext(android.content.Context, java.lang.String); ctor public RenamingDelegatingContext(android.content.Context, android.content.Context, java.lang.String); method public java.lang.String getDatabasePrefix(); @@ -39453,7 +39453,7 @@ package android.test { method public static T providerWithRenamedContext(java.lang.Class<T>, android.content.Context, java.lang.String, boolean) throws java.lang.IllegalAccessException, java.lang.InstantiationException; } - public abstract class ServiceTestCase extends android.test.AndroidTestCase { + public abstract deprecated class ServiceTestCase extends android.test.AndroidTestCase { ctor public ServiceTestCase(java.lang.Class<T>); method protected android.os.IBinder bindService(android.content.Intent); method public android.app.Application getApplication(); @@ -39466,23 +39466,23 @@ package android.test { method public void testServiceTestCaseSetUpProperly() throws java.lang.Exception; } - public abstract class SingleLaunchActivityTestCase extends android.test.InstrumentationTestCase { + public abstract deprecated class SingleLaunchActivityTestCase extends android.test.InstrumentationTestCase { ctor public SingleLaunchActivityTestCase(java.lang.String, java.lang.Class<T>); method public T getActivity(); method public void testActivityTestCaseSetUpProperly() throws java.lang.Exception; } - public class SyncBaseInstrumentation extends android.test.InstrumentationTestCase { + public deprecated class SyncBaseInstrumentation extends android.test.InstrumentationTestCase { ctor public SyncBaseInstrumentation(); method protected void cancelSyncsandDisableAutoSync(); method protected void syncProvider(android.net.Uri, java.lang.String, java.lang.String) throws java.lang.Exception; } - public abstract interface TestSuiteProvider { + public abstract deprecated interface TestSuiteProvider { method public abstract junit.framework.TestSuite getTestSuite(); } - public class TouchUtils { + public deprecated class TouchUtils { ctor public TouchUtils(); method public static void clickView(android.test.InstrumentationTestCase, android.view.View); method public static deprecated void drag(android.test.ActivityInstrumentationTestCase, float, float, float, float, int); @@ -39517,10 +39517,10 @@ package android.test { method public static void touchAndCancelView(android.test.InstrumentationTestCase, android.view.View); } - public abstract class UiThreadTest implements java.lang.annotation.Annotation { + public abstract deprecated class UiThreadTest implements java.lang.annotation.Annotation { } - public class ViewAsserts { + public deprecated class ViewAsserts { method public static void assertBaselineAligned(android.view.View, android.view.View); method public static void assertBottomAligned(android.view.View, android.view.View); method public static void assertBottomAligned(android.view.View, android.view.View, int); @@ -39545,11 +39545,11 @@ package android.test { package android.test.mock { - public class MockApplication extends android.app.Application { + public deprecated class MockApplication extends android.app.Application { ctor public MockApplication(); } - public class MockContentProvider extends android.content.ContentProvider { + public deprecated class MockContentProvider extends android.content.ContentProvider { ctor protected MockContentProvider(); ctor public MockContentProvider(android.content.Context); ctor public MockContentProvider(android.content.Context, java.lang.String, java.lang.String, android.content.pm.PathPermission[]); @@ -39561,13 +39561,13 @@ package android.test.mock { method public int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]); } - public class MockContentResolver extends android.content.ContentResolver { + public deprecated class MockContentResolver extends android.content.ContentResolver { ctor public MockContentResolver(); ctor public MockContentResolver(android.content.Context); method public void addProvider(java.lang.String, android.content.ContentProvider); } - public class MockContext extends android.content.Context { + public deprecated class MockContext extends android.content.Context { ctor public MockContext(); method public boolean bindService(android.content.Intent, android.content.ServiceConnection, int); method public int checkCallingOrSelfPermission(java.lang.String); @@ -39671,7 +39671,7 @@ package android.test.mock { method public void unregisterReceiver(android.content.BroadcastReceiver); } - public class MockCursor implements android.database.Cursor { + public deprecated class MockCursor implements android.database.Cursor { ctor public MockCursor(); method public void close(); method public void copyStringToBuffer(int, android.database.CharArrayBuffer); @@ -39716,13 +39716,13 @@ package android.test.mock { method public void unregisterDataSetObserver(android.database.DataSetObserver); } - public class MockDialogInterface implements android.content.DialogInterface { + public deprecated class MockDialogInterface implements android.content.DialogInterface { ctor public MockDialogInterface(); method public void cancel(); method public void dismiss(); } - public class MockPackageManager extends android.content.pm.PackageManager { + public deprecated class MockPackageManager extends android.content.pm.PackageManager { ctor public MockPackageManager(); method public void addOnPermissionsChangeListener(android.content.pm.PackageManager.OnPermissionsChangedListener); method public void addPackageToPreferred(java.lang.String); @@ -39816,7 +39816,7 @@ package android.test.mock { method public void verifyPendingInstall(int, int); } - public class MockResources extends android.content.res.Resources { + public deprecated class MockResources extends android.content.res.Resources { ctor public MockResources(); } @@ -39857,19 +39857,19 @@ package android.test.suitebuilder { package android.test.suitebuilder.annotation { - public abstract class LargeTest implements java.lang.annotation.Annotation { + public abstract deprecated class LargeTest implements java.lang.annotation.Annotation { } - public abstract class MediumTest implements java.lang.annotation.Annotation { + public abstract deprecated class MediumTest implements java.lang.annotation.Annotation { } - public abstract class SmallTest implements java.lang.annotation.Annotation { + public abstract deprecated class SmallTest implements java.lang.annotation.Annotation { } - public abstract class Smoke implements java.lang.annotation.Annotation { + public abstract deprecated class Smoke implements java.lang.annotation.Annotation { } - public abstract class Suppress implements java.lang.annotation.Annotation { + public abstract deprecated class Suppress implements java.lang.annotation.Annotation { } } diff --git a/api/system-removed.txt b/api/system-removed.txt index 90a5dc7c474f..27de91312fae 100644 --- a/api/system-removed.txt +++ b/api/system-removed.txt @@ -192,7 +192,7 @@ package android.provider { package android.test.mock { - public class MockPackageManager extends android.content.pm.PackageManager { + public deprecated class MockPackageManager extends android.content.pm.PackageManager { method public deprecated java.lang.String getDefaultBrowserPackageName(int); method public deprecated boolean setDefaultBrowserPackageName(java.lang.String, int); } diff --git a/api/test-current.txt b/api/test-current.txt index 169bb613846a..9307869f5c7e 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -36807,7 +36807,7 @@ package android.test { method public void testActivityTestCaseSetUpProperly() throws java.lang.Exception; } - public abstract class ActivityInstrumentationTestCase2 extends android.test.ActivityTestCase { + public abstract deprecated class ActivityInstrumentationTestCase2 extends android.test.ActivityTestCase { ctor public deprecated ActivityInstrumentationTestCase2(java.lang.String, java.lang.Class<T>); ctor public ActivityInstrumentationTestCase2(java.lang.Class<T>); method public T getActivity(); @@ -36815,14 +36815,14 @@ package android.test { method public void setActivityIntent(android.content.Intent); } - public abstract class ActivityTestCase extends android.test.InstrumentationTestCase { + public abstract deprecated class ActivityTestCase extends android.test.InstrumentationTestCase { ctor public ActivityTestCase(); method protected android.app.Activity getActivity(); method protected void scrubClass(java.lang.Class<?>) throws java.lang.IllegalAccessException; method protected void setActivity(android.app.Activity); } - public abstract class ActivityUnitTestCase extends android.test.ActivityTestCase { + public abstract deprecated class ActivityUnitTestCase extends android.test.ActivityTestCase { ctor public ActivityUnitTestCase(java.lang.Class<T>); method public T getActivity(); method public int getFinishedActivityRequest(); @@ -36835,7 +36835,7 @@ package android.test { method protected T startActivity(android.content.Intent, android.os.Bundle, java.lang.Object); } - public class AndroidTestCase extends junit.framework.TestCase { + public deprecated class AndroidTestCase extends junit.framework.TestCase { ctor public AndroidTestCase(); method public void assertActivityRequiresPermission(java.lang.String, java.lang.String, java.lang.String); method public void assertReadingContentUriRequiresPermission(android.net.Uri, java.lang.String); @@ -36847,7 +36847,7 @@ package android.test { field protected android.content.Context mContext; } - public class AndroidTestRunner extends junit.runner.BaseTestRunner { + public deprecated class AndroidTestRunner extends junit.runner.BaseTestRunner { ctor public AndroidTestRunner(); method public void addTestListener(junit.framework.TestListener); method public void clearTestListeners(); @@ -36868,7 +36868,7 @@ package android.test { method public void testStarted(java.lang.String); } - public abstract class ApplicationTestCase extends android.test.AndroidTestCase { + public abstract deprecated class ApplicationTestCase extends android.test.AndroidTestCase { ctor public ApplicationTestCase(java.lang.Class<T>); method protected final void createApplication(); method public T getApplication(); @@ -36886,10 +36886,10 @@ package android.test { ctor public ComparisonFailure(java.lang.String, java.lang.String, java.lang.String); } - public abstract class FlakyTest implements java.lang.annotation.Annotation { + public abstract deprecated class FlakyTest implements java.lang.annotation.Annotation { } - public class InstrumentationTestCase extends junit.framework.TestCase { + public deprecated class InstrumentationTestCase extends junit.framework.TestCase { ctor public InstrumentationTestCase(); method public android.app.Instrumentation getInstrumentation(); method public deprecated void injectInsrumentation(android.app.Instrumentation); @@ -36902,7 +36902,7 @@ package android.test { method public void sendRepeatedKeys(int...); } - public class InstrumentationTestRunner extends android.app.Instrumentation implements android.test.TestSuiteProvider { + public deprecated class InstrumentationTestRunner extends android.app.Instrumentation implements android.test.TestSuiteProvider { ctor public InstrumentationTestRunner(); method public junit.framework.TestSuite getAllTests(); method protected android.test.AndroidTestRunner getAndroidTestRunner(); @@ -36921,14 +36921,14 @@ package android.test { field public static final int REPORT_VALUE_RESULT_START = 1; // 0x1 } - public class InstrumentationTestSuite extends junit.framework.TestSuite { + public deprecated class InstrumentationTestSuite extends junit.framework.TestSuite { ctor public InstrumentationTestSuite(android.app.Instrumentation); ctor public InstrumentationTestSuite(java.lang.String, android.app.Instrumentation); ctor public InstrumentationTestSuite(java.lang.Class, android.app.Instrumentation); method public void addTestSuite(java.lang.Class); } - public class IsolatedContext extends android.content.ContextWrapper { + public deprecated class IsolatedContext extends android.content.ContextWrapper { ctor public IsolatedContext(android.content.ContentResolver, android.content.Context); method public java.util.List<android.content.Intent> getAndClearBroadcastIntents(); } @@ -36938,7 +36938,7 @@ package android.test { method public T getLoaderResultSynchronously(android.content.Loader<T>); } - public final class MoreAsserts { + public final deprecated class MoreAsserts { method public static void assertAssignableFrom(java.lang.Class<?>, java.lang.Object); method public static void assertAssignableFrom(java.lang.Class<?>, java.lang.Class<?>); method public static java.util.regex.MatchResult assertContainsRegex(java.lang.String, java.lang.String, java.lang.String); @@ -36977,7 +36977,7 @@ package android.test { method public static void checkEqualsAndHashCodeMethods(java.lang.Object, java.lang.Object, boolean); } - public abstract interface PerformanceTestCase { + public abstract deprecated interface PerformanceTestCase { method public abstract boolean isPerformanceOnly(); method public abstract int startPerformance(android.test.PerformanceTestCase.Intermediates); } @@ -37006,7 +37006,7 @@ package android.test { method public static android.content.ContentResolver newResolverWithContentProviderFromSql(android.content.Context, java.lang.String, java.lang.Class<T>, java.lang.String, java.lang.String, int, java.lang.String) throws java.lang.IllegalAccessException, java.lang.InstantiationException; } - public class RenamingDelegatingContext extends android.content.ContextWrapper { + public deprecated class RenamingDelegatingContext extends android.content.ContextWrapper { ctor public RenamingDelegatingContext(android.content.Context, java.lang.String); ctor public RenamingDelegatingContext(android.content.Context, android.content.Context, java.lang.String); method public java.lang.String getDatabasePrefix(); @@ -37015,7 +37015,7 @@ package android.test { method public static T providerWithRenamedContext(java.lang.Class<T>, android.content.Context, java.lang.String, boolean) throws java.lang.IllegalAccessException, java.lang.InstantiationException; } - public abstract class ServiceTestCase extends android.test.AndroidTestCase { + public abstract deprecated class ServiceTestCase extends android.test.AndroidTestCase { ctor public ServiceTestCase(java.lang.Class<T>); method protected android.os.IBinder bindService(android.content.Intent); method public android.app.Application getApplication(); @@ -37028,23 +37028,23 @@ package android.test { method public void testServiceTestCaseSetUpProperly() throws java.lang.Exception; } - public abstract class SingleLaunchActivityTestCase extends android.test.InstrumentationTestCase { + public abstract deprecated class SingleLaunchActivityTestCase extends android.test.InstrumentationTestCase { ctor public SingleLaunchActivityTestCase(java.lang.String, java.lang.Class<T>); method public T getActivity(); method public void testActivityTestCaseSetUpProperly() throws java.lang.Exception; } - public class SyncBaseInstrumentation extends android.test.InstrumentationTestCase { + public deprecated class SyncBaseInstrumentation extends android.test.InstrumentationTestCase { ctor public SyncBaseInstrumentation(); method protected void cancelSyncsandDisableAutoSync(); method protected void syncProvider(android.net.Uri, java.lang.String, java.lang.String) throws java.lang.Exception; } - public abstract interface TestSuiteProvider { + public abstract deprecated interface TestSuiteProvider { method public abstract junit.framework.TestSuite getTestSuite(); } - public class TouchUtils { + public deprecated class TouchUtils { ctor public TouchUtils(); method public static void clickView(android.test.InstrumentationTestCase, android.view.View); method public static deprecated void drag(android.test.ActivityInstrumentationTestCase, float, float, float, float, int); @@ -37079,10 +37079,10 @@ package android.test { method public static void touchAndCancelView(android.test.InstrumentationTestCase, android.view.View); } - public abstract class UiThreadTest implements java.lang.annotation.Annotation { + public abstract deprecated class UiThreadTest implements java.lang.annotation.Annotation { } - public class ViewAsserts { + public deprecated class ViewAsserts { method public static void assertBaselineAligned(android.view.View, android.view.View); method public static void assertBottomAligned(android.view.View, android.view.View); method public static void assertBottomAligned(android.view.View, android.view.View, int); @@ -37107,11 +37107,11 @@ package android.test { package android.test.mock { - public class MockApplication extends android.app.Application { + public deprecated class MockApplication extends android.app.Application { ctor public MockApplication(); } - public class MockContentProvider extends android.content.ContentProvider { + public deprecated class MockContentProvider extends android.content.ContentProvider { ctor protected MockContentProvider(); ctor public MockContentProvider(android.content.Context); ctor public MockContentProvider(android.content.Context, java.lang.String, java.lang.String, android.content.pm.PathPermission[]); @@ -37123,13 +37123,13 @@ package android.test.mock { method public int update(android.net.Uri, android.content.ContentValues, java.lang.String, java.lang.String[]); } - public class MockContentResolver extends android.content.ContentResolver { + public deprecated class MockContentResolver extends android.content.ContentResolver { ctor public MockContentResolver(); ctor public MockContentResolver(android.content.Context); method public void addProvider(java.lang.String, android.content.ContentProvider); } - public class MockContext extends android.content.Context { + public deprecated class MockContext extends android.content.Context { ctor public MockContext(); method public boolean bindService(android.content.Intent, android.content.ServiceConnection, int); method public int checkCallingOrSelfPermission(java.lang.String); @@ -37230,7 +37230,7 @@ package android.test.mock { method public void unregisterReceiver(android.content.BroadcastReceiver); } - public class MockCursor implements android.database.Cursor { + public deprecated class MockCursor implements android.database.Cursor { ctor public MockCursor(); method public void close(); method public void copyStringToBuffer(int, android.database.CharArrayBuffer); @@ -37275,13 +37275,13 @@ package android.test.mock { method public void unregisterDataSetObserver(android.database.DataSetObserver); } - public class MockDialogInterface implements android.content.DialogInterface { + public deprecated class MockDialogInterface implements android.content.DialogInterface { ctor public MockDialogInterface(); method public void cancel(); method public void dismiss(); } - public class MockPackageManager extends android.content.pm.PackageManager { + public deprecated class MockPackageManager extends android.content.pm.PackageManager { ctor public MockPackageManager(); method public void addPackageToPreferred(java.lang.String); method public boolean addPermission(android.content.pm.PermissionInfo); @@ -37369,7 +37369,7 @@ package android.test.mock { method public void verifyPendingInstall(int, int); } - public class MockResources extends android.content.res.Resources { + public deprecated class MockResources extends android.content.res.Resources { ctor public MockResources(); } @@ -37410,19 +37410,19 @@ package android.test.suitebuilder { package android.test.suitebuilder.annotation { - public abstract class LargeTest implements java.lang.annotation.Annotation { + public abstract deprecated class LargeTest implements java.lang.annotation.Annotation { } - public abstract class MediumTest implements java.lang.annotation.Annotation { + public abstract deprecated class MediumTest implements java.lang.annotation.Annotation { } - public abstract class SmallTest implements java.lang.annotation.Annotation { + public abstract deprecated class SmallTest implements java.lang.annotation.Annotation { } - public abstract class Smoke implements java.lang.annotation.Annotation { + public abstract deprecated class Smoke implements java.lang.annotation.Annotation { } - public abstract class Suppress implements java.lang.annotation.Annotation { + public abstract deprecated class Suppress implements java.lang.annotation.Annotation { } } diff --git a/api/test-removed.txt b/api/test-removed.txt index 6b7961e9f1f6..2c6729d2c159 100644 --- a/api/test-removed.txt +++ b/api/test-removed.txt @@ -201,7 +201,7 @@ package android.provider { package android.test.mock { - public class MockPackageManager extends android.content.pm.PackageManager { + public deprecated class MockPackageManager extends android.content.pm.PackageManager { method public deprecated java.lang.String getDefaultBrowserPackageName(int); method public deprecated boolean setDefaultBrowserPackageName(java.lang.String, int); } diff --git a/core/java/android/test/AndroidTestCase.java b/core/java/android/test/AndroidTestCase.java index 2ecbfae6fede..1e6bd9c14fd9 100644 --- a/core/java/android/test/AndroidTestCase.java +++ b/core/java/android/test/AndroidTestCase.java @@ -29,7 +29,13 @@ import java.lang.reflect.Modifier; /** * Extend this if you need to access Resources or other things that depend on Activity Context. + * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/InstrumentationRegistry.html"> + * InstrumentationRegistry</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class AndroidTestCase extends TestCase { protected Context mContext; diff --git a/core/java/android/test/FlakyTest.java b/core/java/android/test/FlakyTest.java index 919767f9e999..4e5c4e35a8c6 100644 --- a/core/java/android/test/FlakyTest.java +++ b/core/java/android/test/FlakyTest.java @@ -26,7 +26,13 @@ import java.lang.annotation.ElementType; * test methods. When the annotation is present, the test method is re-executed if * the test fails. The total number of executions is specified by the tolerance and * defaults to 1. + * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/filters/FlakyTest.html"> + * FlakyTest</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface FlakyTest { diff --git a/core/java/android/test/InstrumentationTestCase.java b/core/java/android/test/InstrumentationTestCase.java index ca427ea6a4c5..6b79314a4385 100644 --- a/core/java/android/test/InstrumentationTestCase.java +++ b/core/java/android/test/InstrumentationTestCase.java @@ -32,7 +32,13 @@ import junit.framework.TestCase; /** * A test case that has access to {@link Instrumentation}. + * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/InstrumentationRegistry.html"> + * InstrumentationRegistry</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class InstrumentationTestCase extends TestCase { private Instrumentation mInstrumentation; @@ -40,7 +46,7 @@ public class InstrumentationTestCase extends TestCase { /** * Injects instrumentation into this test case. This method is * called by the test runner during test setup. - * + * * @param instrumentation the instrumentation to use with this instance */ public void injectInstrumentation(Instrumentation instrumentation) { diff --git a/core/java/android/test/InstrumentationTestSuite.java b/core/java/android/test/InstrumentationTestSuite.java index 7a78ffbb226d..a53fa267f1e1 100644 --- a/core/java/android/test/InstrumentationTestSuite.java +++ b/core/java/android/test/InstrumentationTestSuite.java @@ -25,7 +25,13 @@ import junit.framework.TestResult; /** * A {@link junit.framework.TestSuite} that injects {@link android.app.Instrumentation} into * {@link InstrumentationTestCase} before running them. + * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/InstrumentationRegistry.html"> + * InstrumentationRegistry</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class InstrumentationTestSuite extends TestSuite { private final Instrumentation mInstrumentation; diff --git a/core/java/android/test/PerformanceTestCase.java b/core/java/android/test/PerformanceTestCase.java index 679ad406c733..65bd4a48f7f5 100644 --- a/core/java/android/test/PerformanceTestCase.java +++ b/core/java/android/test/PerformanceTestCase.java @@ -18,10 +18,11 @@ package android.test; /** * More complex interface performance for test cases. - * + * * If you want your test to be used as a performance test, you must * implement this interface. */ +@Deprecated public interface PerformanceTestCase { /** @@ -37,27 +38,27 @@ public interface PerformanceTestCase } /** - * Set up to begin performance tests. The 'intermediates' is a + * Set up to begin performance tests. The 'intermediates' is a * communication channel to send back intermediate performance numbers -- * if you use it, you will probably want to ensure your test is only * executed once by returning 1. Otherwise, return 0 to allow the test * harness to decide the number of iterations. - * + * * <p>If you return a non-zero iteration count, you should call * {@link Intermediates#startTiming intermediates.startTiming} and * {@link Intermediates#finishTiming intermediates.endTiming} to report the * duration of the test whose performance should actually be measured. - * + * * @param intermediates Callback for sending intermediate results. - * + * * @return int Maximum number of iterations to run, or 0 to let the caller - * decide. + * decide. */ int startPerformance(Intermediates intermediates); - + /** * This method is used to determine what modes this test case can run in. - * + * * @return true if this test case can only be run in performance mode. */ boolean isPerformanceOnly(); diff --git a/core/java/android/test/UiThreadTest.java b/core/java/android/test/UiThreadTest.java index cd9223184da2..cd06ab890074 100644 --- a/core/java/android/test/UiThreadTest.java +++ b/core/java/android/test/UiThreadTest.java @@ -26,7 +26,13 @@ import java.lang.annotation.ElementType; * When the annotation is present, the test method is executed on the application's * main thread (or UI thread.) Note that instrumentation methods may not be used * when this annotation is present. + * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/annotation/UiThreadTest.html"> + * UiThreadTest</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface UiThreadTest { diff --git a/core/java/android/test/suitebuilder/annotation/LargeTest.java b/core/java/android/test/suitebuilder/annotation/LargeTest.java index a6269e787556..dc77ee6b2739 100644 --- a/core/java/android/test/suitebuilder/annotation/LargeTest.java +++ b/core/java/android/test/suitebuilder/annotation/LargeTest.java @@ -23,7 +23,13 @@ import java.lang.annotation.Target; /** * Marks a test that should run as part of the large tests. + * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/filters/LargeTest.html"> + * LargeTest</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface LargeTest { diff --git a/core/java/android/test/suitebuilder/annotation/MediumTest.java b/core/java/android/test/suitebuilder/annotation/MediumTest.java index 8afeb911d065..b941da03ac9a 100644 --- a/core/java/android/test/suitebuilder/annotation/MediumTest.java +++ b/core/java/android/test/suitebuilder/annotation/MediumTest.java @@ -24,7 +24,12 @@ import java.lang.annotation.Target; /** * Marks a test that should run as part of the medium tests. * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/filters/MediumTest.html"> + * MediumTest</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface MediumTest { diff --git a/core/java/android/test/suitebuilder/annotation/SmallTest.java b/core/java/android/test/suitebuilder/annotation/SmallTest.java index ad530e287343..d3c74f019b53 100644 --- a/core/java/android/test/suitebuilder/annotation/SmallTest.java +++ b/core/java/android/test/suitebuilder/annotation/SmallTest.java @@ -23,7 +23,13 @@ import java.lang.annotation.Target; /** * Marks a test that should run as part of the small tests. + * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/filters/SmallTest.html"> + * SmallTest</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface SmallTest { diff --git a/core/java/android/test/suitebuilder/annotation/Smoke.java b/core/java/android/test/suitebuilder/annotation/Smoke.java index 237e0333b4ef..aac293796be1 100644 --- a/core/java/android/test/suitebuilder/annotation/Smoke.java +++ b/core/java/android/test/suitebuilder/annotation/Smoke.java @@ -27,7 +27,11 @@ import java.lang.annotation.Target; * will run all tests with this annotation. * * @see android.test.suitebuilder.SmokeTestSuiteBuilder + * + * @deprecated New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface Smoke { diff --git a/core/java/android/test/suitebuilder/annotation/Suppress.java b/core/java/android/test/suitebuilder/annotation/Suppress.java index f16c8fafa4af..629a3cf4a2cd 100644 --- a/core/java/android/test/suitebuilder/annotation/Suppress.java +++ b/core/java/android/test/suitebuilder/annotation/Suppress.java @@ -26,7 +26,12 @@ import java.lang.annotation.ElementType; * suite. If the annotation appears on the class then no tests in that class will be included. If * the annotation appears only on a test method then only that method will be excluded. * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/filters/Suppress.html"> + * Suppress</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface Suppress { diff --git a/test-runner/src/android/test/ActivityInstrumentationTestCase.java b/test-runner/src/android/test/ActivityInstrumentationTestCase.java index a59ee35c2085..aca1c160ba84 100644 --- a/test-runner/src/android/test/ActivityInstrumentationTestCase.java +++ b/test-runner/src/android/test/ActivityInstrumentationTestCase.java @@ -23,15 +23,15 @@ import android.app.Activity; * be created using the system infrastructure (by calling InstrumentationTestCase.launchActivity()) * and you will then be able to manipulate your Activity directly. Most of the work is handled * automatically here by {@link #setUp} and {@link #tearDown}. - * + * * <p>If you prefer an isolated unit test, see {@link android.test.ActivityUnitTestCase}. - * - * @deprecated new tests should be written using + * + * @deprecated new tests should be written using * {@link android.test.ActivityInstrumentationTestCase2}, which provides more options for * configuring the Activity under test */ @Deprecated -public abstract class ActivityInstrumentationTestCase<T extends Activity> +public abstract class ActivityInstrumentationTestCase<T extends Activity> extends ActivityTestCase { String mPackage; Class<T> mActivityClass; @@ -39,7 +39,7 @@ public abstract class ActivityInstrumentationTestCase<T extends Activity> /** * Creates an {@link ActivityInstrumentationTestCase} in non-touch mode. - * + * * @param pkg ignored - no longer in use. * @param activityClass The activity to test. This must be a class in the instrumentation * targetPackage specified in the AndroidManifest.xml @@ -56,7 +56,7 @@ public abstract class ActivityInstrumentationTestCase<T extends Activity> * targetPackage specified in the AndroidManifest.xml * @param initialTouchMode true = in touch mode */ - public ActivityInstrumentationTestCase(String pkg, Class<T> activityClass, + public ActivityInstrumentationTestCase(String pkg, Class<T> activityClass, boolean initialTouchMode) { mActivityClass = activityClass; mInitialTouchMode = initialTouchMode; @@ -80,8 +80,8 @@ public abstract class ActivityInstrumentationTestCase<T extends Activity> protected void tearDown() throws Exception { getActivity().finish(); setActivity(null); - - // Scrub out members - protects against memory leaks in the case where someone + + // Scrub out members - protects against memory leaks in the case where someone // creates a non-static inner class (thus referencing the test case) and gives it to // someone else to hold onto scrubClass(ActivityInstrumentationTestCase.class); diff --git a/test-runner/src/android/test/ActivityInstrumentationTestCase2.java b/test-runner/src/android/test/ActivityInstrumentationTestCase2.java index c4bcf312ad9c..0e61ce727c40 100644 --- a/test-runner/src/android/test/ActivityInstrumentationTestCase2.java +++ b/test-runner/src/android/test/ActivityInstrumentationTestCase2.java @@ -25,26 +25,26 @@ import java.lang.reflect.Method; * This class provides functional testing of a single activity. The activity under test will * be created using the system infrastructure (by calling InstrumentationTestCase.launchActivity()) * and you will then be able to manipulate your Activity directly. - * + * * <p>Other options supported by this test case include: * <ul> * <li>You can run any test method on the UI thread (see {@link android.test.UiThreadTest}).</li> - * <li>You can inject custom Intents into your Activity (see + * <li>You can inject custom Intents into your Activity (see * {@link #setActivityIntent(Intent)}).</li> * </ul> - * + * * <p>This class replaces {@link android.test.ActivityInstrumentationTestCase}, which is deprecated. * New tests should be written using this base class. - * + * * <p>If you prefer an isolated unit test, see {@link android.test.ActivityUnitTestCase}. * - * <div class="special reference"> - * <h3>Developer Guides</h3> - * <p>For more information about application testing, read the - * <a href="{@docRoot}guide/topics/testing/index.html">Testing</a> developer guide.</p> - * </div> + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/rule/ActivityTestRule.html"> + * ActivityTestRule</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ -public abstract class ActivityInstrumentationTestCase2<T extends Activity> +@Deprecated +public abstract class ActivityInstrumentationTestCase2<T extends Activity> extends ActivityTestCase { Class<T> mActivityClass; boolean mInitialTouchMode = false; @@ -78,18 +78,18 @@ public abstract class ActivityInstrumentationTestCase2<T extends Activity> * Get the Activity under test, starting it if necessary. * * For each test method invocation, the Activity will not actually be created until the first - * time this method is called. - * - * <p>If you wish to provide custom setup values to your Activity, you may call - * {@link #setActivityIntent(Intent)} and/or {@link #setActivityInitialTouchMode(boolean)} - * before your first call to getActivity(). Calling them after your Activity has + * time this method is called. + * + * <p>If you wish to provide custom setup values to your Activity, you may call + * {@link #setActivityIntent(Intent)} and/or {@link #setActivityInitialTouchMode(boolean)} + * before your first call to getActivity(). Calling them after your Activity has * started will have no effect. * * <p><b>NOTE:</b> Activities under test may not be started from within the UI thread. * If your test method is annotated with {@link android.test.UiThreadTest}, then your Activity * will be started automatically just before your test method is run. You still call this * method in order to get the Activity under test. - * + * * @return the Activity under test */ @Override @@ -113,10 +113,10 @@ public abstract class ActivityInstrumentationTestCase2<T extends Activity> /** * Call this method before the first call to {@link #getActivity} to inject a customized Intent * into the Activity under test. - * + * * <p>If you do not call this, the default intent will be provided. If you call this after * your Activity has been started, it will have no effect. - * + * * <p><b>NOTE:</b> Activities under test may not be started from within the UI thread. * If your test method is annotated with {@link android.test.UiThreadTest}, then you must call * {@link #setActivityIntent(Intent)} from {@link #setUp()}. @@ -131,28 +131,28 @@ public abstract class ActivityInstrumentationTestCase2<T extends Activity> public void setActivityIntent(Intent i) { mActivityIntent = i; } - + /** * Call this method before the first call to {@link #getActivity} to set the initial touch * mode for the Activity under test. - * + * * <p>If you do not call this, the touch mode will be false. If you call this after * your Activity has been started, it will have no effect. - * + * * <p><b>NOTE:</b> Activities under test may not be started from within the UI thread. * If your test method is annotated with {@link android.test.UiThreadTest}, then you must call * {@link #setActivityInitialTouchMode(boolean)} from {@link #setUp()}. - * + * * @param initialTouchMode true if the Activity should be placed into "touch mode" when started */ public void setActivityInitialTouchMode(boolean initialTouchMode) { mInitialTouchMode = initialTouchMode; } - + @Override protected void setUp() throws Exception { super.setUp(); - + mInitialTouchMode = false; mActivityIntent = null; } @@ -165,8 +165,8 @@ public abstract class ActivityInstrumentationTestCase2<T extends Activity> a.finish(); setActivity(null); } - - // Scrub out members - protects against memory leaks in the case where someone + + // Scrub out members - protects against memory leaks in the case where someone // creates a non-static inner class (thus referencing the test case) and gives it to // someone else to hold onto scrubClass(ActivityInstrumentationTestCase2.class); diff --git a/test-runner/src/android/test/ActivityTestCase.java b/test-runner/src/android/test/ActivityTestCase.java index c7b1d7017fc2..51dd3ef8c35b 100644 --- a/test-runner/src/android/test/ActivityTestCase.java +++ b/test-runner/src/android/test/ActivityTestCase.java @@ -25,7 +25,11 @@ import java.lang.reflect.Modifier; * This is common code used to support Activity test cases. For more useful classes, please see * {@link android.test.ActivityUnitTestCase} and * {@link android.test.ActivityInstrumentationTestCase}. + * + * @deprecated New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public abstract class ActivityTestCase extends InstrumentationTestCase { /** diff --git a/test-runner/src/android/test/ActivityUnitTestCase.java b/test-runner/src/android/test/ActivityUnitTestCase.java index 40cca90d1b42..a191445d8af5 100644 --- a/test-runner/src/android/test/ActivityUnitTestCase.java +++ b/test-runner/src/android/test/ActivityUnitTestCase.java @@ -32,14 +32,14 @@ import android.util.Log; /** * This class provides isolated testing of a single activity. The activity under test will - * be created with minimal connection to the system infrastructure, and you can inject mocked or + * be created with minimal connection to the system infrastructure, and you can inject mocked or * wrappered versions of many of Activity's dependencies. Most of the work is handled * automatically here by {@link #setUp} and {@link #tearDown}. - * + * * <p>If you prefer a functional test, see {@link android.test.ActivityInstrumentationTestCase}. - * + * * <p>It must be noted that, as a true unit test, your Activity will not be running in the - * normal system and will not participate in the normal interactions with other Activities. + * normal system and will not participate in the normal interactions with other Activities. * The following methods should not be called in this configuration - most of them will throw * exceptions: * <ul> @@ -54,17 +54,17 @@ import android.util.Log; * <li>{@link android.app.Activity#isTaskRoot()}</li> * <li>{@link android.app.Activity#moveTaskToBack(boolean)}</li> * </ul> - * - * <p>The following methods may be called but will not do anything. For test purposes, you can use - * the methods {@link #getStartedActivityIntent()} and {@link #getStartedActivityRequest()} to + * + * <p>The following methods may be called but will not do anything. For test purposes, you can use + * the methods {@link #getStartedActivityIntent()} and {@link #getStartedActivityRequest()} to * inspect the parameters that they were called with. * <ul> * <li>{@link android.app.Activity#startActivity(Intent)}</li> * <li>{@link android.app.Activity#startActivityForResult(Intent, int)}</li> * </ul> * - * <p>The following methods may be called but will not do anything. For test purposes, you can use - * the methods {@link #isFinishCalled()} and {@link #getFinishedActivityRequest()} to inspect the + * <p>The following methods may be called but will not do anything. For test purposes, you can use + * the methods {@link #isFinishCalled()} and {@link #getFinishedActivityRequest()} to inspect the * parameters that they were called with. * <ul> * <li>{@link android.app.Activity#finish()}</li> @@ -72,8 +72,12 @@ import android.util.Log; * <li>{@link android.app.Activity#finishActivity(int requestCode)}</li> * </ul> * + * @deprecated Write + * <a href="{@docRoot}training/testing/unit-testing/local-unit-tests.html">Local Unit Tests</a> + * instead. */ -public abstract class ActivityUnitTestCase<T extends Activity> +@Deprecated +public abstract class ActivityUnitTestCase<T extends Activity> extends ActivityTestCase { private static final String TAG = "ActivityUnitTestCase"; @@ -102,31 +106,31 @@ public abstract class ActivityUnitTestCase<T extends Activity> // default value for target context, as a default mActivityContext = getInstrumentation().getTargetContext(); } - + /** * Start the activity under test, in the same way as if it was started by - * {@link android.content.Context#startActivity Context.startActivity()}, providing the + * {@link android.content.Context#startActivity Context.startActivity()}, providing the * arguments it supplied. When you use this method to start the activity, it will automatically * be stopped by {@link #tearDown}. - * - * <p>This method will call onCreate(), but if you wish to further exercise Activity life + * + * <p>This method will call onCreate(), but if you wish to further exercise Activity life * cycle methods, you must call them yourself from your test case. - * + * * <p><i>Do not call from your setUp() method. You must call this method from each of your * test methods.</i> - * + * * @param intent The Intent as if supplied to {@link android.content.Context#startActivity}. * @param savedInstanceState The instance state, if you are simulating this part of the life * cycle. Typically null. - * @param lastNonConfigurationInstance This Object will be available to the - * Activity if it calls {@link android.app.Activity#getLastNonConfigurationInstance()}. + * @param lastNonConfigurationInstance This Object will be available to the + * Activity if it calls {@link android.app.Activity#getLastNonConfigurationInstance()}. * Typically null. * @return Returns the Activity that was created */ protected T startActivity(Intent intent, Bundle savedInstanceState, Object lastNonConfigurationInstance) { assertFalse("Activity already created", mCreated); - + if (!mAttached) { assertNotNull(mActivityClass); setActivity(null); @@ -154,7 +158,7 @@ public abstract class ActivityUnitTestCase<T extends Activity> assertNotNull(newActivity); setActivity(newActivity); - + mAttached = true; } @@ -165,22 +169,22 @@ public abstract class ActivityUnitTestCase<T extends Activity> } return result; } - + @Override protected void tearDown() throws Exception { - + setActivity(null); - - // Scrub out members - protects against memory leaks in the case where someone + + // Scrub out members - protects against memory leaks in the case where someone // creates a non-static inner class (thus referencing the test case) and gives it to // someone else to hold onto scrubClass(ActivityInstrumentationTestCase.class); super.tearDown(); } - + /** - * Set the application for use during the test. You must call this function before calling + * Set the application for use during the test. You must call this function before calling * {@link #startActivity}. If your test does not call this method, * @param application The Application object that will be injected into the Activity under test. */ @@ -198,7 +202,7 @@ public abstract class ActivityUnitTestCase<T extends Activity> } /** - * This method will return the value if your Activity under test calls + * This method will return the value if your Activity under test calls * {@link android.app.Activity#setRequestedOrientation}. */ public int getRequestedOrientation() { @@ -207,10 +211,10 @@ public abstract class ActivityUnitTestCase<T extends Activity> } return 0; } - + /** - * This method will return the launch intent if your Activity under test calls - * {@link android.app.Activity#startActivity(Intent)} or + * This method will return the launch intent if your Activity under test calls + * {@link android.app.Activity#startActivity(Intent)} or * {@link android.app.Activity#startActivityForResult(Intent, int)}. * @return The Intent provided in the start call, or null if no start call was made. */ @@ -220,9 +224,9 @@ public abstract class ActivityUnitTestCase<T extends Activity> } return null; } - + /** - * This method will return the launch request code if your Activity under test calls + * This method will return the launch request code if your Activity under test calls * {@link android.app.Activity#startActivityForResult(Intent, int)}. * @return The request code provided in the start call, or -1 if no start call was made. */ @@ -234,9 +238,9 @@ public abstract class ActivityUnitTestCase<T extends Activity> } /** - * This method will notify you if the Activity under test called - * {@link android.app.Activity#finish()}, - * {@link android.app.Activity#finishFromChild(Activity)}, or + * This method will notify you if the Activity under test called + * {@link android.app.Activity#finish()}, + * {@link android.app.Activity#finishFromChild(Activity)}, or * {@link android.app.Activity#finishActivity(int)}. * @return Returns true if one of the listed finish methods was called. */ @@ -246,9 +250,9 @@ public abstract class ActivityUnitTestCase<T extends Activity> } return false; } - + /** - * This method will return the request code if the Activity under test called + * This method will return the request code if the Activity under test called * {@link android.app.Activity#finishActivity(int)}. * @return The request code provided in the start call, or -1 if no finish call was made. */ @@ -258,7 +262,7 @@ public abstract class ActivityUnitTestCase<T extends Activity> } return 0; } - + /** * This mock Activity represents the "parent" activity. By injecting this, we allow the user * to call a few more Activity methods, including: @@ -269,7 +273,7 @@ public abstract class ActivityUnitTestCase<T extends Activity> * <li>{@link android.app.Activity#finishActivity(int requestCode)}</li> * <li>{@link android.app.Activity#finishFromChild(Activity child)}</li> * </ul> - * + * * TODO: Make this overrideable, and the unit test can look for calls to other methods */ private static class MockParent extends Activity { @@ -303,7 +307,7 @@ public abstract class ActivityUnitTestCase<T extends Activity> public Window getWindow() { return null; } - + /** * By defining this in the parent, we allow the tested activity to call * <ul> @@ -316,7 +320,7 @@ public abstract class ActivityUnitTestCase<T extends Activity> mStartedActivityIntent = intent; mStartedActivityRequest = requestCode; } - + /** * By defining this in the parent, we allow the tested activity to call * <ul> diff --git a/test-runner/src/android/test/AndroidTestRunner.java b/test-runner/src/android/test/AndroidTestRunner.java index aa7c677c968f..50eaafbae39d 100644 --- a/test-runner/src/android/test/AndroidTestRunner.java +++ b/test-runner/src/android/test/AndroidTestRunner.java @@ -33,6 +33,13 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.List; +/** + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/runner/AndroidJUnitRunner.html"> + * AndroidJUnitRunner</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. + */ +@Deprecated public class AndroidTestRunner extends BaseTestRunner { private TestResult mTestResult; diff --git a/test-runner/src/android/test/ApplicationTestCase.java b/test-runner/src/android/test/ApplicationTestCase.java index f0931814ff7d..4d73f5300840 100644 --- a/test-runner/src/android/test/ApplicationTestCase.java +++ b/test-runner/src/android/test/ApplicationTestCase.java @@ -32,7 +32,7 @@ import android.content.Context; * In order to support the lifecycle of a Application, this test case will make the * following calls at the following times. * - * <ul><li>The test case will not call onCreate() until your test calls + * <ul><li>The test case will not call onCreate() until your test calls * {@link #createApplication()}. This gives you a chance * to set up or adjust any additional framework or test logic before * onCreate().</li> @@ -40,22 +40,28 @@ import android.content.Context; * automatically called, and it will stop & destroy your application by calling its * onDestroy() method.</li> * </ul> - * + * * <p><b>Dependency Injection.</b> * Every Application has one inherent dependency, the {@link android.content.Context Context} in * which it runs. - * This framework allows you to inject a modified, mock, or isolated replacement for this + * This framework allows you to inject a modified, mock, or isolated replacement for this * dependencies, and thus perform a true unit test. - * + * * <p>If simply run your tests as-is, your Application will be injected with a fully-functional * Context. - * You can create and inject alternative types of Contexts by calling + * You can create and inject alternative types of Contexts by calling * {@link AndroidTestCase#setContext(Context) setContext()}. You must do this <i>before</i> calling * {@link #createApplication()}. The test framework provides a - * number of alternatives for Context, including {@link android.test.mock.MockContext MockContext}, - * {@link android.test.RenamingDelegatingContext RenamingDelegatingContext}, and + * number of alternatives for Context, including {@link android.test.mock.MockContext MockContext}, + * {@link android.test.RenamingDelegatingContext RenamingDelegatingContext}, and * {@link android.content.ContextWrapper ContextWrapper}. + * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/InstrumentationRegistry.html"> + * InstrumentationRegistry</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public abstract class ApplicationTestCase<T extends Application> extends AndroidTestCase { Class<T> mApplicationClass; @@ -78,17 +84,17 @@ public abstract class ApplicationTestCase<T extends Application> extends Android } /** - * This will do the work to instantiate the Application under test. After this, your test + * This will do the work to instantiate the Application under test. After this, your test * code must also start and stop the Application. */ @Override protected void setUp() throws Exception { super.setUp(); - + // get the real context, before the individual tests have a chance to muck with it mSystemContext = getContext(); } - + /** * Load and attach the application under test. */ @@ -101,26 +107,26 @@ public abstract class ApplicationTestCase<T extends Application> extends Android } mAttached = true; } - + /** - * Start the Application under test, in the same way as if it was started by the system. + * Start the Application under test, in the same way as if it was started by the system. * If you use this method to start the Application, it will automatically * be stopped by {@link #tearDown}. If you wish to inject a specialized Context for your - * test, by calling {@link AndroidTestCase#setContext(Context) setContext()}, + * test, by calling {@link AndroidTestCase#setContext(Context) setContext()}, * you must do so before calling this method. */ final protected void createApplication() { assertFalse(mCreated); - + if (!mAttached) { setupApplication(); } assertNotNull(mApplication); - + mApplication.onCreate(); mCreated = true; } - + /** * This will make the necessary calls to terminate the Application under test (it will * call onTerminate(). Ordinarily this will be called automatically (by {@link #tearDown}, but @@ -131,13 +137,13 @@ public abstract class ApplicationTestCase<T extends Application> extends Android mApplication.onTerminate(); } } - + /** - * Shuts down the Application under test. Also makes sure all resources are cleaned up and + * Shuts down the Application under test. Also makes sure all resources are cleaned up and * garbage collected before moving on to the next * test. Subclasses that override this method should make sure they call super.tearDown() * at the end of the overriding method. - * + * * @throws Exception */ @Override @@ -145,7 +151,7 @@ public abstract class ApplicationTestCase<T extends Application> extends Android terminateApplication(); mApplication = null; - // Scrub out members - protects against memory leaks in the case where someone + // Scrub out members - protects against memory leaks in the case where someone // creates a non-static inner class (thus referencing the test case) and gives it to // someone else to hold onto scrubClass(ApplicationTestCase.class); @@ -156,7 +162,7 @@ public abstract class ApplicationTestCase<T extends Application> extends Android /** * Return a real (not mocked or instrumented) system Context that can be used when generating * Mock or other Context objects for your Application under test. - * + * * @return Returns a reference to a normal Context. */ public Context getSystemContext() { @@ -165,7 +171,7 @@ public abstract class ApplicationTestCase<T extends Application> extends Android /** * This test simply confirms that the Application class can be instantiated properly. - * + * * @throws Exception */ final public void testApplicationTestCaseSetUpProperly() throws Exception { diff --git a/test-runner/src/android/test/AssertionFailedError.java b/test-runner/src/android/test/AssertionFailedError.java index b3ac6d145ab8..fc3e98e965c7 100644 --- a/test-runner/src/android/test/AssertionFailedError.java +++ b/test-runner/src/android/test/AssertionFailedError.java @@ -18,17 +18,18 @@ package android.test; /** * Thrown when an assertion failed. - * + * * @deprecated use junit.framework.AssertionFailedError */ +@Deprecated public class AssertionFailedError extends Error { - + /** * It is more typical to call {@link #AssertionFailedError(String)}. */ public AssertionFailedError() { } - + public AssertionFailedError(String errorMessage) { super(errorMessage); } diff --git a/test-runner/src/android/test/ClassPathPackageInfo.java b/test-runner/src/android/test/ClassPathPackageInfo.java index 1f6e64780b81..1ab7c7faeca4 100644 --- a/test-runner/src/android/test/ClassPathPackageInfo.java +++ b/test-runner/src/android/test/ClassPathPackageInfo.java @@ -24,9 +24,10 @@ import java.util.Set; /** * The Package object doesn't allow you to iterate over the contained * classes and subpackages of that package. This is a version that does. - * + * * {@hide} Not needed for 1.0 SDK. */ +@Deprecated public class ClassPathPackageInfo { private final ClassPathPackageInfoSource source; diff --git a/test-runner/src/android/test/ClassPathPackageInfoSource.java b/test-runner/src/android/test/ClassPathPackageInfoSource.java index 0ffecdb8e969..89bb494e02dd 100644 --- a/test-runner/src/android/test/ClassPathPackageInfoSource.java +++ b/test-runner/src/android/test/ClassPathPackageInfoSource.java @@ -33,9 +33,10 @@ import java.util.zip.ZipFile; /** * Generate {@link ClassPathPackageInfo}s by scanning apk paths. - * + * * {@hide} Not needed for 1.0 SDK. */ +@Deprecated public class ClassPathPackageInfoSource { private static final String CLASS_EXTENSION = ".class"; @@ -82,7 +83,7 @@ public class ClassPathPackageInfoSource { // Don't try to load classes that are generated. They usually aren't in test apks. continue; } - + try { // We get errors in the emulator if we don't use the caller's class loader. topLevelClasses.add(Class.forName(className, false, diff --git a/test-runner/src/android/test/DatabaseTestUtils.java b/test-runner/src/android/test/DatabaseTestUtils.java index 23e0aba677a4..42ef48b38a24 100644 --- a/test-runner/src/android/test/DatabaseTestUtils.java +++ b/test-runner/src/android/test/DatabaseTestUtils.java @@ -27,6 +27,7 @@ import java.util.Set; * A collection of utilities for writing unit tests for database code. * @hide pending API council approval */ +@Deprecated public class DatabaseTestUtils { /** diff --git a/test-runner/src/android/test/InstrumentationCoreTestRunner.java b/test-runner/src/android/test/InstrumentationCoreTestRunner.java index 655a65c1c0f8..2b05e4a877b3 100644 --- a/test-runner/src/android/test/InstrumentationCoreTestRunner.java +++ b/test-runner/src/android/test/InstrumentationCoreTestRunner.java @@ -41,6 +41,7 @@ import android.util.Log; * * @hide */ +@Deprecated public class InstrumentationCoreTestRunner extends InstrumentationTestRunner { /** diff --git a/test-runner/src/android/test/InstrumentationTestRunner.java b/test-runner/src/android/test/InstrumentationTestRunner.java index db80ef951570..9bd4c966496d 100644 --- a/test-runner/src/android/test/InstrumentationTestRunner.java +++ b/test-runner/src/android/test/InstrumentationTestRunner.java @@ -155,6 +155,10 @@ import junit.textui.ResultPrinter; * -e coverageFile /sdcard/myFile.ec * <br/> * in addition to the other arguments. + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/runner/AndroidJUnitRunner.html"> + * AndroidJUnitRunner</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ /* (not JavaDoc) @@ -170,6 +174,7 @@ import junit.textui.ResultPrinter; * * This model is used by many existing app tests, but can probably be deprecated. */ +@Deprecated public class InstrumentationTestRunner extends Instrumentation implements TestSuiteProvider { /** @hide */ diff --git a/test-runner/src/android/test/InstrumentationUtils.java b/test-runner/src/android/test/InstrumentationUtils.java index 1a7002ab4844..cc508132ba21 100644 --- a/test-runner/src/android/test/InstrumentationUtils.java +++ b/test-runner/src/android/test/InstrumentationUtils.java @@ -17,17 +17,17 @@ package android.test; /** - * * The InstrumentationUtils class has all the utility functions needed for * instrumentation tests. * * {@hide} - Not currently used. */ +@Deprecated public class InstrumentationUtils { /** * An utility function that returns the menu identifier for a particular * menu item. - * + * * @param cls Class object of the class that handles the menu ite,. * @param identifier Menu identifier. * @return The integer corresponding to the menu item. @@ -35,7 +35,7 @@ public class InstrumentationUtils { public static int getMenuIdentifier(Class cls, String identifier) { int id = -1; try { - Integer field = (Integer)cls.getDeclaredField(identifier).get(cls); + Integer field = (Integer)cls.getDeclaredField(identifier).get(cls); id = field.intValue(); } catch (NoSuchFieldException e) { e.printStackTrace(); diff --git a/test-runner/src/android/test/IsolatedContext.java b/test-runner/src/android/test/IsolatedContext.java index f971b5ded187..3abf38f3b224 100644 --- a/test-runner/src/android/test/IsolatedContext.java +++ b/test-runner/src/android/test/IsolatedContext.java @@ -43,9 +43,13 @@ import java.util.List; /** - * A mock context which prevents its users from talking to the rest of the device while + * A mock context which prevents its users from talking to the rest of the device while * stubbing enough methods to satify code that tries to talk to other packages. + * + * @deprecated New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class IsolatedContext extends ContextWrapper { private ContentResolver mResolver; diff --git a/test-runner/src/android/test/LaunchPerformanceBase.java b/test-runner/src/android/test/LaunchPerformanceBase.java index d423e624193d..62c90d6a4373 100644 --- a/test-runner/src/android/test/LaunchPerformanceBase.java +++ b/test-runner/src/android/test/LaunchPerformanceBase.java @@ -26,6 +26,7 @@ import android.os.Bundle; * * @hide */ +@Deprecated public class LaunchPerformanceBase extends Instrumentation { public static final String LOG_TAG = "Launch Performance"; @@ -39,7 +40,7 @@ public class LaunchPerformanceBase extends Instrumentation { mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); setAutomaticPerformanceSnapshots(); } - + /** * Launches intent, and waits for idle before returning. * diff --git a/test-runner/src/android/test/MoreAsserts.java b/test-runner/src/android/test/MoreAsserts.java index 33648953e57d..d33911a186cc 100644 --- a/test-runner/src/android/test/MoreAsserts.java +++ b/test-runner/src/android/test/MoreAsserts.java @@ -30,7 +30,10 @@ import java.util.regex.Pattern; /** * Contains additional assertion methods not found in JUnit. + * @deprecated Use + * <a href="https://github.com/hamcrest">Hamcrest matchers</a> instead. */ +@Deprecated public final class MoreAsserts { private MoreAsserts() { } @@ -375,7 +378,7 @@ public final class MoreAsserts { failWithMessage(message, "Extra object in actual: (" + actualObj.toString() + ")"); } } - + if (expectedMap.size() > 0) { failWithMessage(message, "Extra objects in expected."); } diff --git a/test-runner/src/android/test/NoExecTestResult.java b/test-runner/src/android/test/NoExecTestResult.java index 1ee62c169090..a01b6aad3a38 100644 --- a/test-runner/src/android/test/NoExecTestResult.java +++ b/test-runner/src/android/test/NoExecTestResult.java @@ -19,11 +19,12 @@ import junit.framework.TestCase; import junit.framework.TestResult; /** - * A benign test result that does no actually test execution, just runs + * A benign test result that does no actually test execution, just runs * through the motions - * + * * {@hide} Not needed for SDK. */ +@Deprecated class NoExecTestResult extends TestResult { /** diff --git a/test-runner/src/android/test/PackageInfoSources.java b/test-runner/src/android/test/PackageInfoSources.java index ef3744911956..205f86b04d5f 100644 --- a/test-runner/src/android/test/PackageInfoSources.java +++ b/test-runner/src/android/test/PackageInfoSources.java @@ -19,6 +19,7 @@ package android.test; /** * {@hide} Not needed for SDK. */ +@Deprecated public class PackageInfoSources { private static ClassPathPackageInfoSource classPathSource; diff --git a/test-runner/src/android/test/PerformanceCollectorTestCase.java b/test-runner/src/android/test/PerformanceCollectorTestCase.java index 4309ff73eb5f..3a5dafc0db75 100644 --- a/test-runner/src/android/test/PerformanceCollectorTestCase.java +++ b/test-runner/src/android/test/PerformanceCollectorTestCase.java @@ -30,6 +30,7 @@ import android.os.PerformanceCollector.PerformanceResultsWriter; * * {@hide} Not needed for SDK. */ +@Deprecated public interface PerformanceCollectorTestCase { public PerformanceCollector mPerfCollector = new PerformanceCollector(); diff --git a/test-runner/src/android/test/RenamingDelegatingContext.java b/test-runner/src/android/test/RenamingDelegatingContext.java index 3c4da9e82f81..36786b09df26 100644 --- a/test-runner/src/android/test/RenamingDelegatingContext.java +++ b/test-runner/src/android/test/RenamingDelegatingContext.java @@ -36,7 +36,11 @@ import java.util.Set; * This is a class which delegates to the given context, but performs database * and file operations with a renamed database/file name (prefixes default * names with a given prefix). + * + * @deprecated New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class RenamingDelegatingContext extends ContextWrapper { private Context mFileContext; @@ -168,7 +172,7 @@ public class RenamingDelegatingContext extends ContextWrapper { return false; } } - + @Override public File getDatabasePath(String name) { return mFileContext.getDatabasePath(renamedFileName(name)); @@ -216,7 +220,7 @@ public class RenamingDelegatingContext extends ContextWrapper { public String[] fileList() { return mFileNames.toArray(new String[]{}); } - + /** * In order to support calls to getCacheDir(), we create a temp cache dir (inside the real * one) and return it instead. This code is basically getCacheDir(), except it uses the real @@ -241,21 +245,4 @@ public class RenamingDelegatingContext extends ContextWrapper { } return mCacheDir; } - - -// /** -// * Given an array of files returns only those whose names indicate that they belong to this -// * context. -// * @param allFiles the original list of files -// * @return the pruned list of files -// */ -// private String[] prunedFileList(String[] allFiles) { -// List<String> files = Lists.newArrayList(); -// for (String file : allFiles) { -// if (file.startsWith(mFilePrefix)) { -// files.add(file); -// } -// } -// return files.toArray(new String[]{}); -// } } diff --git a/test-runner/src/android/test/ServiceTestCase.java b/test-runner/src/android/test/ServiceTestCase.java index ba20c0980e7a..c8ff0f904d6d 100644 --- a/test-runner/src/android/test/ServiceTestCase.java +++ b/test-runner/src/android/test/ServiceTestCase.java @@ -92,7 +92,13 @@ import java.util.Random; * {@link android.test.RenamingDelegatingContext RenamingDelegatingContext}, * {@link android.content.ContextWrapper ContextWrapper}, and * {@link android.test.IsolatedContext}. + * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/rule/ServiceTestRule.html"> + * ServiceTestRule</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public abstract class ServiceTestCase<T extends Service> extends AndroidTestCase { Class<T> mServiceClass; diff --git a/test-runner/src/android/test/SimpleCache.java b/test-runner/src/android/test/SimpleCache.java index 44424ec56918..46143e4879b8 100644 --- a/test-runner/src/android/test/SimpleCache.java +++ b/test-runner/src/android/test/SimpleCache.java @@ -19,6 +19,7 @@ package android.test; import java.util.HashMap; import java.util.Map; +@Deprecated abstract class SimpleCache<K, V> { private Map<K, V> map = new HashMap<K, V>(); diff --git a/test-runner/src/android/test/SingleLaunchActivityTestCase.java b/test-runner/src/android/test/SingleLaunchActivityTestCase.java index 72c93cef3fde..af1448e55678 100644 --- a/test-runner/src/android/test/SingleLaunchActivityTestCase.java +++ b/test-runner/src/android/test/SingleLaunchActivityTestCase.java @@ -22,13 +22,19 @@ import android.app.Activity; * If you would like to test a single activity with an * {@link android.test.InstrumentationTestCase}, this provides some of the boiler plate to * launch and finish the activity in {@link #setUp} and {@link #tearDown}. - * - * This launches the activity only once for the entire class instead of doing it + * + * This launches the activity only once for the entire class instead of doing it * in every setup / teardown call. + * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/rule/ActivityTestRule.html"> + * ActivityTestRule</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public abstract class SingleLaunchActivityTestCase<T extends Activity> extends InstrumentationTestCase { - + String mPackage; Class<T> mActivityClass; private static int sTestCaseCounter = 0; @@ -44,10 +50,10 @@ public abstract class SingleLaunchActivityTestCase<T extends Activity> */ public SingleLaunchActivityTestCase(String pkg, Class<T> activityClass) { mPackage = pkg; - mActivityClass = activityClass; - sTestCaseCounter ++; + mActivityClass = activityClass; + sTestCaseCounter ++; } - + /** * The activity that will be set up for use in each test method. */ @@ -66,7 +72,7 @@ public abstract class SingleLaunchActivityTestCase<T extends Activity> getInstrumentation().setInTouchMode(false); sActivity = launchActivity(mPackage, mActivityClass, null); sActivityLaunchedFlag = true; - } + } } @Override @@ -75,7 +81,7 @@ public abstract class SingleLaunchActivityTestCase<T extends Activity> sTestCaseCounter --; if (sTestCaseCounter == 0) { sActivity.finish(); - } + } super.tearDown(); } diff --git a/test-runner/src/android/test/SyncBaseInstrumentation.java b/test-runner/src/android/test/SyncBaseInstrumentation.java index 7d418f09ead9..de36b4ff013f 100644 --- a/test-runner/src/android/test/SyncBaseInstrumentation.java +++ b/test-runner/src/android/test/SyncBaseInstrumentation.java @@ -27,7 +27,13 @@ import android.accounts.Account; * If you would like to test sync a single provider with an * {@link InstrumentationTestCase}, this provides some of the boiler plate in {@link #setUp} and * {@link #tearDown}. + * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/InstrumentationRegistry.html"> + * InstrumentationRegistry</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class SyncBaseInstrumentation extends InstrumentationTestCase { private Context mTargetContext; ContentResolver mContentResolver; diff --git a/test-runner/src/android/test/TestCase.java b/test-runner/src/android/test/TestCase.java index 5432ce85463b..b234f441c5c2 100644 --- a/test-runner/src/android/test/TestCase.java +++ b/test-runner/src/android/test/TestCase.java @@ -23,14 +23,13 @@ import android.content.Context; * More complex interface for test cases. * * <p>Just implementing Runnable is enough for many test cases. If you - * have additional setup or teardown, this interface might be for you, + * have additional setup or teardown, this interface might be for you, * especially if you need to share it between different test cases, or your * teardown code must execute regardless of whether your test passed. * * <p>See the android.test package documentation (click the more... link) * for a full description */ - @Deprecated public interface TestCase extends Runnable { diff --git a/test-runner/src/android/test/TestCaseUtil.java b/test-runner/src/android/test/TestCaseUtil.java index 3ba97118e56b..c46d403f1350 100644 --- a/test-runner/src/android/test/TestCaseUtil.java +++ b/test-runner/src/android/test/TestCaseUtil.java @@ -35,6 +35,7 @@ import java.util.Set; * @hide - This is part of a framework that is under development and should not be used for * active development. */ +@Deprecated public class TestCaseUtil { private TestCaseUtil() { @@ -67,7 +68,7 @@ public class TestCaseUtil { */ if (test instanceof TestCase && ((TestCase)test).getName() == null) { - workingTest = invokeSuiteMethodIfPossible(test.getClass(), + workingTest = invokeSuiteMethodIfPossible(test.getClass(), seen); } if (workingTest == null) { @@ -155,7 +156,7 @@ public class TestCaseUtil { public static TestSuite createTestSuite(Class<? extends Test> testClass) throws InstantiationException, IllegalAccessException { - Test test = invokeSuiteMethodIfPossible(testClass, + Test test = invokeSuiteMethodIfPossible(testClass, new HashSet<Class<?>>()); if (test == null) { return new TestSuite(testClass); diff --git a/test-runner/src/android/test/TestPrinter.java b/test-runner/src/android/test/TestPrinter.java index 37bd721c9bab..a23f06dde9b0 100644 --- a/test-runner/src/android/test/TestPrinter.java +++ b/test-runner/src/android/test/TestPrinter.java @@ -30,9 +30,10 @@ import java.util.Set; * probably will not need to create or extend this class or call its methods manually. * See the full {@link android.test} package description for information about * getting test results. - * + * * {@hide} Not needed for 1.0 SDK. */ +@Deprecated public class TestPrinter implements TestRunner.Listener, TestListener { private String mTag; @@ -89,7 +90,7 @@ public class TestPrinter implements TestRunner.Listener, TestListener { mFailedTests.add(test.toString()); failed(test.toString(), t); } - + public void addError(Test test, Throwable t) { failed(test, t); } diff --git a/test-runner/src/android/test/TestRunner.java b/test-runner/src/android/test/TestRunner.java index 012df3501026..beecc6fdd9de 100644 --- a/test-runner/src/android/test/TestRunner.java +++ b/test-runner/src/android/test/TestRunner.java @@ -42,6 +42,7 @@ import com.google.android.collect.Lists; * * {@hide} Not needed for 1.0 SDK. */ +@Deprecated public class TestRunner implements PerformanceTestCase.Intermediates { public static final int REGRESSION = 0; public static final int PERFORMANCE = 1; diff --git a/test-runner/src/android/test/TestSuiteProvider.java b/test-runner/src/android/test/TestSuiteProvider.java index dc9ce6e3bc10..c74651cea01f 100644 --- a/test-runner/src/android/test/TestSuiteProvider.java +++ b/test-runner/src/android/test/TestSuiteProvider.java @@ -21,6 +21,7 @@ import junit.framework.TestSuite; /** * Implementors will know how to get a test suite. */ +@Deprecated public interface TestSuiteProvider { TestSuite getTestSuite(); diff --git a/test-runner/src/android/test/TimedTest.java b/test-runner/src/android/test/TimedTest.java index 95cc9bffd42c..cb15ef907050 100644 --- a/test-runner/src/android/test/TimedTest.java +++ b/test-runner/src/android/test/TimedTest.java @@ -30,6 +30,7 @@ import java.lang.annotation.RetentionPolicy; * * {@hide} Pending approval for public API. */ +@Deprecated @Retention(RetentionPolicy.RUNTIME) public @interface TimedTest { boolean includeDetailedStats() default false; diff --git a/test-runner/src/android/test/TouchUtils.java b/test-runner/src/android/test/TouchUtils.java index 1b854b069ec0..28dc7b2f900c 100644 --- a/test-runner/src/android/test/TouchUtils.java +++ b/test-runner/src/android/test/TouchUtils.java @@ -31,9 +31,15 @@ import android.view.ViewGroup; * Reusable methods for generating touch events. These methods can be used with * InstrumentationTestCase or ActivityInstrumentationTestCase2 to simulate user interaction with * the application through a touch screen. + * + * @deprecated Use + * <a href="{@docRoot}training/testing/ui-testing/espresso-testing.html">Espresso UI testing + * framework</a> instead. New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class TouchUtils { - + /** * Simulate touching in the center of the screen and dragging one quarter of the way down * @param test The test case that is being run @@ -46,7 +52,7 @@ public class TouchUtils { public static void dragQuarterScreenDown(ActivityInstrumentationTestCase test) { dragQuarterScreenDown(test, test.getActivity()); } - + /** * Simulate touching in the center of the screen and dragging one quarter of the way down * @param test The test case that is being run @@ -56,14 +62,14 @@ public class TouchUtils { Display display = activity.getWindowManager().getDefaultDisplay(); final Point size = new Point(); display.getSize(size); - + final float x = size.x / 2.0f; final float fromY = size.y * 0.5f; final float toY = size.y * 0.75f; - + drag(test, x, x, fromY, toY, 4); } - + /** * Simulate touching in the center of the screen and dragging one quarter of the way up * @param test The test case that is being run @@ -76,7 +82,7 @@ public class TouchUtils { public static void dragQuarterScreenUp(ActivityInstrumentationTestCase test) { dragQuarterScreenUp(test, test.getActivity()); } - + /** * Simulate touching in the center of the screen and dragging one quarter of the way up * @param test The test case that is being run @@ -86,18 +92,18 @@ public class TouchUtils { Display display = activity.getWindowManager().getDefaultDisplay(); final Point size = new Point(); display.getSize(size); - + final float x = size.x / 2.0f; final float fromY = size.y * 0.5f; final float toY = size.y * 0.25f; - + drag(test, x, x, fromY, toY, 4); } - + /** * Scroll a ViewGroup to the bottom by repeatedly calling * {@link #dragQuarterScreenUp(InstrumentationTestCase, Activity)} - * + * * @param test The test case that is being run * @param v The ViewGroup that should be dragged * @@ -109,11 +115,11 @@ public class TouchUtils { public static void scrollToBottom(ActivityInstrumentationTestCase test, ViewGroup v) { scrollToBottom(test, test.getActivity(), v); } - + /** * Scroll a ViewGroup to the bottom by repeatedly calling * {@link #dragQuarterScreenUp(InstrumentationTestCase, Activity)} - * + * * @param test The test case that is being run * @param activity The activity that is in the foreground of the test case * @param v The ViewGroup that should be dragged @@ -132,7 +138,7 @@ public class TouchUtils { /** * Scroll a ViewGroup to the top by repeatedly calling * {@link #dragQuarterScreenDown(InstrumentationTestCase, Activity)} - * + * * @param test The test case that is being run * @param v The ViewGroup that should be dragged * @@ -144,11 +150,11 @@ public class TouchUtils { public static void scrollToTop(ActivityInstrumentationTestCase test, ViewGroup v) { scrollToTop(test, test.getActivity(), v); } - + /** * Scroll a ViewGroup to the top by repeatedly calling * {@link #dragQuarterScreenDown(InstrumentationTestCase, Activity)} - * + * * @param test The test case that is being run * @param activity The activity that is in the foreground of the test case * @param v The ViewGroup that should be dragged @@ -162,10 +168,10 @@ public class TouchUtils { next = new ViewStateSnapshot(v); } while (!prev.equals(next)); } - + /** * Simulate touching the center of a view and dragging to the bottom of the screen. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @@ -177,10 +183,10 @@ public class TouchUtils { public static void dragViewToBottom(ActivityInstrumentationTestCase test, View v) { dragViewToBottom(test, test.getActivity(), v, 4); } - + /** * Simulate touching the center of a view and dragging to the bottom of the screen. - * + * * @param test The test case that is being run * @param activity The activity that is in the foreground of the test case * @param v The view that should be dragged @@ -188,10 +194,10 @@ public class TouchUtils { public static void dragViewToBottom(InstrumentationTestCase test, Activity activity, View v) { dragViewToBottom(test, activity, v, 4); } - + /** * Simulate touching the center of a view and dragging to the bottom of the screen. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @param stepCount How many move steps to include in the drag @@ -205,10 +211,10 @@ public class TouchUtils { int stepCount) { dragViewToBottom(test, test.getActivity(), v, stepCount); } - + /** * Simulate touching the center of a view and dragging to the bottom of the screen. - * + * * @param test The test case that is being run * @param activity The activity that is in the foreground of the test case * @param v The view that should be dragged @@ -220,38 +226,38 @@ public class TouchUtils { int[] xy = new int[2]; v.getLocationOnScreen(xy); - + final int viewWidth = v.getWidth(); final int viewHeight = v.getHeight(); - + final float x = xy[0] + (viewWidth / 2.0f); float fromY = xy[1] + (viewHeight / 2.0f); float toY = screenHeight - 1; - + drag(test, x, x, fromY, toY, stepCount); } /** * Simulate touching the center of a view and releasing quickly (before the tap timeout). - * + * * @param test The test case that is being run * @param v The view that should be clicked */ public static void tapView(InstrumentationTestCase test, View v) { int[] xy = new int[2]; v.getLocationOnScreen(xy); - + final int viewWidth = v.getWidth(); final int viewHeight = v.getHeight(); - + final float x = xy[0] + (viewWidth / 2.0f); float y = xy[1] + (viewHeight / 2.0f); - + Instrumentation inst = test.getInstrumentation(); long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis(); - + MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y, 0); inst.sendPointerSync(event); @@ -308,30 +314,30 @@ public class TouchUtils { /** * Simulate touching the center of a view and releasing. - * + * * @param test The test case that is being run * @param v The view that should be clicked */ public static void clickView(InstrumentationTestCase test, View v) { int[] xy = new int[2]; v.getLocationOnScreen(xy); - + final int viewWidth = v.getWidth(); final int viewHeight = v.getHeight(); - + final float x = xy[0] + (viewWidth / 2.0f); float y = xy[1] + (viewHeight / 2.0f); - + Instrumentation inst = test.getInstrumentation(); long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis(); - + MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y, 0); inst.sendPointerSync(event); inst.waitForIdleSync(); - + eventTime = SystemClock.uptimeMillis(); final int touchSlop = ViewConfiguration.get(v.getContext()).getScaledTouchSlop(); @@ -344,7 +350,7 @@ public class TouchUtils { event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, x, y, 0); inst.sendPointerSync(event); inst.waitForIdleSync(); - + try { Thread.sleep(1000); } catch (InterruptedException e) { @@ -354,7 +360,7 @@ public class TouchUtils { /** * Simulate touching the center of a view, holding until it is a long press, and then releasing. - * + * * @param test The test case that is being run * @param v The view that should be clicked * @@ -369,20 +375,20 @@ public class TouchUtils { /** * Simulate touching the center of a view, holding until it is a long press, and then releasing. - * + * * @param test The test case that is being run * @param v The view that should be clicked */ public static void longClickView(InstrumentationTestCase test, View v) { int[] xy = new int[2]; v.getLocationOnScreen(xy); - + final int viewWidth = v.getWidth(); final int viewHeight = v.getHeight(); - + final float x = xy[0] + (viewWidth / 2.0f); float y = xy[1] + (viewHeight / 2.0f); - + Instrumentation inst = test.getInstrumentation(); long downTime = SystemClock.uptimeMillis(); @@ -399,7 +405,7 @@ public class TouchUtils { x + touchSlop / 2, y + touchSlop / 2, 0); inst.sendPointerSync(event); inst.waitForIdleSync(); - + try { Thread.sleep((long)(ViewConfiguration.getLongPressTimeout() * 1.5f)); } catch (InterruptedException e) { @@ -414,7 +420,7 @@ public class TouchUtils { /** * Simulate touching the center of a view and dragging to the top of the screen. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @@ -426,10 +432,10 @@ public class TouchUtils { public static void dragViewToTop(ActivityInstrumentationTestCase test, View v) { dragViewToTop((InstrumentationTestCase) test, v, 4); } - + /** * Simulate touching the center of a view and dragging to the top of the screen. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @param stepCount How many move steps to include in the drag @@ -442,20 +448,20 @@ public class TouchUtils { public static void dragViewToTop(ActivityInstrumentationTestCase test, View v, int stepCount) { dragViewToTop((InstrumentationTestCase) test, v, stepCount); } - + /** * Simulate touching the center of a view and dragging to the top of the screen. - * + * * @param test The test case that is being run * @param v The view that should be dragged */ public static void dragViewToTop(InstrumentationTestCase test, View v) { dragViewToTop(test, v, 4); } - + /** * Simulate touching the center of a view and dragging to the top of the screen. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @param stepCount How many move steps to include in the drag @@ -463,21 +469,21 @@ public class TouchUtils { public static void dragViewToTop(InstrumentationTestCase test, View v, int stepCount) { int[] xy = new int[2]; v.getLocationOnScreen(xy); - + final int viewWidth = v.getWidth(); final int viewHeight = v.getHeight(); - + final float x = xy[0] + (viewWidth / 2.0f); float fromY = xy[1] + (viewHeight / 2.0f); float toY = 0; - + drag(test, x, x, fromY, toY, stepCount); } - + /** * Get the location of a view. Use the gravity param to specify which part of the view to * return. - * + * * @param v View to find * @param gravity A combination of (TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, * RIGHT) @@ -488,7 +494,7 @@ public class TouchUtils { final int viewWidth = v.getWidth(); final int viewHeight = v.getHeight(); - + switch (gravity & Gravity.VERTICAL_GRAVITY_MASK) { case Gravity.TOP: break; @@ -501,7 +507,7 @@ public class TouchUtils { default: // Same as top -- do nothing } - + switch (gravity & Gravity.HORIZONTAL_GRAVITY_MASK) { case Gravity.LEFT: break; @@ -518,14 +524,14 @@ public class TouchUtils { /** * Simulate touching a view and dragging it by the specified amount. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @param gravity Which part of the view to use for the initial down event. A combination of * (TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, RIGHT) * @param deltaX Amount to drag horizontally in pixels * @param deltaY Amount to drag vertically in pixels - * + * * @return distance in pixels covered by the drag * * @deprecated {@link android.test.ActivityInstrumentationTestCase} is deprecated in favor of @@ -537,17 +543,17 @@ public class TouchUtils { int deltaX, int deltaY) { return dragViewBy((InstrumentationTestCase) test, v, gravity, deltaX, deltaY); } - + /** * Simulate touching a view and dragging it by the specified amount. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @param gravity Which part of the view to use for the initial down event. A combination of * (TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, RIGHT) * @param deltaX Amount to drag horizontally in pixels * @param deltaY Amount to drag vertically in pixels - * + * * @return distance in pixels covered by the drag * * @deprecated {@link android.test.ActivityInstrumentationTestCase} is deprecated in favor of @@ -558,29 +564,29 @@ public class TouchUtils { public static int dragViewBy(InstrumentationTestCase test, View v, int gravity, int deltaX, int deltaY) { int[] xy = new int[2]; - + getStartLocation(v, gravity, xy); final int fromX = xy[0]; final int fromY = xy[1]; - + int distance = (int) Math.hypot(deltaX, deltaY); drag(test, fromX, fromX + deltaX, fromY, fromY + deltaY, distance); return distance; } - + /** * Simulate touching a view and dragging it to a specified location. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @param gravity Which part of the view to use for the initial down event. A combination of * (TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, RIGHT) * @param toX Final location of the view after dragging * @param toY Final location of the view after dragging - * + * * @return distance in pixels covered by the drag * * @deprecated {@link android.test.ActivityInstrumentationTestCase} is deprecated in favor of @@ -595,14 +601,14 @@ public class TouchUtils { /** * Simulate touching a view and dragging it to a specified location. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @param gravity Which part of the view to use for the initial down event. A combination of * (TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, RIGHT) * @param toX Final location of the view after dragging * @param toY Final location of the view after dragging - * + * * @return distance in pixels covered by the drag */ public static int dragViewTo(InstrumentationTestCase test, View v, int gravity, int toX, @@ -610,28 +616,28 @@ public class TouchUtils { int[] xy = new int[2]; getStartLocation(v, gravity, xy); - + final int fromX = xy[0]; final int fromY = xy[1]; - + int deltaX = fromX - toX; int deltaY = fromY - toY; - + int distance = (int)Math.hypot(deltaX, deltaY); drag(test, fromX, toX, fromY, toY, distance); - + return distance; } /** * Simulate touching a view and dragging it to a specified location. Only moves horizontally. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @param gravity Which part of the view to use for the initial down event. A combination of * (TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, RIGHT) * @param toX Final location of the view after dragging - * + * * @return distance in pixels covered by the drag * * @deprecated {@link android.test.ActivityInstrumentationTestCase} is deprecated in favor of @@ -646,39 +652,39 @@ public class TouchUtils { /** * Simulate touching a view and dragging it to a specified location. Only moves horizontally. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @param gravity Which part of the view to use for the initial down event. A combination of * (TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, RIGHT) * @param toX Final location of the view after dragging - * + * * @return distance in pixels covered by the drag */ public static int dragViewToX(InstrumentationTestCase test, View v, int gravity, int toX) { int[] xy = new int[2]; getStartLocation(v, gravity, xy); - + final int fromX = xy[0]; final int fromY = xy[1]; - + int deltaX = fromX - toX; drag(test, fromX, toX, fromY, fromY, deltaX); - + return deltaX; } - + /** * Simulate touching a view and dragging it to a specified location. Only moves vertically. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @param gravity Which part of the view to use for the initial down event. A combination of * (TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, RIGHT) * @param toY Final location of the view after dragging - * + * * @return distance in pixels covered by the drag * * @deprecated {@link android.test.ActivityInstrumentationTestCase} is deprecated in favor of @@ -690,37 +696,37 @@ public class TouchUtils { int toY) { return dragViewToY((InstrumentationTestCase) test, v, gravity, toY); } - + /** * Simulate touching a view and dragging it to a specified location. Only moves vertically. - * + * * @param test The test case that is being run * @param v The view that should be dragged * @param gravity Which part of the view to use for the initial down event. A combination of * (TOP, CENTER_VERTICAL, BOTTOM) and (LEFT, CENTER_HORIZONTAL, RIGHT) * @param toY Final location of the view after dragging - * + * * @return distance in pixels covered by the drag */ public static int dragViewToY(InstrumentationTestCase test, View v, int gravity, int toY) { int[] xy = new int[2]; getStartLocation(v, gravity, xy); - + final int fromX = xy[0]; final int fromY = xy[1]; - + int deltaY = fromY - toY; drag(test, fromX, fromX, fromY, toY, deltaY); - + return deltaY; } - + /** * Simulate touching a specific location and dragging to a new location. - * + * * @param test The test case that is being run * @param fromX X coordinate of the initial touch, in screen coordinates * @param toX Xcoordinate of the drag destination, in screen coordinates @@ -737,10 +743,10 @@ public class TouchUtils { float fromY, float toY, int stepCount) { drag((InstrumentationTestCase) test, fromX, toX, fromY, toY, stepCount); } - + /** * Simulate touching a specific location and dragging to a new location. - * + * * @param test The test case that is being run * @param fromX X coordinate of the initial touch, in screen coordinates * @param toX Xcoordinate of the drag destination, in screen coordinates @@ -757,7 +763,7 @@ public class TouchUtils { float y = fromY; float x = fromX; - + float yStep = (toY - fromY) / stepCount; float xStep = (toX - fromX) / stepCount; diff --git a/test-runner/src/android/test/ViewAsserts.java b/test-runner/src/android/test/ViewAsserts.java index c575fc5982bf..00ab44379994 100644 --- a/test-runner/src/android/test/ViewAsserts.java +++ b/test-runner/src/android/test/ViewAsserts.java @@ -23,7 +23,15 @@ import android.view.ViewGroup; /** * Some useful assertions about views. + * + * @deprecated Use + * <a href="{@docRoot}reference/android/support/test/espresso/matcher/ViewMatchers.html">Espresso + * View Matchers</a> instead. New test should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. + * For more information about UI testing, take the + * <a href="{@docRoot}tools/testing-support-library/index.html">Espresso UI testing</a> training. */ +@Deprecated public class ViewAsserts { private ViewAsserts() {} diff --git a/test-runner/src/android/test/mock/MockApplication.java b/test-runner/src/android/test/mock/MockApplication.java index 572dfbf2b5e6..3257ecf11066 100644 --- a/test-runner/src/android/test/mock/MockApplication.java +++ b/test-runner/src/android/test/mock/MockApplication.java @@ -20,12 +20,17 @@ import android.app.Application; import android.content.res.Configuration; /** - * A mock {@link android.app.Application} class. All methods are non-functional and throw - * {@link java.lang.UnsupportedOperationException}. Override it as necessary to provide the + * A mock {@link android.app.Application} class. All methods are non-functional and throw + * {@link java.lang.UnsupportedOperationException}. Override it as necessary to provide the * operations that you need. + * + * @deprecated Use a mocking framework like <a href="https://github.com/mockito/mockito">Mockito</a>. + * New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class MockApplication extends Application { - + public MockApplication() { } @@ -38,7 +43,7 @@ public class MockApplication extends Application { public void onTerminate() { throw new UnsupportedOperationException(); } - + @Override public void onConfigurationChanged(Configuration newConfig) { throw new UnsupportedOperationException(); diff --git a/test-runner/src/android/test/mock/MockContentProvider.java b/test-runner/src/android/test/mock/MockContentProvider.java index 5ef71df341bf..3743fb0811f8 100644 --- a/test-runner/src/android/test/mock/MockContentProvider.java +++ b/test-runner/src/android/test/mock/MockContentProvider.java @@ -41,7 +41,12 @@ import java.util.ArrayList; * Mock implementation of ContentProvider. All methods are non-functional and throw * {@link java.lang.UnsupportedOperationException}. Tests can extend this class to * implement behavior needed for tests. + * + * @deprecated Use a mocking framework like <a href="https://github.com/mockito/mockito">Mockito</a>. + * New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class MockContentProvider extends ContentProvider { /* * Note: if you add methods to ContentProvider, you must add similar methods to diff --git a/test-runner/src/android/test/mock/MockContentResolver.java b/test-runner/src/android/test/mock/MockContentResolver.java index aec6c772f3a5..75c8335b6653 100644 --- a/test-runner/src/android/test/mock/MockContentResolver.java +++ b/test-runner/src/android/test/mock/MockContentResolver.java @@ -49,8 +49,12 @@ import java.util.Map; * <p>For more information about application testing, read the * <a href="{@docRoot}guide/topics/testing/index.html">Testing</a> developer guide.</p> * </div> + * + * @deprecated Use a mocking framework like <a href="https://github.com/mockito/mockito">Mockito</a>. + * New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ - +@Deprecated public class MockContentResolver extends ContentResolver { Map<String, ContentProvider> mProviders; diff --git a/test-runner/src/android/test/mock/MockContext.java b/test-runner/src/android/test/mock/MockContext.java index 64d29787f75f..9b93bda56ea5 100644 --- a/test-runner/src/android/test/mock/MockContext.java +++ b/test-runner/src/android/test/mock/MockContext.java @@ -52,10 +52,15 @@ import java.io.IOException; import java.io.InputStream; /** - * A mock {@link android.content.Context} class. All methods are non-functional and throw + * A mock {@link android.content.Context} class. All methods are non-functional and throw * {@link java.lang.UnsupportedOperationException}. You can use this to inject other dependencies, * mocks, or monitors into the classes you are testing. + * + * @deprecated Use a mocking framework like <a href="https://github.com/mockito/mockito">Mockito</a>. + * New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class MockContext extends Context { @Override @@ -82,12 +87,12 @@ public class MockContext extends Context { public Looper getMainLooper() { throw new UnsupportedOperationException(); } - + @Override public Context getApplicationContext() { throw new UnsupportedOperationException(); } - + @Override public void setTheme(int resid) { throw new UnsupportedOperationException(); @@ -124,7 +129,7 @@ public class MockContext extends Context { public ApplicationInfo getApplicationInfo() { throw new UnsupportedOperationException(); } - + @Override public String getPackageResourcePath() { throw new UnsupportedOperationException(); @@ -194,7 +199,7 @@ public class MockContext extends Context { public File getObbDir() { throw new UnsupportedOperationException(); } - + @Override public File getCacheDir() { throw new UnsupportedOperationException(); @@ -216,7 +221,7 @@ public class MockContext extends Context { } @Override - public SQLiteDatabase openOrCreateDatabase(String file, int mode, + public SQLiteDatabase openOrCreateDatabase(String file, int mode, SQLiteDatabase.CursorFactory factory) { throw new UnsupportedOperationException(); } @@ -310,7 +315,7 @@ public class MockContext extends Context { Bundle options) throws IntentSender.SendIntentException { startIntentSender(intent, fillInIntent, flagsMask, flagsValues, extraFlags); } - + @Override public void sendBroadcast(Intent intent) { throw new UnsupportedOperationException(); diff --git a/test-runner/src/android/test/mock/MockCursor.java b/test-runner/src/android/test/mock/MockCursor.java index 28fa0f8041ac..576f24ad6384 100644 --- a/test-runner/src/android/test/mock/MockCursor.java +++ b/test-runner/src/android/test/mock/MockCursor.java @@ -25,15 +25,18 @@ import android.net.Uri; import android.os.Bundle; /** - * <P> * A mock {@link android.database.Cursor} class that isolates the test code from real * Cursor implementation. - * </P> - * <P> + * + * <p> * All methods including ones related to querying the state of the cursor are * are non-functional and throw {@link java.lang.UnsupportedOperationException}. - * </P> + * + * @deprecated Use a mocking framework like <a href="https://github.com/mockito/mockito">Mockito</a>. + * New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class MockCursor implements Cursor { @Override public int getColumnCount() { diff --git a/test-runner/src/android/test/mock/MockDialogInterface.java b/test-runner/src/android/test/mock/MockDialogInterface.java index e4dd0ba2a2d3..d0a5a097918d 100644 --- a/test-runner/src/android/test/mock/MockDialogInterface.java +++ b/test-runner/src/android/test/mock/MockDialogInterface.java @@ -1,14 +1,33 @@ -// Copyright 2008 The Android Open Source Project +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package android.test.mock; import android.content.DialogInterface; /** - * A mock {@link android.content.DialogInterface} class. All methods are non-functional and throw - * {@link java.lang.UnsupportedOperationException}. Override it to provide the operations that you + * A mock {@link android.content.DialogInterface} class. All methods are non-functional and throw + * {@link java.lang.UnsupportedOperationException}. Override it to provide the operations that you * need. + * + * @deprecated Use a mocking framework like <a href="https://github.com/mockito/mockito">Mockito</a>. + * New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class MockDialogInterface implements DialogInterface { public void cancel() { throw new UnsupportedOperationException("not implemented yet"); diff --git a/test-runner/src/android/test/mock/MockPackageManager.java b/test-runner/src/android/test/mock/MockPackageManager.java index 5296d4d77657..ffb73f63230c 100644 --- a/test-runner/src/android/test/mock/MockPackageManager.java +++ b/test-runner/src/android/test/mock/MockPackageManager.java @@ -60,7 +60,12 @@ import java.util.List; * A mock {@link android.content.pm.PackageManager} class. All methods are non-functional and throw * {@link java.lang.UnsupportedOperationException}. Override it to provide the operations that you * need. + * + * @deprecated Use a mocking framework like <a href="https://github.com/mockito/mockito">Mockito</a>. + * New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class MockPackageManager extends PackageManager { @Override diff --git a/test-runner/src/android/test/mock/MockResources.java b/test-runner/src/android/test/mock/MockResources.java index 18752cebde1e..880343e5e780 100644 --- a/test-runner/src/android/test/mock/MockResources.java +++ b/test-runner/src/android/test/mock/MockResources.java @@ -32,10 +32,15 @@ import android.graphics.Movie; import java.io.InputStream; /** - * A mock {@link android.content.res.Resources} class. All methods are non-functional and throw - * {@link java.lang.UnsupportedOperationException}. Override it to provide the operations that you + * A mock {@link android.content.res.Resources} class. All methods are non-functional and throw + * {@link java.lang.UnsupportedOperationException}. Override it to provide the operations that you * need. + * + * @deprecated Use a mocking framework like <a href="https://github.com/mockito/mockito">Mockito</a>. + * New tests should be written using the + * <a href="{@docRoot}tools/testing-support-library/index.html">Android Testing Support Library</a>. */ +@Deprecated public class MockResources extends Resources { public MockResources() { |