blob: 02bbc3182b91bd78e3a8ea35ec8f4011961b6271 [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 ]
kjellanderd2b63cf2017-06-30 03:04:59 -070017 proto_out_dir = "webrtc/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 ]
kjellanderd2b63cf2017-06-30 03:04:59 -070024 proto_out_dir = "webrtc/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",
ehmaldonadof6a861a2017-07-19 10:40:47 -070045 "../../rtc_base:protobuf_utils",
mbonadei95c8f652017-08-27 23:40:10 -070046 "../../rtc_base:rtc_base_approved",
ehmaldonadof6a861a2017-07-19 10:40:47 -070047 "../../rtc_base:rtc_task_queue",
48 "../../rtc_base:sequenced_task_checker",
minyue939df962017-04-19 01:58:38 -070049 ]
50
51 if (!build_with_chromium && is_clang) {
52 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
53 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
54 }
55 }
56
57 network_tester_unittests_resources = [
jianjun.zhuc0247402017-07-11 06:20:45 -070058 "../../../resources/network_tester/client_config.dat",
59 "../../../resources/network_tester/server_config.dat",
minyue939df962017-04-19 01:58:38 -070060 ]
61
62 if (is_ios) {
63 bundle_data("network_tester_unittests_bundle_data") {
64 testonly = true
65 sources = network_tester_unittests_resources
66 outputs = [
67 "{{bundle_resources_dir}}/{{source_file_part}}",
68 ]
69 }
70 }
71
72 rtc_source_set("network_tester_unittests") {
kjellandere0629c02017-04-25 04:04:50 -070073 testonly = true
74
75 # Skip restricting visibility on mobile platforms since the tests on those
76 # gets additional generated targets which would require many lines here to
77 # cover (which would be confusing to read and hard to maintain).
78 if (!is_android && !is_ios) {
jianjun.zhuc0247402017-07-11 06:20:45 -070079 visibility = [ "..:tools_unittests" ]
kjellandere0629c02017-04-25 04:04:50 -070080 }
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",
ehmaldonadof6a861a2017-07-19 10:40:47 -070087 "../../rtc_base:rtc_base_tests_utils",
jianjun.zhuc0247402017-07-11 06:20:45 -070088 "../../test:test_support",
minyue939df962017-04-19 01:58:38 -070089 "//testing/gtest",
minyue939df962017-04-19 01:58:38 -070090 ]
91
92 if (is_ios) {
93 deps += [ ":network_tester_unittests_bundle_data" ]
94 }
95
96 defines = [
97 "GTEST_RELATIVE_PATH",
98 "WEBRTC_NETWORK_TESTER_TEST_ENABLED",
99 ]
100
101 data = network_tester_unittests_resources
102
103 if (!build_with_chromium && is_clang) {
104 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
105 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
106 }
107 }
michaeltfcea39d2017-04-20 05:39:30 -0700108
109 rtc_executable("network_tester_server") {
110 sources = [
111 "server.cc",
112 ]
113
114 deps = [
115 ":network_tester",
116 ]
117
118 if (!build_with_chromium && is_clang) {
119 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
120 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
121 }
122 }
minyue939df962017-04-19 01:58:38 -0700123}
michaelt2fe9ac32017-04-20 06:56:27 -0700124
125if (is_android) {
126 android_apk("NetworkTesterMobile") {
127 testonly = true
128 apk_name = "NetworkTesterMobile"
129 android_manifest = "androidapp/AndroidManifest.xml"
130
131 deps = [
132 ":NetworkTesterMobile_javalib",
133 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700134 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700135 "//base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700136 ]
137
jianjun.zhuc0247402017-07-11 06:20:45 -0700138 shared_libraries = [ "../../rtc_tools/network_tester:network_tester_so" ]
michaelt2fe9ac32017-04-20 06:56:27 -0700139 }
140
141 android_library("NetworkTesterMobile_javalib") {
142 testonly = true
143 android_manifest = "androidapp/AndroidManifest.xml"
144
145 java_files = [
146 "androidapp/src/com/google/media/networktester/MainActivity.java",
147 "androidapp/src/com/google/media/networktester/NetworkTester.java",
148 ]
149
150 deps = [
151 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700152 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700153 ]
154 }
155
156 android_resources("NetworkTesterMobile_resources") {
157 testonly = true
158 resource_dirs = [ "androidapp/res" ]
159 custom_package = "com.google.media.networktester"
160 }
161
162 rtc_shared_library("network_tester_so") {
163 sources = [
164 "jni.cpp",
165 ]
166
167 deps = [
168 ":network_tester",
169 "../../system_wrappers:field_trial_default",
170 ]
171
172 suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ]
173 configs += [ "//build/config/android:hide_all_but_jni" ]
174
175 output_extension = "so"
176 }
177}