blob: 47932ded5ce61a2199eaab4321b1e447e01bf701 [file] [log] [blame]
minyue939df962017-04-19 01:58:38 -07001# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
Mirko Bonadeie3abb812018-11-23 13:15:08 +01009import("../../webrtc.gni")
Kimmo Kinnunen08f6a6c2019-02-26 11:46:17 +020010if (rtc_enable_protobuf) {
11 import("//third_party/protobuf/proto_library.gni")
12}
minyue939df962017-04-19 01:58:38 -070013
14if (rtc_enable_protobuf) {
15 proto_library("network_tester_config_proto") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +010016 sources = [ "network_tester_config.proto" ]
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017 proto_out_dir = "rtc_tools/network_tester"
minyue939df962017-04-19 01:58:38 -070018 }
19
20 proto_library("network_tester_packet_proto") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +010021 sources = [ "network_tester_packet.proto" ]
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020022 proto_out_dir = "rtc_tools/network_tester"
minyue939df962017-04-19 01:58:38 -070023 }
24
Mirko Bonadei86d053c2019-10-17 21:32:04 +020025 rtc_library("network_tester") {
minyue939df962017-04-19 01:58:38 -070026 sources = [
27 "config_reader.cc",
28 "config_reader.h",
michaeltfcea39d2017-04-20 05:39:30 -070029 "packet_logger.cc",
30 "packet_logger.h",
minyue939df962017-04-19 01:58:38 -070031 "packet_sender.cc",
32 "packet_sender.h",
33 "test_controller.cc",
34 "test_controller.h",
35 ]
36
37 defines = [ "WEBRTC_NETWORK_TESTER_PROTO" ]
38
39 deps = [
40 ":network_tester_config_proto",
41 ":network_tester_packet_proto",
Artem Titovd15a5752021-02-10 14:31:24 +010042 "../../api:sequence_checker",
Danil Chapovalovad895282019-03-11 10:28:05 +000043 "../../api/task_queue",
Danil Chapovalov3993b182019-03-27 19:42:15 +010044 "../../api/task_queue:default_task_queue_factory",
Danil Chapovalov5286dcf2022-07-18 17:04:56 +020045 "../../api/task_queue:pending_task_safety_flag",
Florent Castelli10b34852022-04-06 00:20:48 +020046 "../../p2p:rtc_p2p",
Artem Titov94b57c02019-03-21 13:35:10 +010047 "../../rtc_base",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010048 "../../rtc_base:checks",
Mirko Bonadei3663ed32019-10-19 12:03:23 +020049 "../../rtc_base:ignore_wundef",
Mirko Bonadeie5f4c6b2021-01-15 10:41:01 +010050 "../../rtc_base:ip_address",
Byoungchan Leec931f702022-07-03 17:20:17 +090051 "../../rtc_base:logging",
Florent Castelli4467ad72022-04-04 15:18:46 +020052 "../../rtc_base:macromagic",
ehmaldonadof6a861a2017-07-19 10:40:47 -070053 "../../rtc_base:protobuf_utils",
54 "../../rtc_base:rtc_task_queue",
Mirko Bonadeie5f4c6b2021-01-15 10:41:01 +010055 "../../rtc_base:socket_address",
56 "../../rtc_base:threading",
Florent Castellidd837e22022-04-04 17:16:15 +020057 "../../rtc_base:timeutils",
Markus Handell85585f42020-07-08 23:04:37 +020058 "../../rtc_base/synchronization:mutex",
Mirko Bonadei20e4c802020-11-23 11:07:42 +010059 "../../rtc_base/system:no_unique_address",
Artem Titov94b57c02019-03-21 13:35:10 +010060 "../../rtc_base/third_party/sigslot",
minyue939df962017-04-19 01:58:38 -070061 ]
Danil Chapovalov5286dcf2022-07-18 17:04:56 +020062 absl_deps = [
63 "//third_party/abseil-cpp/absl/functional:any_invocable",
64 "//third_party/abseil-cpp/absl/types:optional",
65 ]
minyue939df962017-04-19 01:58:38 -070066 }
67
68 network_tester_unittests_resources = [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020069 "../../resources/network_tester/client_config.dat",
70 "../../resources/network_tester/server_config.dat",
minyue939df962017-04-19 01:58:38 -070071 ]
72
73 if (is_ios) {
74 bundle_data("network_tester_unittests_bundle_data") {
75 testonly = true
76 sources = network_tester_unittests_resources
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +010077 outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
minyue939df962017-04-19 01:58:38 -070078 }
79 }
80
Mirko Bonadei86d053c2019-10-17 21:32:04 +020081 rtc_library("network_tester_unittests") {
kjellandere0629c02017-04-25 04:04:50 -070082 testonly = true
83
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +010084 sources = [ "network_tester_unittest.cc" ]
minyue939df962017-04-19 01:58:38 -070085
minyue939df962017-04-19 01:58:38 -070086 deps = [
87 ":network_tester",
Mirko Bonadeie3abb812018-11-23 13:15:08 +010088 "../../rtc_base:gunit_helpers",
Byoungchan Leec931f702022-07-03 17:20:17 +090089 "../../rtc_base:threading",
Patrik Höglund7696bef2018-03-15 15:05:39 +010090 "../../test:fileutils",
jianjun.zhuc0247402017-07-11 06:20:45 -070091 "../../test:test_support",
minyue939df962017-04-19 01:58:38 -070092 "//testing/gtest",
minyue939df962017-04-19 01:58:38 -070093 ]
94
95 if (is_ios) {
96 deps += [ ":network_tester_unittests_bundle_data" ]
97 }
98
Mirko Bonadei8e5014a2018-08-02 13:36:10 +020099 defines = [ "WEBRTC_NETWORK_TESTER_TEST_ENABLED" ]
minyue939df962017-04-19 01:58:38 -0700100
101 data = network_tester_unittests_resources
minyue939df962017-04-19 01:58:38 -0700102 }
michaeltfcea39d2017-04-20 05:39:30 -0700103
104 rtc_executable("network_tester_server") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100105 sources = [ "server.cc" ]
michaeltfcea39d2017-04-20 05:39:30 -0700106
Byoungchan Leec931f702022-07-03 17:20:17 +0900107 deps = [
108 ":network_tester",
109 "../../rtc_base:null_socket_server",
110 "../../rtc_base:threading",
111 ]
michaeltfcea39d2017-04-20 05:39:30 -0700112 }
minyue939df962017-04-19 01:58:38 -0700113}
michaelt2fe9ac32017-04-20 06:56:27 -0700114
115if (is_android) {
Oleh Prypin4cbb4ef2019-06-18 17:09:51 +0200116 rtc_android_apk("NetworkTesterMobile") {
michaelt2fe9ac32017-04-20 06:56:27 -0700117 testonly = true
118 apk_name = "NetworkTesterMobile"
119 android_manifest = "androidapp/AndroidManifest.xml"
Jeremy Leconteb19cfee2020-06-25 22:57:49 +0200120 min_sdk_version = 21
Oleh Prypin4cbb4ef2019-06-18 17:09:51 +0200121 target_sdk_version = 24
michaelt2fe9ac32017-04-20 06:56:27 -0700122
123 deps = [
124 ":NetworkTesterMobile_javalib",
125 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700126 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700127 ]
128
jianjun.zhuc0247402017-07-11 06:20:45 -0700129 shared_libraries = [ "../../rtc_tools/network_tester:network_tester_so" ]
michaelt2fe9ac32017-04-20 06:56:27 -0700130 }
131
Oleh Prypin4cbb4ef2019-06-18 17:09:51 +0200132 rtc_android_library("NetworkTesterMobile_javalib") {
michaelt2fe9ac32017-04-20 06:56:27 -0700133 testonly = true
Courtney Edwards35c87b62020-05-19 13:44:42 +0200134 android_manifest = "androidapp/AndroidManifest.xml"
michaelt2fe9ac32017-04-20 06:56:27 -0700135
Natalie Chouinard65bbcab2019-12-23 14:02:25 -0800136 sources = [
michaelt2fe9ac32017-04-20 06:56:27 -0700137 "androidapp/src/com/google/media/networktester/MainActivity.java",
138 "androidapp/src/com/google/media/networktester/NetworkTester.java",
139 ]
140
Mohamed Heikal3f94fc52020-09-01 15:51:12 -0400141 resources_package = "com.google.media.networktester"
michaelt2fe9ac32017-04-20 06:56:27 -0700142 deps = [
143 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700144 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700145 ]
146 }
147
148 android_resources("NetworkTesterMobile_resources") {
149 testonly = true
michaelt2fe9ac32017-04-20 06:56:27 -0700150 custom_package = "com.google.media.networktester"
Andrew Grieved4262df2020-03-25 12:59:50 -0400151 sources = [
152 "androidapp/res/layout/activity_main.xml",
153 "androidapp/res/mipmap-hdpi/ic_launcher.png",
154 "androidapp/res/mipmap-mdpi/ic_launcher.png",
155 "androidapp/res/mipmap-xhdpi/ic_launcher.png",
156 "androidapp/res/mipmap-xxhdpi/ic_launcher.png",
157 "androidapp/res/mipmap-xxxhdpi/ic_launcher.png",
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200158 "androidapp/res/values-v17/styles.xml",
159 "androidapp/res/values-w820dp/dimens.xml",
Andrew Grieved4262df2020-03-25 12:59:50 -0400160 "androidapp/res/values/colors.xml",
161 "androidapp/res/values/dimens.xml",
162 "androidapp/res/values/strings.xml",
Andrew Grieved4262df2020-03-25 12:59:50 -0400163 ]
164
165 # Needed for Bazel converter.
166 resource_dirs = [ "androidapp/res" ]
167 assert(resource_dirs != []) # Mark as used.
michaelt2fe9ac32017-04-20 06:56:27 -0700168 }
169
170 rtc_shared_library("network_tester_so") {
Byoungchan Leec931f702022-07-03 17:20:17 +0900171 sources = [ "jni.cc" ]
michaelt2fe9ac32017-04-20 06:56:27 -0700172
Byoungchan Leec931f702022-07-03 17:20:17 +0900173 deps = [
174 ":network_tester",
175 "../../rtc_base:logging",
176 "../../rtc_base:threading",
177 ]
michaelt2fe9ac32017-04-20 06:56:27 -0700178
179 suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ]
180 configs += [ "//build/config/android:hide_all_but_jni" ]
181
182 output_extension = "so"
183 }
184}