blob: 151f9a7f38c6242b313d219f8943d09863c2d36a [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",
minyue939df962017-04-19 01:58:38 -070047 "../../p2p",
Artem Titov94b57c02019-03-21 13:35:10 +010048 "../../rtc_base",
Patrik Höglunda8005cf2017-12-13 16:05:42 +010049 "../../rtc_base:checks",
ehmaldonadof6a861a2017-07-19 10:40:47 -070050 "../../rtc_base:protobuf_utils",
mbonadei95c8f652017-08-27 23:40:10 -070051 "../../rtc_base:rtc_base_approved",
ehmaldonadof6a861a2017-07-19 10:40:47 -070052 "../../rtc_base:rtc_task_queue",
53 "../../rtc_base:sequenced_task_checker",
Artem Titov94b57c02019-03-21 13:35:10 +010054 "../../rtc_base/third_party/sigslot",
Danil Chapovalov471783f2019-03-11 14:26:02 +010055 "//third_party/abseil-cpp/absl/memory",
Danil Chapovalov431abd92018-06-18 12:54:17 +020056 "//third_party/abseil-cpp/absl/types:optional",
minyue939df962017-04-19 01:58:38 -070057 ]
minyue939df962017-04-19 01:58:38 -070058 }
59
60 network_tester_unittests_resources = [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020061 "../../resources/network_tester/client_config.dat",
62 "../../resources/network_tester/server_config.dat",
minyue939df962017-04-19 01:58:38 -070063 ]
64
65 if (is_ios) {
66 bundle_data("network_tester_unittests_bundle_data") {
67 testonly = true
68 sources = network_tester_unittests_resources
69 outputs = [
70 "{{bundle_resources_dir}}/{{source_file_part}}",
71 ]
72 }
73 }
74
75 rtc_source_set("network_tester_unittests") {
kjellandere0629c02017-04-25 04:04:50 -070076 testonly = true
77
minyue939df962017-04-19 01:58:38 -070078 sources = [
79 "network_tester_unittest.cc",
80 ]
81
minyue939df962017-04-19 01:58:38 -070082 deps = [
83 ":network_tester",
Mirko Bonadeie3abb812018-11-23 13:15:08 +010084 "../../rtc_base:gunit_helpers",
Patrik Höglund7696bef2018-03-15 15:05:39 +010085 "../../test:fileutils",
jianjun.zhuc0247402017-07-11 06:20:45 -070086 "../../test:test_support",
minyue939df962017-04-19 01:58:38 -070087 "//testing/gtest",
minyue939df962017-04-19 01:58:38 -070088 ]
89
90 if (is_ios) {
91 deps += [ ":network_tester_unittests_bundle_data" ]
92 }
93
Mirko Bonadei8e5014a2018-08-02 13:36:10 +020094 defines = [ "WEBRTC_NETWORK_TESTER_TEST_ENABLED" ]
minyue939df962017-04-19 01:58:38 -070095
96 data = network_tester_unittests_resources
minyue939df962017-04-19 01:58:38 -070097 }
michaeltfcea39d2017-04-20 05:39:30 -070098
99 rtc_executable("network_tester_server") {
100 sources = [
101 "server.cc",
102 ]
103
104 deps = [
105 ":network_tester",
106 ]
michaeltfcea39d2017-04-20 05:39:30 -0700107 }
minyue939df962017-04-19 01:58:38 -0700108}
michaelt2fe9ac32017-04-20 06:56:27 -0700109
110if (is_android) {
111 android_apk("NetworkTesterMobile") {
112 testonly = true
113 apk_name = "NetworkTesterMobile"
114 android_manifest = "androidapp/AndroidManifest.xml"
115
116 deps = [
117 ":NetworkTesterMobile_javalib",
118 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700119 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700120 ]
121
jianjun.zhuc0247402017-07-11 06:20:45 -0700122 shared_libraries = [ "../../rtc_tools/network_tester:network_tester_so" ]
michaelt2fe9ac32017-04-20 06:56:27 -0700123 }
124
125 android_library("NetworkTesterMobile_javalib") {
126 testonly = true
Mirko Bonadei4f024ef2018-01-04 13:12:03 +0100127 android_manifest_for_lint = "androidapp/AndroidManifest.xml"
michaelt2fe9ac32017-04-20 06:56:27 -0700128
129 java_files = [
130 "androidapp/src/com/google/media/networktester/MainActivity.java",
131 "androidapp/src/com/google/media/networktester/NetworkTester.java",
132 ]
133
134 deps = [
135 ":NetworkTesterMobile_resources",
jianjun.zhuc0247402017-07-11 06:20:45 -0700136 "../../rtc_base:base_java",
michaelt2fe9ac32017-04-20 06:56:27 -0700137 ]
138 }
139
140 android_resources("NetworkTesterMobile_resources") {
141 testonly = true
142 resource_dirs = [ "androidapp/res" ]
143 custom_package = "com.google.media.networktester"
144 }
145
146 rtc_shared_library("network_tester_so") {
147 sources = [
148 "jni.cpp",
149 ]
150
151 deps = [
152 ":network_tester",
michaelt2fe9ac32017-04-20 06:56:27 -0700153 ]
154
155 suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ]
156 configs += [ "//build/config/android:hide_all_but_jni" ]
157
158 output_extension = "so"
159 }
160}