Setup NativeTestServer

this adds the classes dependent on the nativetestserverThis adds the classes dependent on the nativetestserver.

This setup depends on the cronet's platform implementation.
However, the tests jnilib is not prefixed and
because of that:
- We don't jarjar the base classes
- Don't jar the test classes
since the .so file needs the unjarjared versions.

Test: atest NetHttpTestServer
Bug: 267353182
Change-Id: Id5cfc8f842df4b13cef6f56dbaa6b9563c3989de
This commit is contained in:
Chidera Olibie
2023-03-21 15:43:41 +00:00
parent 4a755a7a99
commit 5b95954882
3 changed files with 31 additions and 3 deletions

View File

@@ -35,7 +35,7 @@ android_test {
"CtsNetHttpTestsLib",
"NetHttpTestsLibPreJarJar",
],
jarjar_rules: ":framework-tethering-jarjar-rules",
jarjar_rules: ":net-http-test-jarjar-rules",
compile_multilib: "both", // Include both the 32 and 64 bit versions
jni_libs: [
"//external/cronet:cronet_aml_components_cronet_android_cronet_tests__testing"

View File

@@ -17,12 +17,30 @@ package {
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.http.internal " +
"--excludes $(location jarjar_excludes.txt) " +
"--output $(out)",
}
android_library {
name: "NetHttpTestsLibPreJarJar",
srcs: ["//external/cronet:cronet_aml_javatests_sources"],
sdk_version: "test_current",
sdk_version: "module_current",
min_sdk_version: "30",
static_libs: [
"//external/cronet:cronet_testserver_utils",
"androidx.test.ext.junit",
"androidx.test.rules",
"junit",
@@ -41,7 +59,7 @@ android_test {
"mts-target-sdk-version-current",
],
static_libs: ["NetHttpTestsLibPreJarJar"],
jarjar_rules: ":framework-tethering-jarjar-rules",
jarjar_rules: ":net-http-test-jarjar-rules",
jni_libs: [
"//external/cronet:cronet_aml_components_cronet_android_cronet_tests__testing"
],

View File

@@ -0,0 +1,10 @@
# It's prohibited to jarjar androidx packages
androidx\..+
# 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\..+
# 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(\$.+)?