1# Copyright 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/android/config.gni")
6import("//build/config/android/rules.gni")
7
8android_library("net_java") {
9  sources = [
10    "java/src/org/chromium/net/AndroidCellularSignalStrength.java",
11    "java/src/org/chromium/net/AndroidCertVerifyResult.java",
12    "java/src/org/chromium/net/AndroidKeyStore.java",
13    "java/src/org/chromium/net/AndroidNetworkLibrary.java",
14    "java/src/org/chromium/net/AndroidTelephonyManagerBridge.java",
15    "java/src/org/chromium/net/AndroidTrafficStats.java",
16    "java/src/org/chromium/net/DnsStatus.java",
17    "java/src/org/chromium/net/GURLUtils.java",
18    "java/src/org/chromium/net/HttpNegotiateAuthenticator.java",
19    "java/src/org/chromium/net/HttpNegotiateConstants.java",
20    "java/src/org/chromium/net/HttpUtil.java",
21    "java/src/org/chromium/net/MimeTypeFilter.java",
22    "java/src/org/chromium/net/NetStringUtil.java",
23    "java/src/org/chromium/net/NetworkChangeNotifier.java",
24    "java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java",
25    "java/src/org/chromium/net/ProxyBroadcastReceiver.java",
26    "java/src/org/chromium/net/ProxyChangeListener.java",
27    "java/src/org/chromium/net/RegistrationPolicyAlwaysRegister.java",
28    "java/src/org/chromium/net/RegistrationPolicyApplicationStatus.java",
29    "java/src/org/chromium/net/X509Util.java",
30  ]
31  deps = [
32    ":net_thread_stats_uid_java",
33    "//base:base_java",
34    "//base:jni_java",
35    "//third_party/android_deps:androidx_annotation_annotation_java",
36    "//third_party/jsr-305:jsr_305_javalib",
37  ]
38  annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
39  srcjar_deps = [
40    ":net_android_java_enums_srcjar",
41    ":net_errors_java",
42  ]
43}
44
45android_library("net_thread_stats_uid_java") {
46  sources = [ "java/src/org/chromium/net/ThreadStatsUid.java" ]
47}
48
49android_aidl("embedded_test_server_aidl") {
50  interface_file = "../test/android/javatests/src/org/chromium/net/test/IEmbeddedTestServerInterface.aidl"
51  sources = [
52    "../test/android/javatests/src/org/chromium/net/test/IConnectionListener.aidl",
53    "../test/android/javatests/src/org/chromium/net/test/IEmbeddedTestServerImpl.aidl",
54  ]
55}
56
57android_library("embedded_test_server_aidl_java") {
58  testonly = true
59  deps = [ "//third_party/android_deps:androidx_annotation_annotation_java" ]
60  srcjar_deps = [ ":embedded_test_server_aidl" ]
61}
62
63android_library("net_java_test_support") {
64  testonly = true
65  sources = [
66    "../test/android/javatests/src/org/chromium/net/test/EmbeddedTestServer.java",
67    "../test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerRule.java",
68    "../test/android/javatests/src/org/chromium/net/test/util/CertTestUtil.java",
69    "../test/android/javatests/src/org/chromium/net/test/util/NetworkChangeNotifierTestUtil.java",
70    "../test/android/javatests/src/org/chromium/net/test/util/TestWebServer.java",
71    "../test/android/javatests/src/org/chromium/net/test/util/WebServer.java",
72  ]
73  deps = [
74    ":embedded_test_server_aidl_java",
75    ":net_java",
76    "//base:base_java",
77    "//base:base_java_test_support",
78    "//third_party/android_deps:androidx_annotation_annotation_java",
79    "//third_party/android_deps:androidx_test_monitor_java",
80    "//third_party/android_deps:androidx_test_uiautomator_uiautomator_java",
81    "//third_party/android_support_test_runner:rules_java",
82    "//third_party/android_support_test_runner:runner_java",
83    "//third_party/junit",
84  ]
85  srcjar_deps = [ ":net_java_test_support_enums_srcjar" ]
86}
87
88android_library("net_java_test_support_provider") {
89  testonly = true
90  sources = [
91    "../test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticator.java",
92    "../test/android/javatests/src/org/chromium/net/test/DummySpnegoAuthenticatorService.java",
93    "../test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerImpl.java",
94    "../test/android/javatests/src/org/chromium/net/test/EmbeddedTestServerService.java",
95  ]
96
97  deps = [
98    ":embedded_test_server_aidl_java",
99    ":net_java",
100    "//base:base_java",
101    "//base:base_java_test_support",
102  ]
103
104  data_deps = [ "//net:test_support" ]
105}
106
107source_set("java_test_native_support") {
108  testonly = true
109  sources = [
110    "../test/android/net_test_entry_point.cc",
111    "../test/android/net_test_jni_onload.cc",
112    "../test/android/net_test_jni_onload.h",
113    "../test/embedded_test_server/android/embedded_test_server_android.cc",
114    "../test/embedded_test_server/android/embedded_test_server_android.h",
115  ]
116
117  deps = [ "//net:test_support" ]
118  public_deps = [ "//net:net_test_jni_headers" ]
119}
120
121shared_library("net_java_test_native_support") {
122  testonly = true
123  deps = [
124    ":java_test_native_support",
125    "//net:test_support",
126  ]
127
128  configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
129  configs += [ "//build/config/android:hide_all_but_jni" ]
130}
131
132android_apk("net_test_support_apk") {
133  testonly = true
134
135  # Used as an additional_apk in test scripts.
136  never_incremental = true
137
138  # Multidex requires a custom Application class to initialize it. Simpler to
139  # just disable it.
140  enable_multidex = false
141
142  deps = [
143    ":net_java_test_support",
144    ":net_java_test_support_provider",
145    "//base:base_java",
146  ]
147  android_manifest = "../test/android/javatests/AndroidManifest.xml"
148  apk_name = "ChromiumNetTestSupport"
149  shared_libraries = [ ":net_java_test_native_support" ]
150}
151
152android_resources("net_unittests_apk_resources") {
153  sources = [
154    "unittest_support/res/mipmap-hdpi/app_icon.png",
155    "unittest_support/res/mipmap-mdpi/app_icon.png",
156    "unittest_support/res/mipmap-xhdpi/app_icon.png",
157    "unittest_support/res/mipmap-xxhdpi/app_icon.png",
158    "unittest_support/res/mipmap-xxxhdpi/app_icon.png",
159    "unittest_support/res/xml/dummy_spnego_account_preferences.xml",
160    "unittest_support/res/xml/dummy_spnego_authenticator.xml",
161  ]
162  custom_package = "org.chromium.native_test"
163}
164
165android_library("net_javatests") {
166  testonly = true
167  sources = [
168    "javatests/src/org/chromium/net/AndroidKeyStoreTestUtil.java",
169    "javatests/src/org/chromium/net/AndroidNetworkLibraryTestUtil.java",
170    "javatests/src/org/chromium/net/AndroidProxyConfigServiceTestUtil.java",
171    "javatests/src/org/chromium/net/AndroidProxySelectorTest.java",
172    "javatests/src/org/chromium/net/HttpUtilTest.java",
173    "javatests/src/org/chromium/net/MimeTypeFilterTest.java",
174    "javatests/src/org/chromium/net/NetErrorsTest.java",
175    "javatests/src/org/chromium/net/NetworkChangeNotifierNoNativeTest.java",
176    "javatests/src/org/chromium/net/NetworkChangeNotifierTest.java",
177    "javatests/src/org/chromium/net/ProxyChangeListenerTest.java",
178    "javatests/src/org/chromium/net/X509UtilTest.java",
179  ]
180  deps = [
181    ":net_java",
182    ":net_java_test_support",
183    "//base:base_java",
184    "//base:base_java_test_support",
185    "//third_party/android_sdk:android_test_mock_java",
186    "//third_party/android_support_test_runner:rules_java",
187    "//third_party/android_support_test_runner:runner_java",
188    "//third_party/junit",
189    "//third_party/mockito:mockito_java",
190  ]
191}
192
193java_cpp_template("net_errors_java") {
194  package_path = "org/chromium/net"
195  sources = [ "java/NetError.template" ]
196  inputs = [ "../base/net_error_list.h" ]
197}
198
199java_cpp_enum("net_java_test_support_enums_srcjar") {
200  sources = [
201    "../test/embedded_test_server/embedded_test_server.h",
202    "../test/url_request/url_request_failed_job.h",
203  ]
204}
205
206java_cpp_enum("net_android_java_enums_srcjar") {
207  sources = [
208    "../base/network_change_notifier.h",
209    "../socket/socket_tag.cc",
210    "cellular_signal_strength.cc",
211    "cert_verify_result_android.h",
212    "keystore.h",
213    "network_change_notifier_android.cc",
214    "traffic_stats.cc",
215  ]
216}
217
218junit_binary("net_junit_tests") {
219  sources = [ "junit/src/org/chromium/net/HttpNegotiateAuthenticatorTest.java" ]
220  deps = [
221    ":net_java",
222    "//base:base_java",
223    "//base:base_java_test_support",
224    "//base:base_junit_test_support",
225    "//third_party/hamcrest:hamcrest_java",
226  ]
227}
228