blob: 544f1227b2588738b8083309ce5149a2e09675db [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
9import("../../webrtc.gni")
10import("//third_party/protobuf/proto_library.gni")
11
12if (rtc_enable_protobuf) {
13 proto_library("network_tester_config_proto") {
14 sources = [
15 "network_tester_config.proto",
16 ]
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") {
21 sources = [
22 "network_tester_packet.proto",
23 ]
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020024 proto_out_dir = "rtc_tools/network_tester"
minyue939df962017-04-19 01:58:38 -070025 }
26
27 rtc_static_library("network_tester") {
28 sources = [
29 "config_reader.cc",
30 "config_reader.h",
michaeltfcea39d2017-04-20 05:39:30 -070031 "packet_logger.cc",
32 "packet_logger.h",
minyue939df962017-04-19 01:58:38 -070033 "packet_sender.cc",
34 "packet_sender.h",
35 "test_controller.cc",
36 "test_controller.h",
37 ]
38
39 defines = [ "WEBRTC_NETWORK_TESTER_PROTO" ]
40
41 deps = [
42 ":network_tester_config_proto",
43 ":network_tester_packet_proto",
minyue939df962017-04-19 01:58:38 -070044 "../../p2p",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010045 "../../rtc_base:checks",
ehmaldonadof6a861a2017-07-19 10:40:47 -070046 "../../rtc_base:protobuf_utils",
mbonadei95c8f652017-08-27 23:40:10 -070047 "../../rtc_base:rtc_base_approved",
ehmaldonadof6a861a2017-07-19 10:40:47 -070048 "../../rtc_base:rtc_task_queue",
49 "../../rtc_base:sequenced_task_checker",
Danil Chapovalov431abd92018-06-18 12:54:17 +020050 "//third_party/abseil-cpp/absl/types:optional",
minyue939df962017-04-19 01:58:38 -070051 ]
52
53 if (!build_with_chromium && is_clang) {
54 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
55 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
56 }
57 }
58
59 network_tester_unittests_resources = [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020060 "../../resources/network_tester/client_config.dat",
61 "../../resources/network_tester/server_config.dat",
minyue939df962017-04-19 01:58:38 -070062 ]
63
64 if (is_ios) {
65 bundle_data("network_tester_unittests_bundle_data") {
66 testonly = true
67 sources = network_tester_unittests_resources
68 outputs = [
69 "{{bundle_resources_dir}}/{{source_file_part}}",
70 ]
71 }
72 }
73
74 rtc_source_set("network_tester_unittests") {
kjellandere0629c02017-04-25 04:04:50 -070075 testonly = true
76
minyue939df962017-04-19 01:58:38 -070077 sources = [
78 "network_tester_unittest.cc",
79 ]
80
minyue939df962017-04-19 01:58:38 -070081 deps = [
82 ":network_tester",
ehmaldonadof6a861a2017-07-19 10:40:47 -070083 "../../rtc_base:rtc_base_tests_utils",
Patrik Höglund7696bef2018-03-15 15:05:39 +010084 "../../test:fileutils",
jianjun.zhuc0247402017-07-11 06:20:45 -070085 "../../test:test_support",
minyue939df962017-04-19 01:58:38 -070086 "//testing/gtest",
minyue939df962017-04-19 01:58:38 -070087 ]
88
89 if (is_ios) {
90 deps += [ ":network_tester_unittests_bundle_data" ]
91 }
92
93 defines = [
94 "GTEST_RELATIVE_PATH",
95 "WEBRTC_NETWORK_TESTER_TEST_ENABLED",
96 ]
97
98 data = network_tester_unittests_resources
99
100 if (!build_with_chromium && is_clang) {
101 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
102 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
103 }
104 }
michaeltfcea39d2017-04-20 05:39:30 -0700105
106 rtc_executable("network_tester_server") {
107 sources = [
108 "server.cc",
109 ]
110
111 deps = [
112 ":network_tester",
113 ]
114
115 if (!build_with_chromium && is_clang) {
116 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
117 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
118 }
119 }
minyue939df962017-04-19 01:58:38 -0700120}
michaelt2fe9ac32017-04-20 06:56:27 -0700121
122if (is_android) {
123 android_apk("NetworkTesterMobile") {
124 testonly = true
125 apk_name = "NetworkTesterMobile"
126 android_manifest = "androidapp/AndroidManifest.xml"
127
128 deps = [
129 ":NetworkTesterMobile_javalib",
130 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700131 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700132 "//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",
166 "../../system_wrappers:field_trial_default",
167 ]
168
169 suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ]
170 configs += [ "//build/config/android:hide_all_but_jni" ]
171
172 output_extension = "so"
173 }
174}