diff options
-rw-r--r-- | Cronet/tests/common/Android.bp | 30 | ||||
-rw-r--r-- | Cronet/tests/common/AndroidManifest.xml | 12 | ||||
-rw-r--r-- | Cronet/tests/common/AndroidTest.xml | 8 | ||||
-rw-r--r-- | Cronet/tests/common/jarjar_excludes.txt (renamed from Cronet/tests/mts/jarjar_excludes.txt) | 0 | ||||
-rw-r--r-- | Cronet/tests/common/res/raw/quicroot.pem (renamed from Cronet/tests/mts/res/raw/quicroot.pem) | 0 | ||||
-rw-r--r-- | Cronet/tests/common/res/values/cronet-test-rule-configuration.xml (renamed from Cronet/tests/mts/res/values/cronet-test-rule-configuration.xml) | 0 | ||||
-rw-r--r-- | Cronet/tests/common/res/xml/network_security_config.xml (renamed from Cronet/tests/mts/res/xml/network_security_config.xml) | 0 | ||||
-rw-r--r-- | Cronet/tests/mts/Android.bp | 68 | ||||
-rw-r--r-- | Cronet/tests/mts/AndroidManifest.xml | 33 | ||||
-rw-r--r-- | Cronet/tests/mts/AndroidTest.xml | 58 |
10 files changed, 44 insertions, 165 deletions
diff --git a/Cronet/tests/common/Android.bp b/Cronet/tests/common/Android.bp index 703f54479b..0b6eceffc7 100644 --- a/Cronet/tests/common/Android.bp +++ b/Cronet/tests/common/Android.bp @@ -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", +} diff --git a/Cronet/tests/common/AndroidManifest.xml b/Cronet/tests/common/AndroidManifest.xml index b00fc90adb..418af8641b 100644 --- a/Cronet/tests/common/AndroidManifest.xml +++ b/Cronet/tests/common/AndroidManifest.xml @@ -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"> diff --git a/Cronet/tests/common/AndroidTest.xml b/Cronet/tests/common/AndroidTest.xml index 7646a04f84..bb7ed11473 100644 --- a/Cronet/tests/common/AndroidTest.xml +++ b/Cronet/tests/common/AndroidTest.xml @@ -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" > diff --git a/Cronet/tests/mts/jarjar_excludes.txt b/Cronet/tests/common/jarjar_excludes.txt index b5cdf6e169..b5cdf6e169 100644 --- a/Cronet/tests/mts/jarjar_excludes.txt +++ b/Cronet/tests/common/jarjar_excludes.txt diff --git a/Cronet/tests/mts/res/raw/quicroot.pem b/Cronet/tests/common/res/raw/quicroot.pem index af21b3e9a5..af21b3e9a5 100644 --- a/Cronet/tests/mts/res/raw/quicroot.pem +++ b/Cronet/tests/common/res/raw/quicroot.pem diff --git a/Cronet/tests/mts/res/values/cronet-test-rule-configuration.xml b/Cronet/tests/common/res/values/cronet-test-rule-configuration.xml index 48ce420ab2..48ce420ab2 100644 --- a/Cronet/tests/mts/res/values/cronet-test-rule-configuration.xml +++ b/Cronet/tests/common/res/values/cronet-test-rule-configuration.xml diff --git a/Cronet/tests/mts/res/xml/network_security_config.xml b/Cronet/tests/common/res/xml/network_security_config.xml index 32b717114f..32b717114f 100644 --- a/Cronet/tests/mts/res/xml/network_security_config.xml +++ b/Cronet/tests/common/res/xml/network_security_config.xml diff --git a/Cronet/tests/mts/Android.bp b/Cronet/tests/mts/Android.bp deleted file mode 100644 index 9486e1f0a4..0000000000 --- a/Cronet/tests/mts/Android.bp +++ /dev/null @@ -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"], -} diff --git a/Cronet/tests/mts/AndroidManifest.xml b/Cronet/tests/mts/AndroidManifest.xml deleted file mode 100644 index 2c56e3a9e1..0000000000 --- a/Cronet/tests/mts/AndroidManifest.xml +++ /dev/null @@ -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>
\ No newline at end of file diff --git a/Cronet/tests/mts/AndroidTest.xml b/Cronet/tests/mts/AndroidTest.xml deleted file mode 100644 index a438e2e039..0000000000 --- a/Cronet/tests/mts/AndroidTest.xml +++ /dev/null @@ -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> |