• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2023 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// This is manually maintained and automatically included into the Android.bp by the gn2bp script.
16
17license {
18    name: "external_cronet_license",
19    license_kinds: [
20        "SPDX-license-identifier-Apache-2.0",
21        "SPDX-license-identifier-BSD",
22        "SPDX-license-identifier-BSD-3-Clause",
23        "SPDX-license-identifier-BSD-Source-Code",
24        "SPDX-license-identifier-BSD-2-Clause",
25        "SPDX-license-identifier-BSD-4-Clause",
26        "SPDX-license-identifier-BSL-1.0",
27        "SPDX-license-identifier-ICU",
28        "SPDX-license-identifier-ISC",
29        "SPDX-license-identifier-MIT",
30        "SPDX-license-identifier-MPL",
31        "SPDX-license-identifier-MPL-1.1",
32        "SPDX-license-identifier-MPL-2.0",
33        "SPDX-license-identifier-NCSA",
34        // "SPDX-license-identifier-GPL-2.0-with-autoconf-exception", // ICU TODO(aymanm): Reapply those once aosp/2470343 is merged
35        // "SPDX-license-identifier-GPL-3.0-with-autoconf-exception", // ICU TODO(aymanm): Reapply those once aosp/2470343 is merged
36        "SPDX-license-identifier-OpenSSL",
37        "SPDX-license-identifier-Unicode-DFS-2016",
38        "legacy_unencumbered",
39    ],
40    license_text: [
41        "LICENSE",
42    ],
43}
44
45java_library {
46    // Don't change the name of the module.
47    name: "cronet_aml_api_java",
48    srcs: [
49        ":cronet_aml_api_sources",
50    ],
51    libs: [
52        "androidx.annotation_annotation",
53        "framework-annotations-lib",
54        "framework-connectivity.stubs.module_lib",
55    ],
56    sdk_version: "module_current",
57    visibility: [
58        "//packages/modules/Connectivity:__subpackages__",
59    ],
60}
61
62// ------------------------------ NATIVE TEST TARGETS --------------------------------------------
63
64// jni_proxy_natives_defaults should only be applied to the "top-level" target (with respect to JNI
65// dependencies). Intermediate targets require an intermediate GEN_JNI to compile (so they need the
66// plugin without the flags). The intermediate GEN_JNI will eventually be overwritten by the GEN_JNI
67// produced by the jni_registration_generator genrule target.
68java_defaults {
69    name: "jni_proxy_natives_defaults",
70    plugins: [
71        "cronet_aml_java_jni_annotation_preprocessor",
72    ],
73    javacflags: [
74        "-Aorg.chromium.chrome.skipGenJni",
75    ],
76}
77
78// Similar to jni_proxy_natives_default, only a single jni_registration_generator target can be used
79// per dependency tree. It must include all dependent sources that contain JNI annotations
80// (non-exclusive).
81genrule_defaults {
82    name: "jni_registration_generator_defaults",
83    cmd: "current_dir=`basename \\`pwd\\``; " +
84         "for f in $(in); " +
85         "do " +
86         "echo \"../$$current_dir/$$f\" >> $(genDir)/java.sources; " +
87         "done; " +
88         "python3 $(location base/android/jni_generator/jni_registration_generator.py) --srcjar-path " +
89         "$(genDir)/components/cronet/android/cronet_tests_jni_registration.srcjar " +
90         "--sources-files " +
91         "$(genDir)/java.sources " +
92         "--include-test-only " +
93         "--use-proxy-hash " +
94         "--enable-proxy-mocks",
95    out: [
96        "components/cronet/android/cronet_tests_jni_registration.srcjar",
97    ],
98    tool_files: [
99        "base/android/jni_generator/jni_generator.py",
100        "base/android/jni_generator/jni_registration_generator.py",
101        "build/action_helpers.py",
102        "build/android/gyp/util/__init__.py",
103        "build/android/gyp/util/build_utils.py",
104        "build/gn_helpers.py",
105        "build/zip_helpers.py",
106    ],
107}
108
109filegroup {
110    name: "cronet_native_unittests_defaults_srcs",
111    srcs: [
112        "base/test/android/javatests/src/org/chromium/base/test/util/UrlUtils.java",
113        "build/android/gtest_apk/java/src/org/chromium/build/gtest_apk/NativeTestInstrumentationTestRunner.java",
114        "build/android/gtest_apk/java/src/org/chromium/build/gtest_apk/NativeTestIntent.java",
115        "build/android/gtest_apk/java/src/org/chromium/build/gtest_apk/TestStatusIntent.java",
116        "build/android/gtest_apk/java/src/org/chromium/build/gtest_apk/TestStatusReceiver.java",
117        "testing/android/native_test/java/src/org/chromium/native_test/NativeTest.java",
118        "testing/android/native_test/java/src/org/chromium/native_test/SignalMaskInfo.java",
119        "testing/android/native_test/java/src/org/chromium/native_test/NativeTestApplication.java",
120        "testing/android/native_test/java/src/org/chromium/native_test/NativeUnitTest.java",
121        "testing/android/native_test/java/src/org/chromium/native_test/NativeUnitTestActivity.java",
122        "testing/android/native_test/java/src/org/chromium/native_test/NativeUnitTestNativeActivity.java",
123        "testing/android/reporter/java/src/org/chromium/test/reporter/TestStatusReporter.java",
124    ],
125}
126
127java_defaults {
128    name: "cronet_native_unittests_defaults",
129    defaults: [
130        "mts-target-sdk-version-current",
131    ],
132    compile_multilib: "both",
133    min_sdk_version: "31", // b/270049141
134    srcs: [
135        ":cronet_native_unittests_defaults_srcs",
136    ],
137    static_libs: [
138        "androidx.annotation_annotation",
139        "junit",
140    ],
141    test_suites: [
142        "general-tests",
143        "mts-tethering",
144    ],
145}
146
147filegroup {
148    name: "cronet_for_testing_net_java_srcs",
149    srcs: [
150        "net/test/android/javatests/src/org/chromium/net/AndroidNetworkLibraryTestUtil.java",
151        "net/test/android/javatests/src/org/chromium/net/test/util/CertTestUtil.java",
152        "net/test/android/javatests/src/org/chromium/net/test/util/NetworkChangeNotifierTestUtil.java",
153        "net/test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java",
154        "net/test/android/javatests/src/org/chromium/net/test/util/WebServer.java",
155        "net/test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticator.java",
156        "net/test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticatorService.java",
157        "net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerImpl.java",
158        "net/test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerService.java",
159        "base/test/android/javatests/src/org/chromium/base/test/util/UrlUtils.java",
160        "net/android/javatests/src/org/chromium/net/AndroidKeyStoreTestUtil.java",
161        "net/android/javatests/src/org/chromium/net/AndroidProxyConfigServiceTestUtil.java",
162        "net/test/android/javatests/src/org/chromium/net/test/IConnectionListener.aidl",
163        "net/test/android/javatests/src/org/chromium/net/test/IEmbeddedTestServerImpl.aidl",
164    ],
165}
166
167java_library {
168    name: "cronet_for_testing_net_java",
169    srcs: [
170        ":cronet_for_testing_net_java_srcs",
171    ],
172    aidl: {
173        include_dirs: [
174            "frameworks/base/core/java/",
175        ],
176        local_include_dirs: [
177            "net/test/android/javatests/src",
178        ],
179    },
180    static_libs: [
181        "cronet_aml_java__testing",
182        "junit",
183        "androidx.annotation_annotation",
184        "androidx.annotation_annotation-experimental-nodeps",
185    ],
186    plugins: [
187        "cronet_aml_java_jni_annotation_preprocessor",
188    ],
189}
190
191filegroup {
192    name: "net_unittests_data",
193    srcs: [
194        "net/data/**/*",
195        "net/third_party/nist-pkits/**/*",
196        "net/third_party/quiche/src/quiche/common/platform/api/testdir/**/*"
197    ],
198}
199
200genrule {
201    name: "cronet_tester_app_jni",
202    defaults: [
203        "cronet_aml_components_cronet_android_cronet_jni_registration__java__testing_defaults",
204    ],
205    srcs: [
206        ":cronet_native_unittests_defaults_srcs",
207    ],
208}
209
210android_test_helper_app {
211    name: "cronet_tester_app",
212    defaults: [
213        "cronet_native_unittests_defaults",
214        "jni_proxy_natives_defaults",
215    ],
216    srcs: [":cronet_tester_app_jni"],
217    manifest: "test_runner/AndroidManifest.xml",
218    jni_libs: [
219        "cronet_aml_components_cronet_android_cronet_unittests_android__library__testing",
220    ],
221    static_libs: ["cronet_aml_java__testing"],
222}
223
224genrule {
225    name: "cronet_net_tester_app_jni",
226    defaults: [
227        "cronet_aml_components_cronet_android_cronet_jni_registration__java__testing_defaults",
228    ],
229    srcs: [
230        ":cronet_for_testing_net_java_srcs",
231        ":cronet_native_unittests_defaults_srcs",
232    ],
233}
234
235android_test_helper_app {
236    name: "cronet_net_tester_app",
237    defaults: [
238        "cronet_native_unittests_defaults",
239        "jni_proxy_natives_defaults",
240    ],
241    manifest: "test_runner/AndroidNetManifest.xml",
242    srcs: [":cronet_net_tester_app_jni"],
243    jni_libs: [
244        "cronet_aml_net_net_unittests__library__testing",
245    ],
246    static_libs: ["cronet_for_testing_net_java"],
247    resource_dirs : [
248        "net/android/unittest_support/res",
249    ]
250}
251
252// ------------------------------ JAVA TEST TARGETS --------------------------------------------
253
254filegroup {
255    name: "cronet_aml_javatests_sources",
256    srcs: [
257        ":cronet_aml_java_apihelpers",
258        ":cronet_base_net_javatest_utils",
259        "components/cronet/android/test/javatests/**/UrlResponseInfoTest.java",
260        "components/cronet/android/test/javatests/**/BidirectionalStreamQuicTest.java",
261        "components/cronet/android/test/javatests/**/BrotliTest.java",
262        "components/cronet/android/test/javatests/**/CronetLoggerTestRule.java",
263        "components/cronet/android/test/javatests/**/CronetLoggerTest.java",
264        "components/cronet/android/test/javatests/**/CronetManifestTest.java",
265        "components/cronet/android/test/javatests/**/CronetStressTest.java",
266        "components/cronet/android/test/javatests/**/CronetTestRule.java",
267        "components/cronet/android/test/javatests/**/CronetTestRuleTest.java",
268        "components/cronet/android/test/javatests/**/CronetUploadTest.java",
269        "components/cronet/android/test/javatests/**/CronetUrlRequestTest.java",
270        "components/cronet/android/test/javatests/**/CronetUrlRequestContextTest.java",
271        "components/cronet/android/test/javatests/**/DiskStorageTest.java",
272        "components/cronet/android/test/javatests/**/ExperimentalOptionsTest.java",
273        "components/cronet/android/test/javatests/**/GetStatusTest.java",
274        "components/cronet/android/test/javatests/**/Http2TestServer.java",
275        "components/cronet/android/test/javatests/**/Test*.java",
276        "components/cronet/android/test/javatests/**/MetricsTestUtil.java",
277        "components/cronet/android/test/javatests/**/NetworkChangeNotifierTest.java",
278        "components/cronet/android/test/javatests/**/NQETest.java",
279        "components/cronet/android/test/javatests/**/RequestFinishedInfoTest.java",
280        "components/cronet/android/test/javatests/**/QuicTest.java",
281        "components/cronet/android/test/javatests/**/urlconnection/*.java",
282    ],
283    visibility: [
284        "//packages/modules/Connectivity:__subpackages__",
285    ],
286}
287
288filegroup {
289    name: "cronet_base_net_javatest_utils",
290    srcs: [
291        "base/test/android/javatests/**/CriteriaNotSatisfiedException.java",
292        "base/test/android/javatests/**/Criteria.java",
293        "base/test/android/javatests/**/CriteriaHelper.java",
294        "base/test/android/javatests/**/DisabledTest.java",
295        "base/test/android/javatests/**/HistogramWatcher.java",
296        "base/test/android/javatests/**/LooperUtils.java",
297        "base/test/android/javatests/**/MetricsUtils.java",
298        "base/test/android/javatests/**/PackageManagerWrapper.java",
299        "base/test/android/javatests/**/ScalableTimeout.java",
300        "base/test/android/javatests/**/TestFileUtil.java",
301        "base/test/android/javatests/**/TimeoutTimer.java",
302        "base/test/android/javatests/**/UrlUtils.java",
303        "net/url_request/FailurePhase.java",
304    ]
305}
306
307filegroup {
308    name: "cronet_aml_java_apihelpers",
309    srcs: [
310        "components/cronet/android/**/http/apihelpers/UploadDataProviders.java"
311    ]
312}
313
314// TODO: merge cronet_testserver_utils_srcs with cronet_aml_javatests_sources.
315filegroup {
316    name: "cronet_testserver_utils_srcs",
317    srcs: [
318        ":cronet_base_net_javatest_utils",
319        "components/cronet/android/test/**/CronetTestUtil.java",
320        "components/cronet/android/test/**/NativeTestServer.java",
321        "components/cronet/android/test/**/TestFilesInstaller.java",
322        "components/cronet/android/test/**/TestUploadDataStreamHandler.java",
323        "components/cronet/android/test/**/QuicTestServer.java",
324        "components/cronet/android/test/**/MockCertVerifier.java",
325        "components/cronet/android/test/**/MockUrlRequestJobFactory.java",
326    ],
327}
328
329genrule {
330    name: "cronet_java_tests_jni",
331    defaults: ["jni_registration_generator_defaults"],
332    srcs: [
333      ":cronet_aml_javatests_sources",
334      ":cronet_testserver_utils_srcs",
335    ],
336}
337
338android_library {
339    name: "cronet_java_tests",
340    defaults: ["jni_proxy_natives_defaults"],
341    asset_dirs: [
342        "components/cronet/testing/test_server/data/",
343        "net/data/ssl/certificates/",
344    ],
345    manifest: "components/cronet/android/test/src/org/chromium/net/AndroidManifest.xml",
346    srcs: [
347        ":cronet_aml_javatests_sources",
348        ":cronet_java_tests_jni",
349        ":cronet_testserver_utils_srcs",
350    ],
351    sdk_version: "module_current",
352    min_sdk_version: "30",
353    static_libs: [
354        "androidx.test.ext.junit",
355        "androidx.test.rules",
356        "cronet_aml_java__testing",
357        "guava",
358        "hamcrest-library",
359        "junit",
360        "truth",
361    ],
362    libs: [
363        "android.test.base",
364        "cronet_aml_api_java",
365        "framework-connectivity",
366        "framework-connectivity-pre-jarjar",
367        // android.net.TrafficStats apis
368        "framework-connectivity-t",
369        "guava",
370    ],
371    lint: { test: true },
372    visibility: [
373        "//packages/modules/Connectivity:__subpackages__",
374    ],
375}
376
377