blob: ca2c04c4f1a9126ee5c1b83a2c59623e5d01c795 [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",
Danil Chapovalovad895282019-03-11 10:28:05 +000046 "../../api/task_queue",
Danil Chapovalov3993b182019-03-27 19:42:15 +010047 "../../api/task_queue:default_task_queue_factory",
minyue939df962017-04-19 01:58:38 -070048 "../../p2p",
Artem Titov94b57c02019-03-21 13:35:10 +010049 "../../rtc_base",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010050 "../../rtc_base:checks",
ehmaldonadof6a861a2017-07-19 10:40:47 -070051 "../../rtc_base:protobuf_utils",
mbonadei95c8f652017-08-27 23:40:10 -070052 "../../rtc_base:rtc_base_approved",
ehmaldonadof6a861a2017-07-19 10:40:47 -070053 "../../rtc_base:rtc_task_queue",
54 "../../rtc_base:sequenced_task_checker",
Artem Titov94b57c02019-03-21 13:35:10 +010055 "../../rtc_base/third_party/sigslot",
Danil Chapovalov471783f2019-03-11 14:26:02 +010056 "//third_party/abseil-cpp/absl/memory",
Danil Chapovalov431abd92018-06-18 12:54:17 +020057 "//third_party/abseil-cpp/absl/types:optional",
minyue939df962017-04-19 01:58:38 -070058 ]
minyue939df962017-04-19 01:58:38 -070059 }
60
61 network_tester_unittests_resources = [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020062 "../../resources/network_tester/client_config.dat",
63 "../../resources/network_tester/server_config.dat",
minyue939df962017-04-19 01:58:38 -070064 ]
65
66 if (is_ios) {
67 bundle_data("network_tester_unittests_bundle_data") {
68 testonly = true
69 sources = network_tester_unittests_resources
70 outputs = [
71 "{{bundle_resources_dir}}/{{source_file_part}}",
72 ]
73 }
74 }
75
76 rtc_source_set("network_tester_unittests") {
kjellandere0629c02017-04-25 04:04:50 -070077 testonly = true
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",
Mirko Bonadeie3abb812018-11-23 13:15:08 +010085 "../../rtc_base:gunit_helpers",
Patrik Höglund7696bef2018-03-15 15:05:39 +010086 "../../test:fileutils",
jianjun.zhuc0247402017-07-11 06:20:45 -070087 "../../test:test_support",
minyue939df962017-04-19 01:58:38 -070088 "//testing/gtest",
minyue939df962017-04-19 01:58:38 -070089 ]
90
91 if (is_ios) {
92 deps += [ ":network_tester_unittests_bundle_data" ]
93 }
94
Mirko Bonadei8e5014a2018-08-02 13:36:10 +020095 defines = [ "WEBRTC_NETWORK_TESTER_TEST_ENABLED" ]
minyue939df962017-04-19 01:58:38 -070096
97 data = network_tester_unittests_resources
minyue939df962017-04-19 01:58:38 -070098 }
michaeltfcea39d2017-04-20 05:39:30 -070099
100 rtc_executable("network_tester_server") {
101 sources = [
102 "server.cc",
103 ]
104
105 deps = [
106 ":network_tester",
107 ]
michaeltfcea39d2017-04-20 05:39:30 -0700108 }
minyue939df962017-04-19 01:58:38 -0700109}
michaelt2fe9ac32017-04-20 06:56:27 -0700110
111if (is_android) {
112 android_apk("NetworkTesterMobile") {
113 testonly = true
114 apk_name = "NetworkTesterMobile"
115 android_manifest = "androidapp/AndroidManifest.xml"
116
117 deps = [
118 ":NetworkTesterMobile_javalib",
119 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700120 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700121 ]
122
jianjun.zhuc0247402017-07-11 06:20:45 -0700123 shared_libraries = [ "../../rtc_tools/network_tester:network_tester_so" ]
michaelt2fe9ac32017-04-20 06:56:27 -0700124 }
125
126 android_library("NetworkTesterMobile_javalib") {
127 testonly = true
Mirko Bonadei4f024ef2018-01-04 13:12:03 +0100128 android_manifest_for_lint = "androidapp/AndroidManifest.xml"
michaelt2fe9ac32017-04-20 06:56:27 -0700129
130 java_files = [
131 "androidapp/src/com/google/media/networktester/MainActivity.java",
132 "androidapp/src/com/google/media/networktester/NetworkTester.java",
133 ]
134
135 deps = [
136 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700137 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700138 ]
139 }
140
141 android_resources("NetworkTesterMobile_resources") {
142 testonly = true
143 resource_dirs = [ "androidapp/res" ]
144 custom_package = "com.google.media.networktester"
145 }
146
147 rtc_shared_library("network_tester_so") {
148 sources = [
149 "jni.cpp",
150 ]
151
152 deps = [
153 ":network_tester",
michaelt2fe9ac32017-04-20 06:56:27 -0700154 ]
155
156 suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ]
157 configs += [ "//build/config/android:hide_all_but_jni" ]
158
159 output_extension = "so"
160 }
161}