blob: 70c15bbb259f27c2abe113170cffe8e6be5d86c4 [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") {
16 sources = [
17 "network_tester_config.proto",
18 ]
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019 proto_out_dir = "rtc_tools/network_tester"
minyue939df962017-04-19 01:58:38 -070020 }
21
22 proto_library("network_tester_packet_proto") {
23 sources = [
24 "network_tester_packet.proto",
25 ]
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020026 proto_out_dir = "rtc_tools/network_tester"
minyue939df962017-04-19 01:58:38 -070027 }
28
29 rtc_static_library("network_tester") {
30 sources = [
31 "config_reader.cc",
32 "config_reader.h",
michaeltfcea39d2017-04-20 05:39:30 -070033 "packet_logger.cc",
34 "packet_logger.h",
minyue939df962017-04-19 01:58:38 -070035 "packet_sender.cc",
36 "packet_sender.h",
37 "test_controller.cc",
38 "test_controller.h",
39 ]
40
41 defines = [ "WEBRTC_NETWORK_TESTER_PROTO" ]
42
43 deps = [
44 ":network_tester_config_proto",
45 ":network_tester_packet_proto",
minyue939df962017-04-19 01:58:38 -070046 "../../p2p",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010047 "../../rtc_base:checks",
ehmaldonadof6a861a2017-07-19 10:40:47 -070048 "../../rtc_base:protobuf_utils",
Jonas Olssoncfe3b6a2018-11-12 10:12:47 +010049 "../../rtc_base:rtc_base",
mbonadei95c8f652017-08-27 23:40:10 -070050 "../../rtc_base:rtc_base_approved",
ehmaldonadof6a861a2017-07-19 10:40:47 -070051 "../../rtc_base:rtc_task_queue",
52 "../../rtc_base:sequenced_task_checker",
Yves Gerey3e707812018-11-28 16:47:49 +010053 "../../rtc_base/third_party/sigslot:sigslot",
Danil Chapovalov431abd92018-06-18 12:54:17 +020054 "//third_party/abseil-cpp/absl/types:optional",
minyue939df962017-04-19 01:58:38 -070055 ]
56
57 if (!build_with_chromium && is_clang) {
58 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
59 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
60 }
61 }
62
63 network_tester_unittests_resources = [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020064 "../../resources/network_tester/client_config.dat",
65 "../../resources/network_tester/server_config.dat",
minyue939df962017-04-19 01:58:38 -070066 ]
67
68 if (is_ios) {
69 bundle_data("network_tester_unittests_bundle_data") {
70 testonly = true
71 sources = network_tester_unittests_resources
72 outputs = [
73 "{{bundle_resources_dir}}/{{source_file_part}}",
74 ]
75 }
76 }
77
78 rtc_source_set("network_tester_unittests") {
kjellandere0629c02017-04-25 04:04:50 -070079 testonly = true
80
minyue939df962017-04-19 01:58:38 -070081 sources = [
82 "network_tester_unittest.cc",
83 ]
84
minyue939df962017-04-19 01:58:38 -070085 deps = [
86 ":network_tester",
Mirko Bonadeie3abb812018-11-23 13:15:08 +010087 "../../rtc_base:gunit_helpers",
Patrik Höglund7696bef2018-03-15 15:05:39 +010088 "../../test:fileutils",
jianjun.zhuc0247402017-07-11 06:20:45 -070089 "../../test:test_support",
minyue939df962017-04-19 01:58:38 -070090 "//testing/gtest",
minyue939df962017-04-19 01:58:38 -070091 ]
92
93 if (is_ios) {
94 deps += [ ":network_tester_unittests_bundle_data" ]
95 }
96
Mirko Bonadei8e5014a2018-08-02 13:36:10 +020097 defines = [ "WEBRTC_NETWORK_TESTER_TEST_ENABLED" ]
minyue939df962017-04-19 01:58:38 -070098
99 data = network_tester_unittests_resources
100
101 if (!build_with_chromium && is_clang) {
102 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
103 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
104 }
105 }
michaeltfcea39d2017-04-20 05:39:30 -0700106
107 rtc_executable("network_tester_server") {
108 sources = [
109 "server.cc",
110 ]
111
112 deps = [
113 ":network_tester",
114 ]
115
116 if (!build_with_chromium && is_clang) {
117 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
118 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
119 }
120 }
minyue939df962017-04-19 01:58:38 -0700121}
michaelt2fe9ac32017-04-20 06:56:27 -0700122
123if (is_android) {
124 android_apk("NetworkTesterMobile") {
125 testonly = true
126 apk_name = "NetworkTesterMobile"
127 android_manifest = "androidapp/AndroidManifest.xml"
128
129 deps = [
130 ":NetworkTesterMobile_javalib",
131 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700132 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700133 ]
134
jianjun.zhuc0247402017-07-11 06:20:45 -0700135 shared_libraries = [ "../../rtc_tools/network_tester:network_tester_so" ]
michaelt2fe9ac32017-04-20 06:56:27 -0700136 }
137
138 android_library("NetworkTesterMobile_javalib") {
139 testonly = true
Mirko Bonadei4f024ef2018-01-04 13:12:03 +0100140 android_manifest_for_lint = "androidapp/AndroidManifest.xml"
michaelt2fe9ac32017-04-20 06:56:27 -0700141
142 java_files = [
143 "androidapp/src/com/google/media/networktester/MainActivity.java",
144 "androidapp/src/com/google/media/networktester/NetworkTester.java",
145 ]
146
147 deps = [
148 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700149 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700150 ]
151 }
152
153 android_resources("NetworkTesterMobile_resources") {
154 testonly = true
155 resource_dirs = [ "androidapp/res" ]
156 custom_package = "com.google.media.networktester"
157 }
158
159 rtc_shared_library("network_tester_so") {
160 sources = [
161 "jni.cpp",
162 ]
163
164 deps = [
165 ":network_tester",
michaelt2fe9ac32017-04-20 06:56:27 -0700166 ]
167
168 suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ]
169 configs += [ "//build/config/android:hide_all_but_jni" ]
170
171 output_extension = "so"
172 }
173}