blob: 5fd3ac9b7fec06f3101b45674994ec72af79a329 [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 ]
17 proto_out_dir = "webrtc/tools/network_tester"
18 }
19
20 proto_library("network_tester_packet_proto") {
21 sources = [
22 "network_tester_packet.proto",
23 ]
24 proto_out_dir = "webrtc/tools/network_tester"
25 }
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",
michaeltfcea39d2017-04-20 05:39:30 -070044 "../../base:protobuf_utils",
minyue939df962017-04-19 01:58:38 -070045 "../../base:rtc_task_queue",
46 "../../p2p",
47 ]
48
49 if (!build_with_chromium && is_clang) {
50 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
51 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
52 }
53 }
54
55 network_tester_unittests_resources = [
56 "//resources/network_tester/client_config.dat",
57 "//resources/network_tester/server_config.dat",
58 ]
59
60 if (is_ios) {
61 bundle_data("network_tester_unittests_bundle_data") {
62 testonly = true
63 sources = network_tester_unittests_resources
64 outputs = [
65 "{{bundle_resources_dir}}/{{source_file_part}}",
66 ]
67 }
68 }
69
70 rtc_source_set("network_tester_unittests") {
kjellandere0629c02017-04-25 04:04:50 -070071 testonly = true
72
73 # Skip restricting visibility on mobile platforms since the tests on those
74 # gets additional generated targets which would require many lines here to
75 # cover (which would be confusing to read and hard to maintain).
76 if (!is_android && !is_ios) {
77 visibility = [ "//webrtc/tools:tools_unittests" ]
78 }
minyue939df962017-04-19 01:58:38 -070079 sources = [
80 "network_tester_unittest.cc",
81 ]
82
minyue939df962017-04-19 01:58:38 -070083 deps = [
84 ":network_tester",
85 "//testing/gtest",
86 "//webrtc/base:rtc_base_tests_utils",
87 "//webrtc/test:test_support",
88 ]
89
90 if (is_ios) {
91 deps += [ ":network_tester_unittests_bundle_data" ]
92 }
93
94 defines = [
95 "GTEST_RELATIVE_PATH",
96 "WEBRTC_NETWORK_TESTER_TEST_ENABLED",
97 ]
98
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",
132 "//base:base_java",
133 "//webrtc/base:base_java",
134 ]
135
136 shared_libraries = [ "//webrtc/tools/network_tester:network_tester_so" ]
137 }
138
139 android_library("NetworkTesterMobile_javalib") {
140 testonly = true
141 android_manifest = "androidapp/AndroidManifest.xml"
142
143 java_files = [
144 "androidapp/src/com/google/media/networktester/MainActivity.java",
145 "androidapp/src/com/google/media/networktester/NetworkTester.java",
146 ]
147
148 deps = [
149 ":NetworkTesterMobile_resources",
150 "//webrtc/base:base_java",
151 ]
152 }
153
154 android_resources("NetworkTesterMobile_resources") {
155 testonly = true
156 resource_dirs = [ "androidapp/res" ]
157 custom_package = "com.google.media.networktester"
158 }
159
160 rtc_shared_library("network_tester_so") {
161 sources = [
162 "jni.cpp",
163 ]
164
165 deps = [
166 ":network_tester",
167 "../../system_wrappers:field_trial_default",
168 ]
169
170 suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ]
171 configs += [ "//build/config/android:hide_all_but_jni" ]
172
173 output_extension = "so"
174 }
175}