summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Stephan Linzner <slinzner@google.com> 2016-01-28 01:42:21 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-01-28 01:42:21 +0000
commit3b3e57ef2bc72bf241b16b89900d5c83fd3b4a6c (patch)
tree2cf4463d467d0c5c0df8c65c4d20c3b1c682d795
parent2ebfc6f59ec0adc786b256d8d188d08553effc21 (diff)
parentb1ac3142f0748998890972064785fb0c20542774 (diff)
Merge "Revert "Deprecated platform Android testing APIs""
-rw-r--r--core/java/android/test/AndroidTestCase.java6
-rw-r--r--core/java/android/test/FlakyTest.java6
-rw-r--r--core/java/android/test/InstrumentationTestCase.java8
-rw-r--r--core/java/android/test/InstrumentationTestSuite.java6
-rw-r--r--core/java/android/test/PerformanceTestCase.java17
-rw-r--r--core/java/android/test/UiThreadTest.java6
-rw-r--r--core/java/android/test/suitebuilder/annotation/LargeTest.java6
-rw-r--r--core/java/android/test/suitebuilder/annotation/MediumTest.java5
-rw-r--r--core/java/android/test/suitebuilder/annotation/SmallTest.java6
-rw-r--r--core/java/android/test/suitebuilder/annotation/Smoke.java4
-rw-r--r--core/java/android/test/suitebuilder/annotation/Suppress.java5
-rw-r--r--test-runner/src/android/test/ActivityInstrumentationTestCase.java16
-rw-r--r--test-runner/src/android/test/ActivityInstrumentationTestCase2.java52
-rw-r--r--test-runner/src/android/test/ActivityTestCase.java4
-rw-r--r--test-runner/src/android/test/ActivityUnitTestCase.java86
-rw-r--r--test-runner/src/android/test/AndroidTestRunner.java7
-rw-r--r--test-runner/src/android/test/ApplicationTestCase.java50
-rw-r--r--test-runner/src/android/test/AssertionFailedError.java7
-rw-r--r--test-runner/src/android/test/ClassPathPackageInfo.java3
-rw-r--r--test-runner/src/android/test/ClassPathPackageInfoSource.java5
-rw-r--r--test-runner/src/android/test/DatabaseTestUtils.java1
-rw-r--r--test-runner/src/android/test/InstrumentationCoreTestRunner.java1
-rw-r--r--test-runner/src/android/test/InstrumentationTestRunner.java5
-rw-r--r--test-runner/src/android/test/InstrumentationUtils.java6
-rw-r--r--test-runner/src/android/test/IsolatedContext.java6
-rw-r--r--test-runner/src/android/test/LaunchPerformanceBase.java3
-rw-r--r--test-runner/src/android/test/MoreAsserts.java5
-rw-r--r--test-runner/src/android/test/NoExecTestResult.java5
-rw-r--r--test-runner/src/android/test/PackageInfoSources.java1
-rw-r--r--test-runner/src/android/test/PerformanceCollectorTestCase.java1
-rw-r--r--test-runner/src/android/test/RenamingDelegatingContext.java25
-rw-r--r--test-runner/src/android/test/ServiceTestCase.java6
-rw-r--r--test-runner/src/android/test/SimpleCache.java1
-rw-r--r--test-runner/src/android/test/SingleLaunchActivityTestCase.java22
-rw-r--r--test-runner/src/android/test/SyncBaseInstrumentation.java6
-rw-r--r--test-runner/src/android/test/TestCase.java3
-rw-r--r--test-runner/src/android/test/TestCaseUtil.java5
-rw-r--r--test-runner/src/android/test/TestPrinter.java5
-rw-r--r--test-runner/src/android/test/TestRunner.java1
-rw-r--r--test-runner/src/android/test/TestSuiteProvider.java1
-rw-r--r--test-runner/src/android/test/TimedTest.java1
-rw-r--r--test-runner/src/android/test/TouchUtils.java196
-rw-r--r--test-runner/src/android/test/ViewAsserts.java8
-rw-r--r--test-runner/src/android/test/mock/MockApplication.java13
-rw-r--r--test-runner/src/android/test/mock/MockContentProvider.java5
-rw-r--r--test-runner/src/android/test/mock/MockContentResolver.java6
-rw-r--r--test-runner/src/android/test/mock/MockContext.java19
-rw-r--r--test-runner/src/android/test/mock/MockCursor.java11
-rw-r--r--test-runner/src/android/test/mock/MockDialogInterface.java25
-rw-r--r--test-runner/src/android/test/mock/MockPackageManager.java5
-rw-r--r--test-runner/src/android/test/mock/MockResources.java9
51 files changed, 269 insertions, 443 deletions
diff --git a/core/java/android/test/AndroidTestCase.java b/core/java/android/test/AndroidTestCase.java
index 1e6bd9c14fd9..2ecbfae6fede 100644
--- a/core/java/android/test/AndroidTestCase.java
+++ b/core/java/android/test/AndroidTestCase.java
@@ -29,13 +29,7 @@ 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 4e5c4e35a8c6..919767f9e999 100644
--- a/core/java/android/test/FlakyTest.java
+++ b/core/java/android/test/FlakyTest.java
@@ -26,13 +26,7 @@ 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 6b79314a4385..ca427ea6a4c5 100644
--- a/core/java/android/test/InstrumentationTestCase.java
+++ b/core/java/android/test/InstrumentationTestCase.java
@@ -32,13 +32,7 @@ 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;
@@ -46,7 +40,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 a53fa267f1e1..7a78ffbb226d 100644
--- a/core/java/android/test/InstrumentationTestSuite.java
+++ b/core/java/android/test/InstrumentationTestSuite.java
@@ -25,13 +25,7 @@ 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 65bd4a48f7f5..679ad406c733 100644
--- a/core/java/android/test/PerformanceTestCase.java
+++ b/core/java/android/test/PerformanceTestCase.java
@@ -18,11 +18,10 @@ 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
{
/**
@@ -38,27 +37,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 cd06ab890074..cd9223184da2 100644
--- a/core/java/android/test/UiThreadTest.java
+++ b/core/java/android/test/UiThreadTest.java
@@ -26,13 +26,7 @@ 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 dc77ee6b2739..a6269e787556 100644
--- a/core/java/android/test/suitebuilder/annotation/LargeTest.java
+++ b/core/java/android/test/suitebuilder/annotation/LargeTest.java
@@ -23,13 +23,7 @@ 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 b941da03ac9a..8afeb911d065 100644
--- a/core/java/android/test/suitebuilder/annotation/MediumTest.java
+++ b/core/java/android/test/suitebuilder/annotation/MediumTest.java
@@ -24,12 +24,7 @@ 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 d3c74f019b53..ad530e287343 100644
--- a/core/java/android/test/suitebuilder/annotation/SmallTest.java
+++ b/core/java/android/test/suitebuilder/annotation/SmallTest.java
@@ -23,13 +23,7 @@ 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 aac293796be1..237e0333b4ef 100644
--- a/core/java/android/test/suitebuilder/annotation/Smoke.java
+++ b/core/java/android/test/suitebuilder/annotation/Smoke.java
@@ -27,11 +27,7 @@ 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 629a3cf4a2cd..f16c8fafa4af 100644
--- a/core/java/android/test/suitebuilder/annotation/Suppress.java
+++ b/core/java/android/test/suitebuilder/annotation/Suppress.java
@@ -26,12 +26,7 @@ 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 aca1c160ba84..a59ee35c2085 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 0e61ce727c40..c4bcf312ad9c 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}.
*
- * @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>.
+ * <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
-public abstract class ActivityInstrumentationTestCase2<T extends Activity>
+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 51dd3ef8c35b..c7b1d7017fc2 100644
--- a/test-runner/src/android/test/ActivityTestCase.java
+++ b/test-runner/src/android/test/ActivityTestCase.java
@@ -25,11 +25,7 @@ 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 a191445d8af5..40cca90d1b42 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,12 +72,8 @@ 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.
*/
-@Deprecated
-public abstract class ActivityUnitTestCase<T extends Activity>
+public abstract class ActivityUnitTestCase<T extends Activity>
extends ActivityTestCase {
private static final String TAG = "ActivityUnitTestCase";
@@ -106,31 +102,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);
@@ -158,7 +154,7 @@ public abstract class ActivityUnitTestCase<T extends Activity>
assertNotNull(newActivity);
setActivity(newActivity);
-
+
mAttached = true;
}
@@ -169,22 +165,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.
*/
@@ -202,7 +198,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() {
@@ -211,10 +207,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.
*/
@@ -224,9 +220,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.
*/
@@ -238,9 +234,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.
*/
@@ -250,9 +246,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.
*/
@@ -262,7 +258,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:
@@ -273,7 +269,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 {
@@ -307,7 +303,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>
@@ -320,7 +316,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 50eaafbae39d..aa7c677c968f 100644
--- a/test-runner/src/android/test/AndroidTestRunner.java
+++ b/test-runner/src/android/test/AndroidTestRunner.java
@@ -33,13 +33,6 @@ 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 4d73f5300840..f0931814ff7d 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,28 +40,22 @@ 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;
@@ -84,17 +78,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.
*/
@@ -107,26 +101,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
@@ -137,13 +131,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
@@ -151,7 +145,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);
@@ -162,7 +156,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() {
@@ -171,7 +165,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 fc3e98e965c7..b3ac6d145ab8 100644
--- a/test-runner/src/android/test/AssertionFailedError.java
+++ b/test-runner/src/android/test/AssertionFailedError.java
@@ -18,18 +18,17 @@ 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 1ab7c7faeca4..1f6e64780b81 100644
--- a/test-runner/src/android/test/ClassPathPackageInfo.java
+++ b/test-runner/src/android/test/ClassPathPackageInfo.java
@@ -24,10 +24,9 @@ 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 89bb494e02dd..0ffecdb8e969 100644
--- a/test-runner/src/android/test/ClassPathPackageInfoSource.java
+++ b/test-runner/src/android/test/ClassPathPackageInfoSource.java
@@ -33,10 +33,9 @@ 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";
@@ -83,7 +82,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 42ef48b38a24..23e0aba677a4 100644
--- a/test-runner/src/android/test/DatabaseTestUtils.java
+++ b/test-runner/src/android/test/DatabaseTestUtils.java
@@ -27,7 +27,6 @@ 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 2b05e4a877b3..655a65c1c0f8 100644
--- a/test-runner/src/android/test/InstrumentationCoreTestRunner.java
+++ b/test-runner/src/android/test/InstrumentationCoreTestRunner.java
@@ -41,7 +41,6 @@ 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 9bd4c966496d..db80ef951570 100644
--- a/test-runner/src/android/test/InstrumentationTestRunner.java
+++ b/test-runner/src/android/test/InstrumentationTestRunner.java
@@ -155,10 +155,6 @@ 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)
@@ -174,7 +170,6 @@ 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 cc508132ba21..1a7002ab4844 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 3abf38f3b224..f971b5ded187 100644
--- a/test-runner/src/android/test/IsolatedContext.java
+++ b/test-runner/src/android/test/IsolatedContext.java
@@ -43,13 +43,9 @@ 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 62c90d6a4373..d423e624193d 100644
--- a/test-runner/src/android/test/LaunchPerformanceBase.java
+++ b/test-runner/src/android/test/LaunchPerformanceBase.java
@@ -26,7 +26,6 @@ import android.os.Bundle;
*
* @hide
*/
-@Deprecated
public class LaunchPerformanceBase extends Instrumentation {
public static final String LOG_TAG = "Launch Performance";
@@ -40,7 +39,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 d33911a186cc..33648953e57d 100644
--- a/test-runner/src/android/test/MoreAsserts.java
+++ b/test-runner/src/android/test/MoreAsserts.java
@@ -30,10 +30,7 @@ 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() { }
@@ -378,7 +375,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 a01b6aad3a38..1ee62c169090 100644
--- a/test-runner/src/android/test/NoExecTestResult.java
+++ b/test-runner/src/android/test/NoExecTestResult.java
@@ -19,12 +19,11 @@ 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 205f86b04d5f..ef3744911956 100644
--- a/test-runner/src/android/test/PackageInfoSources.java
+++ b/test-runner/src/android/test/PackageInfoSources.java
@@ -19,7 +19,6 @@ 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 3a5dafc0db75..4309ff73eb5f 100644
--- a/test-runner/src/android/test/PerformanceCollectorTestCase.java
+++ b/test-runner/src/android/test/PerformanceCollectorTestCase.java
@@ -30,7 +30,6 @@ 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 36786b09df26..3c4da9e82f81 100644
--- a/test-runner/src/android/test/RenamingDelegatingContext.java
+++ b/test-runner/src/android/test/RenamingDelegatingContext.java
@@ -36,11 +36,7 @@ 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;
@@ -172,7 +168,7 @@ public class RenamingDelegatingContext extends ContextWrapper {
return false;
}
}
-
+
@Override
public File getDatabasePath(String name) {
return mFileContext.getDatabasePath(renamedFileName(name));
@@ -220,7 +216,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
@@ -245,4 +241,21 @@ 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 c8ff0f904d6d..ba20c0980e7a 100644
--- a/test-runner/src/android/test/ServiceTestCase.java
+++ b/test-runner/src/android/test/ServiceTestCase.java
@@ -92,13 +92,7 @@ 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 46143e4879b8..44424ec56918 100644
--- a/test-runner/src/android/test/SimpleCache.java
+++ b/test-runner/src/android/test/SimpleCache.java
@@ -19,7 +19,6 @@ 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 af1448e55678..72c93cef3fde 100644
--- a/test-runner/src/android/test/SingleLaunchActivityTestCase.java
+++ b/test-runner/src/android/test/SingleLaunchActivityTestCase.java
@@ -22,19 +22,13 @@ 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;
@@ -50,10 +44,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.
*/
@@ -72,7 +66,7 @@ public abstract class SingleLaunchActivityTestCase<T extends Activity>
getInstrumentation().setInTouchMode(false);
sActivity = launchActivity(mPackage, mActivityClass, null);
sActivityLaunchedFlag = true;
- }
+ }
}
@Override
@@ -81,7 +75,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 de36b4ff013f..7d418f09ead9 100644
--- a/test-runner/src/android/test/SyncBaseInstrumentation.java
+++ b/test-runner/src/android/test/SyncBaseInstrumentation.java
@@ -27,13 +27,7 @@ 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 b234f441c5c2..5432ce85463b 100644
--- a/test-runner/src/android/test/TestCase.java
+++ b/test-runner/src/android/test/TestCase.java
@@ -23,13 +23,14 @@ 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 c46d403f1350..3ba97118e56b 100644
--- a/test-runner/src/android/test/TestCaseUtil.java
+++ b/test-runner/src/android/test/TestCaseUtil.java
@@ -35,7 +35,6 @@ 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() {
@@ -68,7 +67,7 @@ public class TestCaseUtil {
*/
if (test instanceof TestCase &&
((TestCase)test).getName() == null) {
- workingTest = invokeSuiteMethodIfPossible(test.getClass(),
+ workingTest = invokeSuiteMethodIfPossible(test.getClass(),
seen);
}
if (workingTest == null) {
@@ -156,7 +155,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 a23f06dde9b0..37bd721c9bab 100644
--- a/test-runner/src/android/test/TestPrinter.java
+++ b/test-runner/src/android/test/TestPrinter.java
@@ -30,10 +30,9 @@ 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;
@@ -90,7 +89,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 beecc6fdd9de..012df3501026 100644
--- a/test-runner/src/android/test/TestRunner.java
+++ b/test-runner/src/android/test/TestRunner.java
@@ -42,7 +42,6 @@ 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 c74651cea01f..dc9ce6e3bc10 100644
--- a/test-runner/src/android/test/TestSuiteProvider.java
+++ b/test-runner/src/android/test/TestSuiteProvider.java
@@ -21,7 +21,6 @@ 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 cb15ef907050..95cc9bffd42c 100644
--- a/test-runner/src/android/test/TimedTest.java
+++ b/test-runner/src/android/test/TimedTest.java
@@ -30,7 +30,6 @@ 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 28dc7b2f900c..1b854b069ec0 100644
--- a/test-runner/src/android/test/TouchUtils.java
+++ b/test-runner/src/android/test/TouchUtils.java
@@ -31,15 +31,9 @@ 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
@@ -52,7 +46,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
@@ -62,14 +56,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
@@ -82,7 +76,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
@@ -92,18 +86,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
*
@@ -115,11 +109,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
@@ -138,7 +132,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
*
@@ -150,11 +144,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
@@ -168,10 +162,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
*
@@ -183,10 +177,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
@@ -194,10 +188,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
@@ -211,10 +205,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
@@ -226,38 +220,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);
@@ -314,30 +308,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();
@@ -350,7 +344,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) {
@@ -360,7 +354,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
*
@@ -375,20 +369,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();
@@ -405,7 +399,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) {
@@ -420,7 +414,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
*
@@ -432,10 +426,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
@@ -448,20 +442,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
@@ -469,21 +463,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)
@@ -494,7 +488,7 @@ public class TouchUtils {
final int viewWidth = v.getWidth();
final int viewHeight = v.getHeight();
-
+
switch (gravity & Gravity.VERTICAL_GRAVITY_MASK) {
case Gravity.TOP:
break;
@@ -507,7 +501,7 @@ public class TouchUtils {
default:
// Same as top -- do nothing
}
-
+
switch (gravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
case Gravity.LEFT:
break;
@@ -524,14 +518,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
@@ -543,17 +537,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
@@ -564,29 +558,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
@@ -601,14 +595,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,
@@ -616,28 +610,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
@@ -652,39 +646,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
@@ -696,37 +690,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
@@ -743,10 +737,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
@@ -763,7 +757,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 00ab44379994..c575fc5982bf 100644
--- a/test-runner/src/android/test/ViewAsserts.java
+++ b/test-runner/src/android/test/ViewAsserts.java
@@ -23,15 +23,7 @@ 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 3257ecf11066..572dfbf2b5e6 100644
--- a/test-runner/src/android/test/mock/MockApplication.java
+++ b/test-runner/src/android/test/mock/MockApplication.java
@@ -20,17 +20,12 @@ 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() {
}
@@ -43,7 +38,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 3743fb0811f8..5ef71df341bf 100644
--- a/test-runner/src/android/test/mock/MockContentProvider.java
+++ b/test-runner/src/android/test/mock/MockContentProvider.java
@@ -41,12 +41,7 @@ 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 75c8335b6653..aec6c772f3a5 100644
--- a/test-runner/src/android/test/mock/MockContentResolver.java
+++ b/test-runner/src/android/test/mock/MockContentResolver.java
@@ -49,12 +49,8 @@ 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 9b93bda56ea5..64d29787f75f 100644
--- a/test-runner/src/android/test/mock/MockContext.java
+++ b/test-runner/src/android/test/mock/MockContext.java
@@ -52,15 +52,10 @@ 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
@@ -87,12 +82,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();
@@ -129,7 +124,7 @@ public class MockContext extends Context {
public ApplicationInfo getApplicationInfo() {
throw new UnsupportedOperationException();
}
-
+
@Override
public String getPackageResourcePath() {
throw new UnsupportedOperationException();
@@ -199,7 +194,7 @@ public class MockContext extends Context {
public File getObbDir() {
throw new UnsupportedOperationException();
}
-
+
@Override
public File getCacheDir() {
throw new UnsupportedOperationException();
@@ -221,7 +216,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();
}
@@ -315,7 +310,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 576f24ad6384..28fa0f8041ac 100644
--- a/test-runner/src/android/test/mock/MockCursor.java
+++ b/test-runner/src/android/test/mock/MockCursor.java
@@ -25,18 +25,15 @@ 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}.
- *
- * @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>.
+ * </P>
*/
-@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 d0a5a097918d..e4dd0ba2a2d3 100644
--- a/test-runner/src/android/test/mock/MockDialogInterface.java
+++ b/test-runner/src/android/test/mock/MockDialogInterface.java
@@ -1,33 +1,14 @@
-/*
- * 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.
- */
+// Copyright 2008 The Android Open Source Project
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 ffb73f63230c..5296d4d77657 100644
--- a/test-runner/src/android/test/mock/MockPackageManager.java
+++ b/test-runner/src/android/test/mock/MockPackageManager.java
@@ -60,12 +60,7 @@ 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 880343e5e780..18752cebde1e 100644
--- a/test-runner/src/android/test/mock/MockResources.java
+++ b/test-runner/src/android/test/mock/MockResources.java
@@ -32,15 +32,10 @@ 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() {