Remove NetHttpTests

The NetHttpTests is not being run anywhere and
has been a source of duplication with NetHttpCoverageTests.

This cl removes this target and merges the xml to
that of NetHttpCoverageTests which is our MTS target.

Bug:b/329262802
Test: atest NetHttpCoverageTests
Change-Id: Id1faead3bdea5ba5a65938dcd88d4ebca5a16ebc
This commit is contained in:
Chidera Olibie 2024-04-09 09:27:08 +00:00
commit a791b70ab1
10 changed files with 44 additions and 165 deletions

View file

@ -25,6 +25,7 @@ package {
// TODO: Consider merging with ConnectivityCoverageTests which is a collection of all
// Connectivity tests being used for coverage. This will depend on how far we decide to
// go with merging NetHttp and Tethering targets.
// Target used for coverage. Combines CTS tests and our MTS tests.
android_test {
name: "NetHttpCoverageTests",
enforce_default_target_sdk_version: true,
@ -47,3 +48,32 @@ android_test {
],
data: [":cronet_javatests_resources"],
}
// MTS-only specific targets.
java_genrule {
name: "net-http-test-jarjar-rules",
tool_files: [
":NetHttpTestsLibPreJarJar{.jar}",
"jarjar_excludes.txt",
],
tools: [
"jarjar-rules-generator",
],
out: ["net_http_test_jarjar_rules.txt"],
cmd: "$(location jarjar-rules-generator) " +
"$(location :NetHttpTestsLibPreJarJar{.jar}) " +
"--prefix android.net.connectivity " +
"--excludes $(location jarjar_excludes.txt) " +
"--output $(out)",
}
android_library {
name: "NetHttpTestsLibPreJarJar",
static_libs: [
"cronet_aml_api_java",
"cronet_aml_java__testing",
"cronet_java_tests",
],
sdk_version: "module_current",
min_sdk_version: "30",
}

View file

@ -19,12 +19,16 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.android.net.http.tests.coverage">
<!-- NetHttpCoverageTests combines CtsNetHttpTestCases and NetHttpTests targets,
so permissions and others are declared in their respective manifests -->
<application tools:replace="android:label"
android:label="NetHttp coverage tests">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<application android:networkSecurityConfig="@xml/network_security_config"
tools:replace="android:label"
android:label="NetHttp coverage tests" >
<uses-library android:name="android.test.runner" />
</application>
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.net.http.tests.coverage"
android:label="NetHttp coverage tests">

View file

@ -24,10 +24,14 @@
<option name="push-file" key="net" value="/storage/emulated/0/chromium_tests_root/net" />
<option name="push-file" key="test_server" value="/storage/emulated/0/chromium_tests_root/components/cronet/testing/test_server" />
</target_preparer>
<!-- Tethering/Connectivity is a SDK 30+ module -->
<!-- TODO Switch back to Sdk30 when b/270049141 is fixed -->
<!-- Tethering/Connectivity is a SDK 30+ module however Cronet is installed on 31+ due to b/270049141. -->
<object type="module_controller"
class="com.android.tradefed.testtype.suite.module.Sdk31ModuleController" />
<!-- Only run NetHttpCoverageTests in MTS if the Tethering Mainline module is installed. -->
<object type="module_controller"
class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
<option name="mainline-module-package-name" value="com.google.android.tethering" />
</object>
<option name="config-descriptor:metadata" key="mainline-param"
value="CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk+com.google.android.resolv.apex+com.google.android.tethering.apex" />
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >

View file

@ -0,0 +1,29 @@
# Exclude some test prefixes, as they can't be found after being jarjared.
com\.android\.testutils\..+
# jarjar-gen can't handle some kotlin object expression, exclude packages that include them
androidx\..+
# don't jarjar netty as it does JNI
io\.netty\..+
kotlin\.test\..+
kotlin\.reflect\..+
org\.mockito\..+
# Do not jarjar the api classes
android\.net\..+
# cronet_tests.so is not jarjared and uses base classes. We can remove this when there's a
# separate java base target to depend on.
org\.chromium\.base\..+
J\.cronet_tests_N(\$.+)?
# don't jarjar automatically generated FooJni files.
org\.chromium\.net\..+Jni(\$.+)?
# Do not jarjar the tests and its utils as they also do JNI with cronet_tests.so
org\.chromium\.net\..*Test.*(\$.+)?
org\.chromium\.net\.NativeTestServer(\$.+)?
org\.chromium\.net\.MockUrlRequestJobFactory(\$.+)?
org\.chromium\.net\.QuicTestServer(\$.+)?
org\.chromium\.net\.MockCertVerifier(\$.+)?
org\.chromium\.net\.LogcatCapture(\$.+)?
org\.chromium\.net\.ReportingCollector(\$.+)?
org\.chromium\.net\.Http2TestServer(\$.+)?
org\.chromium\.net\.Http2TestHandler(\$.+)?

View file

@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIC/jCCAeagAwIBAgIUXOi6XoxnMUjJg4jeOwRhsdqEqEQwDQYJKoZIhvcNAQEL
BQAwFzEVMBMGA1UEAwwMVGVzdCBSb290IENBMB4XDTIzMDYwMTExMjcwMFoXDTMz
MDUyOTExMjcwMFowFzEVMBMGA1UEAwwMVGVzdCBSb290IENBMIIBIjANBgkqhkiG
9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl9xCMPMIvfmJWz25AG/VtgWbqNs67HXQbXWf
pDF2wjQpHVOYbfl7Zgly5O+5es1aUbJaGyZ9G6xuYSXKFnnYLoP7M86O05fQQBAj
K+IE5nO6136ksCAfxCFTFfn4vhPvK8Vba5rqox4WeIXYKvHYSoiHz0ELrnFOHcyN
Innyze7bLtkMCA1ShHpmvDCR+U3Uj6JwOfoirn29jjU/48/ORha7dcJYtYXk2eGo
RJfrtIx20tXAaKaGnXOCGYbEVXTeQkQPqKFVzqP7+KYS/Y8eNFV35ugpLNES+44T
bQ2QruTZdrNRjJkEoyiB/E53a0OUltB/R7Z0L0xstnKfsAf3OwIDAQABo0IwQDAP
BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUVdXNh2lk
51/6hMmz0Z+OpIe8+f0wDQYJKoZIhvcNAQELBQADggEBADNg7G8n6DUrQ5doXzm9
kOp5siX6iPs0zFReXKhIT1Gef63l3tb7AdPedF03aj9XkUt0shhNOGG5SK2k5KBQ
MJc9muYRCAyo2xMr3rFUQdI5B51SCy5HeAMralgTHXN0Hv+TH04YfRrACVmr+5ke
pH3bF1gYaT+Zy5/pHJnV5lcwS6/H44g9XXWIopjWCwbfzKxIuWofqL4fiToPSIYu
MCUI4bKZipcJT5O6rdz/S9lbgYVjOJ4HAoT2icNQqNMMfULKevmF8SdJzfNd35yn
tAKTROhIE2aQRVCclrjo/T3eyjWGGoJlGmxKbeCf/rXzcn1BRtk/UzLnbUFFlg5l
axw=
-----END CERTIFICATE-----

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2023 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.
-->
<resources>
<bool name="is_running_in_aosp">true</bool>
</resources>

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 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.
-->
<network-security-config>
<base-config>
<trust-anchors>
<certificates src="@raw/quicroot"/>
<certificates src="system"/>
</trust-anchors>
</base-config>
<!-- Since Android 9 (API 28) cleartext support is disabled by default, this
causes some of our tests to fail (see crbug/1220357).
The following configs allow http requests for the domains used in these
tests.
TODO(stefanoduo): Figure out if we really need to use http for these tests
-->
<domain-config cleartextTrafficPermitted="true">
<!-- Used as the base URL by native test server (net::EmbeddedTestServer) -->
<domain includeSubdomains="true">127.0.0.1</domain>
<!-- Used by CronetHttpURLConnectionTest#testIOExceptionInterruptRethrown -->
<domain includeSubdomains="true">localhost</domain>
<!-- Used by CronetHttpURLConnectionTest#testBadIP -->
<domain includeSubdomains="true">0.0.0.0</domain>
<!-- Used by CronetHttpURLConnectionTest#testSetUseCachesFalse -->
<domain includeSubdomains="true">host-cache-test-host</domain>
<!-- Used by CronetHttpURLConnectionTest#testBadHostname -->
<domain includeSubdomains="true">this-weird-host-name-does-not-exist</domain>
<!-- Used by CronetUrlRequestContextTest#testHostResolverRules -->
<domain includeSubdomains="true">some-weird-hostname</domain>
</domain-config>
</network-security-config>

View file

@ -1,68 +0,0 @@
// Copyright (C) 2023 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package {
default_team: "trendy_team_fwk_core_networking",
// See: http://go/android-license-faq
default_applicable_licenses: ["Android-Apache-2.0"],
}
java_genrule {
name: "net-http-test-jarjar-rules",
tool_files: [
":NetHttpTestsLibPreJarJar{.jar}",
"jarjar_excludes.txt",
],
tools: [
"jarjar-rules-generator",
],
out: ["net_http_test_jarjar_rules.txt"],
cmd: "$(location jarjar-rules-generator) " +
"$(location :NetHttpTestsLibPreJarJar{.jar}) " +
"--prefix android.net.connectivity " +
"--excludes $(location jarjar_excludes.txt) " +
"--output $(out)",
}
// Library to be used in coverage tests. cronet_java_tests can't be used directly because the common
// tests need to inherit the NetHttpTests manifest.
android_library {
name: "NetHttpTestsLibPreJarJar",
static_libs: [
"cronet_aml_api_java",
"cronet_aml_java__testing",
"cronet_java_tests",
],
sdk_version: "module_current",
min_sdk_version: "30",
}
android_test {
name: "NetHttpTests",
defaults: [
"mts-target-sdk-version-current",
],
static_libs: ["NetHttpTestsLibPreJarJar"],
jarjar_rules: ":net-http-test-jarjar-rules",
jni_libs: [
"cronet_aml_components_cronet_android_cronet__testing",
"cronet_aml_components_cronet_android_cronet_tests__testing",
"cronet_aml_third_party_netty_tcnative_netty_tcnative_so__testing",
],
test_suites: [
"general-tests",
"mts-tethering",
],
data: [":cronet_javatests_resources"],
}

