Move to android.support.test as CTS instrumentation runner.

Also do the following related cleanup
- Remove references to deprecated BrokenTest and KnownFailure
- Switch CTS tests to build against SDK and not private
android.test.runner where possible

Bug: 12924356

Change-Id: If6151b836456eec4838f8d7d6e11c9834c007fca
diff --git a/tools/cts-holo-generation/Android.mk b/tools/cts-holo-generation/Android.mk
index 5f12ef0..2affc5e 100644
--- a/tools/cts-holo-generation/Android.mk
+++ b/tools/cts-holo-generation/Android.mk
@@ -23,7 +23,7 @@
 LOCAL_DEX_PREOPT := false
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tools/cts-holo-generation/AndroidManifest.xml b/tools/cts-holo-generation/AndroidManifest.xml
index d7de891..ad4ae22 100644
--- a/tools/cts-holo-generation/AndroidManifest.xml
+++ b/tools/cts-holo-generation/AndroidManifest.xml
@@ -7,7 +7,7 @@
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
 
     <instrumentation
-        android:name="android.test.InstrumentationTestRunner"
+        android:name="android.support.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.holo_capture" />
 
     <application>
diff --git a/tools/cts-reference-app-lib/Android.mk b/tools/cts-reference-app-lib/Android.mk
index 8341970..fae85b4 100644
--- a/tools/cts-reference-app-lib/Android.mk
+++ b/tools/cts-reference-app-lib/Android.mk
@@ -24,7 +24,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_SDK_VERSION := current
 
 LOCAL_MODULE := android.cts.refapp
 
diff --git a/tools/device-setup/TestDeviceSetup/Android.mk b/tools/device-setup/TestDeviceSetup/Android.mk
index ba1998c..44e66bb 100644
--- a/tools/device-setup/TestDeviceSetup/Android.mk
+++ b/tools/device-setup/TestDeviceSetup/Android.mk
@@ -25,8 +25,6 @@
 LOCAL_DEX_PREOPT := false
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
 LOCAL_SDK_VERSION := current
 
 LOCAL_PACKAGE_NAME := TestDeviceSetup
diff --git a/tools/tradefed-host/.classpath b/tools/tradefed-host/.classpath
index 0b1866d..59f6deb 100644
--- a/tools/tradefed-host/.classpath
+++ b/tools/tradefed-host/.classpath
@@ -2,6 +2,7 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="src" path="res"/>
+	<classpathentry kind="src" path="commonutil-src"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry exported="true" kind="var" path="CTS_SRC_ROOT/out/host/common/obj/JAVA_LIBRARIES/ctsdeviceinfolib_intermediates/javalib.jar"/>
 	<classpathentry exported="true" kind="var" path="CTS_SRC_ROOT/out/host/common/obj/JAVA_LIBRARIES/hosttestlib_intermediates/javalib.jar"/>
diff --git a/tools/tradefed-host/.project b/tools/tradefed-host/.project
index 990c63e..ffd16af 100644
--- a/tools/tradefed-host/.project
+++ b/tools/tradefed-host/.project
@@ -14,4 +14,11 @@
 	<natures>
 		<nature>org.eclipse.jdt.core.javanature</nature>
 	</natures>
+	<linkedResources>
+		<link>
+			<name>commonutil-src</name>
+			<type>2</type>
+			<locationURI>CTS_SRC_ROOT/cts/libs/commonutil/src</locationURI>
+		</link>
+	</linkedResources>
 </projectDescription>
diff --git a/tools/utils/CollectAllTests.java b/tools/utils/CollectAllTests.java
index fe13e00..4efc8bd 100644
--- a/tools/utils/CollectAllTests.java
+++ b/tools/utils/CollectAllTests.java
@@ -324,21 +324,11 @@
         return getAnnotation(testClass, testName, KNOWN_FAILURE) != null;
     }
 
-    private static boolean isBrokenTest(final Class<? extends TestCase> testClass,
-            final String testName)  {
-        return getAnnotation(testClass, testName, BROKEN_TEST) != null;
-    }
-
     private static boolean isSuppressed(final Class<? extends TestCase> testClass,
             final String testName)  {
         return getAnnotation(testClass, testName, SUPPRESSED_TEST) != null;
     }
 
-    private static boolean hasSideEffects(final Class<? extends TestCase> testClass,
-            final String testName) {
-        return getAnnotation(testClass, testName, SIDE_EFFECT) != null;
-    }
-
     private static String getAnnotation(final Class<? extends TestCase> testClass,
             final String testName, final String annotationName) {
         try {
@@ -413,15 +403,9 @@
         if (isKnownFailure(test, testName)) {
             System.out.println("ignoring known failure: " + test + "#" + testName);
             return;
-        } else if (isBrokenTest(test, testName)) {
-            System.out.println("ignoring broken test: " + test + "#" + testName);
-            return;
         } else if (isSuppressed(test, testName)) {
             System.out.println("ignoring suppressed test: " + test + "#" + testName);
             return;
-        } else if (hasSideEffects(test, testName)) {
-            System.out.println("ignoring test with side effects: " + test + "#" + testName);
-            return;
         } else if (VogarUtils.isVogarKnownFailure(expectations,
                                                   testClassName,
                                                   testName)) {
diff --git a/tools/utils/DescriptionGenerator.java b/tools/utils/DescriptionGenerator.java
index 0731b49..607d2e5 100644
--- a/tools/utils/DescriptionGenerator.java
+++ b/tools/utils/DescriptionGenerator.java
@@ -66,8 +66,6 @@
 public class DescriptionGenerator extends Doclet {
     static final String HOST_CONTROLLER = "dalvik.annotation.HostController";
     static final String KNOWN_FAILURE = "dalvik.annotation.KnownFailure";
-    static final String BROKEN_TEST = "dalvik.annotation.BrokenTest";
-    static final String SIDE_EFFECT = "dalvik.annotation.SideEffect";
     static final String SUPPRESSED_TEST = "android.test.suitebuilder.annotation.Suppress";
     static final String CTS_EXPECTATION_DIR = "cts/tests/expectations";
 
@@ -545,8 +543,6 @@
                         controller = getAnnotationDescription(cAnnot);
                     } else if (atype.toString().equals(KNOWN_FAILURE)) {
                         knownFailure = getAnnotationDescription(cAnnot);
-                    } else if (atype.toString().equals(BROKEN_TEST)) {
-                        isBroken = true;
                     } else if (atype.toString().equals(SUPPRESSED_TEST)) {
                         isSuppressed = true;
                     }