blob: f7982d3eef2a9cd1ce03a62f6db84bd32119fb43 [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",
minyue939df962017-04-19 01:58:38 -070045 "../../p2p",
Artem Titov94b57c02019-03-21 13:35:10 +010046 "../../rtc_base",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010047 "../../rtc_base:checks",
Mirko Bonadei3663ed32019-10-19 12:03:23 +020048 "../../rtc_base:ignore_wundef",
Mirko Bonadeie5f4c6b2021-01-15 10:41:01 +010049 "../../rtc_base:ip_address",
ehmaldonadof6a861a2017-07-19 10:40:47 -070050 "../../rtc_base:protobuf_utils",
mbonadei95c8f652017-08-27 23:40:10 -070051 "../../rtc_base:rtc_base_approved",
ehmaldonadof6a861a2017-07-19 10:40:47 -070052 "../../rtc_base:rtc_task_queue",
Mirko Bonadeie5f4c6b2021-01-15 10:41:01 +010053 "../../rtc_base:socket_address",
54 "../../rtc_base:threading",
Markus Handell85585f42020-07-08 23:04:37 +020055 "../../rtc_base/synchronization:mutex",
Mirko Bonadei20e4c802020-11-23 11:07:42 +010056 "../../rtc_base/system:no_unique_address",
Artem Titov94b57c02019-03-21 13:35:10 +010057 "../../rtc_base/third_party/sigslot",
minyue939df962017-04-19 01:58:38 -070058 ]
Mirko Bonadei2dcf3482020-06-05 14:30:41 +020059 absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
minyue939df962017-04-19 01:58:38 -070060 }
61
62 network_tester_unittests_resources = [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020063 "../../resources/network_tester/client_config.dat",
64 "../../resources/network_tester/server_config.dat",
minyue939df962017-04-19 01:58:38 -070065 ]
66
67 if (is_ios) {
68 bundle_data("network_tester_unittests_bundle_data") {
69 testonly = true
70 sources = network_tester_unittests_resources
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +010071 outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
minyue939df962017-04-19 01:58:38 -070072 }
73 }
74
Mirko Bonadei86d053c2019-10-17 21:32:04 +020075 rtc_library("network_tester_unittests") {
kjellandere0629c02017-04-25 04:04:50 -070076 testonly = true
77
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +010078 sources = [ "network_tester_unittest.cc" ]
minyue939df962017-04-19 01:58:38 -070079
minyue939df962017-04-19 01:58:38 -070080 deps = [
81 ":network_tester",
Mirko Bonadeie3abb812018-11-23 13:15:08 +010082 "../../rtc_base:gunit_helpers",
Patrik Höglund7696bef2018-03-15 15:05:39 +010083 "../../test:fileutils",
jianjun.zhuc0247402017-07-11 06:20:45 -070084 "../../test:test_support",
minyue939df962017-04-19 01:58:38 -070085 "//testing/gtest",
minyue939df962017-04-19 01:58:38 -070086 ]
87
88 if (is_ios) {
89 deps += [ ":network_tester_unittests_bundle_data" ]
90 }
91
Mirko Bonadei8e5014a2018-08-02 13:36:10 +020092 defines = [ "WEBRTC_NETWORK_TESTER_TEST_ENABLED" ]
minyue939df962017-04-19 01:58:38 -070093
94 data = network_tester_unittests_resources
minyue939df962017-04-19 01:58:38 -070095 }
michaeltfcea39d2017-04-20 05:39:30 -070096
97 rtc_executable("network_tester_server") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +010098 sources = [ "server.cc" ]
michaeltfcea39d2017-04-20 05:39:30 -070099
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100100 deps = [ ":network_tester" ]
michaeltfcea39d2017-04-20 05:39:30 -0700101 }
minyue939df962017-04-19 01:58:38 -0700102}
michaelt2fe9ac32017-04-20 06:56:27 -0700103
104if (is_android) {
Oleh Prypin4cbb4ef2019-06-18 17:09:51 +0200105 rtc_android_apk("NetworkTesterMobile") {
michaelt2fe9ac32017-04-20 06:56:27 -0700106 testonly = true
107 apk_name = "NetworkTesterMobile"
108 android_manifest = "androidapp/AndroidManifest.xml"
Jeremy Leconteb19cfee2020-06-25 22:57:49 +0200109 min_sdk_version = 21
Oleh Prypin4cbb4ef2019-06-18 17:09:51 +0200110 target_sdk_version = 24
michaelt2fe9ac32017-04-20 06:56:27 -0700111
112 deps = [
113 ":NetworkTesterMobile_javalib",
114 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700115 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700116 ]
117
jianjun.zhuc0247402017-07-11 06:20:45 -0700118 shared_libraries = [ "../../rtc_tools/network_tester:network_tester_so" ]
michaelt2fe9ac32017-04-20 06:56:27 -0700119 }
120
Oleh Prypin4cbb4ef2019-06-18 17:09:51 +0200121 rtc_android_library("NetworkTesterMobile_javalib") {
michaelt2fe9ac32017-04-20 06:56:27 -0700122 testonly = true
Courtney Edwards35c87b62020-05-19 13:44:42 +0200123 android_manifest = "androidapp/AndroidManifest.xml"
michaelt2fe9ac32017-04-20 06:56:27 -0700124
Natalie Chouinard65bbcab2019-12-23 14:02:25 -0800125 sources = [
michaelt2fe9ac32017-04-20 06:56:27 -0700126 "androidapp/src/com/google/media/networktester/MainActivity.java",
127 "androidapp/src/com/google/media/networktester/NetworkTester.java",
128 ]
129
Mohamed Heikal3f94fc52020-09-01 15:51:12 -0400130 resources_package = "com.google.media.networktester"
michaelt2fe9ac32017-04-20 06:56:27 -0700131 deps = [
132 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700133 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700134 ]
135 }
136
137 android_resources("NetworkTesterMobile_resources") {
138 testonly = true
michaelt2fe9ac32017-04-20 06:56:27 -0700139 custom_package = "com.google.media.networktester"
Andrew Grieved4262df2020-03-25 12:59:50 -0400140 sources = [
141 "androidapp/res/layout/activity_main.xml",
142 "androidapp/res/mipmap-hdpi/ic_launcher.png",
143 "androidapp/res/mipmap-mdpi/ic_launcher.png",
144 "androidapp/res/mipmap-xhdpi/ic_launcher.png",
145 "androidapp/res/mipmap-xxhdpi/ic_launcher.png",
146 "androidapp/res/mipmap-xxxhdpi/ic_launcher.png",
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200147 "androidapp/res/values-v17/styles.xml",
148 "androidapp/res/values-w820dp/dimens.xml",
Andrew Grieved4262df2020-03-25 12:59:50 -0400149 "androidapp/res/values/colors.xml",
150 "androidapp/res/values/dimens.xml",
151 "androidapp/res/values/strings.xml",
Andrew Grieved4262df2020-03-25 12:59:50 -0400152 ]
153
154 # Needed for Bazel converter.
155 resource_dirs = [ "androidapp/res" ]
156 assert(resource_dirs != []) # Mark as used.
michaelt2fe9ac32017-04-20 06:56:27 -0700157 }
158
159 rtc_shared_library("network_tester_so") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100160 sources = [ "jni.cpp" ]
michaelt2fe9ac32017-04-20 06:56:27 -0700161
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100162 deps = [ ":network_tester" ]
michaelt2fe9ac32017-04-20 06:56:27 -0700163
164 suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ]
165 configs += [ "//build/config/android:hide_all_but_jni" ]
166
167 output_extension = "so"
168 }
169}