View file

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2023 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.net.http.mts">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<application android:networkSecurityConfig="@xml/network_security_config">
<uses-library android:name="android.test.runner" />
</application>
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.net.http.mts"
android:label="MTS tests of android.net.http">
</instrumentation>
</manifest>

View file

@ -1,58 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2023 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="Runs NetHttp Mainline Tests.">
<!-- Only run tests if the device under test is SDK version 30 or above. -->
<!-- TODO Switch back to Sdk30 when b/270049141 is fixed -->
<object type="module_controller"
class="com.android.tradefed.testtype.suite.module.Sdk31ModuleController" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="test-file-name" value="NetHttpTests.apk" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="push-file" key="net" value="/storage/emulated/0/chromium_tests_root/net" />
<option name="push-file" key="test_server" value="/storage/emulated/0/chromium_tests_root/components/cronet/testing/test_server" />
</target_preparer>
<option name="test-tag" value="NetHttpTests" />
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="android.net.http.mts" />
<option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
<!-- b/298380508 -->
<option name="exclude-filter" value="org.chromium.net.CronetUrlRequestContextTest#testSetLibraryLoaderIsEnforcedByDefaultEmbeddedProvider" />
<!-- b/316559294 -->
<option name="exclude-filter" value="org.chromium.net.NQETest#testQuicDisabled" />
<!-- b/316559294 -->
<option name="exclude-filter" value="org.chromium.net.NQETest#testPrefsWriteRead" />
<!-- b/316554711-->
<option name="exclude-filter" value="org.chromium.net.NetworkChangesTest" />
<!-- b/316550794 -->
<option name="exclude-filter" value="org.chromium.net.impl.CronetLoggerTest#testEngineCreation" />
<!-- b/327182569 -->
<option name="exclude-filter" value="org.chromium.net.urlconnection.CronetURLStreamHandlerFactoryTest#testSetUrlStreamFactoryUsesCronetForNative" />
<option name="hidden-api-checks" value="false"/>
<option name="isolated-storage" value="false"/>
<option name="orchestrator" value="true"/>
</test>
<!-- Only run NetHttpTests in MTS if the Tethering Mainline module is installed. -->
<object type="module_controller"
class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
<option name="mainline-module-package-name" value="com.google.android.tethering" />
</object>
</configuration>