Move apache HTTP tests out of tests/net

The apache HTTP library is part of the platform core APIs, which are
separate from the core networking APIs.

cts/tests/tests/net is planned to move to a separate git project to put
it closer to the associated connectivity module code.

Bug: 170371348
Test: m cts && cts-tradefed run cts -m CtsApacheHttpTestCases
Change-Id: I49972b21755235e280c75eec40db14f3db974ca1
diff --git a/tests/tests/apache-http/Android.bp b/tests/tests/apache-http/Android.bp
new file mode 100644
index 0000000..9167002
--- /dev/null
+++ b/tests/tests/apache-http/Android.bp
@@ -0,0 +1,40 @@
+// Copyright (C) 2020 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.
+
+android_test {
+    name: "CtsApacheHttpTestCases",
+    defaults: ["cts_defaults"],
+    sdk_version: "test_current",
+    srcs: [
+        "src/**/*.java",
+        "src/**/*.kt",
+    ],
+    libs: [
+        "android.test.base",
+        "org.apache.http.legacy",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "mockwebserver",
+        "ctstestserver",
+    ],
+    jni_libs: [
+        "libcts_jni",
+    ],
+    test_suites: [
+        "cts",
+        "general-tests",
+    ],
+    compile_multilib: "both",
+}
diff --git a/tests/tests/apache-http/AndroidManifest.xml b/tests/tests/apache-http/AndroidManifest.xml
new file mode 100644
index 0000000..8fa478b
--- /dev/null
+++ b/tests/tests/apache-http/AndroidManifest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="android.apachehttp.cts">
+
+    <uses-permission android:name="android.permission.INTERNET" />
+
+    <application android:usesCleartextTraffic="true">
+        <uses-library android:name="android.test.runner" />
+    </application>
+
+    <!--  self-instrumenting test package. -->
+    <instrumentation
+        android:name="androidx.test.runner.AndroidJUnitRunner"
+        android:targetPackage="android.apachehttp.cts" >
+    </instrumentation>
+</manifest>
diff --git a/tests/tests/apache-http/AndroidTest.xml b/tests/tests/apache-http/AndroidTest.xml
new file mode 100644
index 0000000..0bd9d28
--- /dev/null
+++ b/tests/tests/apache-http/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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.
+-->
+
+<configuration description="Config for CtsApacheHttpDeviceTestCases">
+    <option name="test-suite-tag" value="cts" />
+    <option name="config-descriptor:metadata" key="component" value="networking" />
+    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+        <option name="cleanup-apks" value="true" />
+        <option name="test-file-name" value="CtsApacheHttpTestCases.apk" />
+    </target_preparer>
+    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+        <option name="package" value="android.apachehttp.cts" />
+    </test>
+</configuration>
diff --git a/tests/tests/apache-http/OWNERS b/tests/tests/apache-http/OWNERS
new file mode 100644
index 0000000..b9032af
--- /dev/null
+++ b/tests/tests/apache-http/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 24949
+include platform/frameworks/base:/core/java/android/net/http/OWNERS
diff --git a/tests/tests/net/src/android/net/http/cts/ApacheHttpClientTest.java b/tests/tests/apache-http/src/android/net/http/cts/ApacheHttpClientTest.java
similarity index 100%
rename from tests/tests/net/src/android/net/http/cts/ApacheHttpClientTest.java
rename to tests/tests/apache-http/src/android/net/http/cts/ApacheHttpClientTest.java
diff --git a/tests/tests/net/src/android/net/http/cts/HttpResponseCacheTest.java b/tests/tests/apache-http/src/android/net/http/cts/HttpResponseCacheTest.java
similarity index 100%
rename from tests/tests/net/src/android/net/http/cts/HttpResponseCacheTest.java
rename to tests/tests/apache-http/src/android/net/http/cts/HttpResponseCacheTest.java
diff --git a/tests/tests/net/src/android/net/http/cts/SslCertificateTest.java b/tests/tests/apache-http/src/android/net/http/cts/SslCertificateTest.java
similarity index 100%
rename from tests/tests/net/src/android/net/http/cts/SslCertificateTest.java
rename to tests/tests/apache-http/src/android/net/http/cts/SslCertificateTest.java
diff --git a/tests/tests/net/src/android/net/http/cts/SslCertificate_DNameTest.java b/tests/tests/apache-http/src/android/net/http/cts/SslCertificate_DNameTest.java
similarity index 100%
rename from tests/tests/net/src/android/net/http/cts/SslCertificate_DNameTest.java
rename to tests/tests/apache-http/src/android/net/http/cts/SslCertificate_DNameTest.java
diff --git a/tests/tests/net/src/android/net/http/cts/SslErrorTest.java b/tests/tests/apache-http/src/android/net/http/cts/SslErrorTest.java
similarity index 100%
rename from tests/tests/net/src/android/net/http/cts/SslErrorTest.java
rename to tests/tests/apache-http/src/android/net/http/cts/SslErrorTest.java
diff --git a/tests/tests/net/src/android/net/http/cts/X509TrustManagerExtensionsTest.java b/tests/tests/apache-http/src/android/net/http/cts/X509TrustManagerExtensionsTest.java
similarity index 100%
rename from tests/tests/net/src/android/net/http/cts/X509TrustManagerExtensionsTest.java
rename to tests/tests/apache-http/src/android/net/http/cts/X509TrustManagerExtensionsTest.java
diff --git a/tests/tests/net/src/org/apache/http/conn/ssl/cts/AbstractVerifierTest.java b/tests/tests/apache-http/src/org/apache/http/conn/ssl/cts/AbstractVerifierTest.java
similarity index 100%
rename from tests/tests/net/src/org/apache/http/conn/ssl/cts/AbstractVerifierTest.java
rename to tests/tests/apache-http/src/org/apache/http/conn/ssl/cts/AbstractVerifierTest.java
diff --git a/tests/tests/net/Android.bp b/tests/tests/net/Android.bp
index 4c00428..3b69602 100644
--- a/tests/tests/net/Android.bp
+++ b/tests/tests/net/Android.bp
@@ -21,7 +21,6 @@
 
     libs: [
         "voip-common",
-        "org.apache.http.legacy",
         "android.test.base",
     ],
 
@@ -40,14 +39,11 @@
     static_libs: [
         "FrameworksNetCommonTests",
         "TestNetworkStackLib",
-        "compatibility-device-util-axt",
         "core-tests-support",
         "cts-net-utils",
         "ctstestrunner-axt",
-        "ctstestserver",
         "junit",
         "junit-params",
-        "mockwebserver",
         "net-utils-framework-common",
         "truth-prebuilt",
     ],