1# 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") 10if (rtc_enable_protobuf) { 11 import("//third_party/protobuf/proto_library.gni") 12} 13 14if (rtc_enable_protobuf) { 15 proto_library("network_tester_config_proto") { 16 sources = [ "network_tester_config.proto" ] 17 proto_out_dir = "rtc_tools/network_tester" 18 } 19 20 proto_library("network_tester_packet_proto") { 21 sources = [ "network_tester_packet.proto" ] 22 proto_out_dir = "rtc_tools/network_tester" 23 } 24 25 rtc_library("network_tester") { 26 sources = [ 27 "config_reader.cc", 28 "config_reader.h", 29 "packet_logger.cc", 30 "packet_logger.h", 31 "packet_sender.cc", 32 "packet_sender.h", 33 "test_controller.cc", 34 "test_controller.h", 35 ] 36 37 defines = [ "WEBRTC_NETWORK_TESTER_PROTO" ] 38 39 deps = [ 40 ":network_tester_config_proto", 41 ":network_tester_packet_proto", 42 "../../api:sequence_checker", 43 "../../api/task_queue", 44 "../../api/task_queue:default_task_queue_factory", 45 "../../api/task_queue:pending_task_safety_flag", 46 "../../p2p:rtc_p2p", 47 "../../rtc_base", 48 "../../rtc_base:checks", 49 "../../rtc_base:ignore_wundef", 50 "../../rtc_base:ip_address", 51 "../../rtc_base:logging", 52 "../../rtc_base:macromagic", 53 "../../rtc_base:protobuf_utils", 54 "../../rtc_base:rtc_task_queue", 55 "../../rtc_base:socket_address", 56 "../../rtc_base:threading", 57 "../../rtc_base:timeutils", 58 "../../rtc_base/synchronization:mutex", 59 "../../rtc_base/system:no_unique_address", 60 "../../rtc_base/third_party/sigslot", 61 ] 62 absl_deps = [ 63 "//third_party/abseil-cpp/absl/functional:any_invocable", 64 "//third_party/abseil-cpp/absl/types:optional", 65 ] 66 } 67 68 network_tester_unittests_resources = [ 69 "../../resources/network_tester/client_config.dat", 70 "../../resources/network_tester/server_config.dat", 71 ] 72 73 if (is_ios) { 74 bundle_data("network_tester_unittests_bundle_data") { 75 testonly = true 76 sources = network_tester_unittests_resources 77 outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] 78 } 79 } 80 81 rtc_library("network_tester_unittests") { 82 testonly = true 83 84 sources = [ "network_tester_unittest.cc" ] 85 86 deps = [ 87 ":network_tester", 88 "../../rtc_base:gunit_helpers", 89 "../../rtc_base:threading", 90 "../../test:fileutils", 91 "../../test:test_support", 92 "//testing/gtest", 93 ] 94 95 if (is_ios) { 96 deps += [ ":network_tester_unittests_bundle_data" ] 97 } 98 99 defines = [ "WEBRTC_NETWORK_TESTER_TEST_ENABLED" ] 100 101 data = network_tester_unittests_resources 102 } 103 104 rtc_executable("network_tester_server") { 105 sources = [ "server.cc" ] 106 107 deps = [ 108 ":network_tester", 109 "../../rtc_base:null_socket_server", 110 "../../rtc_base:threading", 111 ] 112 } 113} 114 115if (is_android) { 116 rtc_android_apk("NetworkTesterMobile") { 117 testonly = true 118 apk_name = "NetworkTesterMobile" 119 android_manifest = "androidapp/AndroidManifest.xml" 120 min_sdk_version = 21 121 target_sdk_version = 24 122 123 deps = [ 124 ":NetworkTesterMobile_javalib", 125 ":NetworkTesterMobile_resources", 126 "../../rtc_base:base_java", 127 ] 128 129 shared_libraries = [ "../../rtc_tools/network_tester:network_tester_so" ] 130 } 131 132 rtc_android_library("NetworkTesterMobile_javalib") { 133 testonly = true 134 android_manifest = "androidapp/AndroidManifest.xml" 135 136 sources = [ 137 "androidapp/src/com/google/media/networktester/MainActivity.java", 138 "androidapp/src/com/google/media/networktester/NetworkTester.java", 139 ] 140 141 resources_package = "com.google.media.networktester" 142 deps = [ 143 ":NetworkTesterMobile_resources", 144 "../../rtc_base:base_java", 145 ] 146 } 147 148 android_resources("NetworkTesterMobile_resources") { 149 testonly = true 150 custom_package = "com.google.media.networktester" 151 sources = [ 152 "androidapp/res/layout/activity_main.xml", 153 "androidapp/res/mipmap-hdpi/ic_launcher.png", 154 "androidapp/res/mipmap-mdpi/ic_launcher.png", 155 "androidapp/res/mipmap-xhdpi/ic_launcher.png", 156 "androidapp/res/mipmap-xxhdpi/ic_launcher.png", 157 "androidapp/res/mipmap-xxxhdpi/ic_launcher.png", 158 "androidapp/res/values-v17/styles.xml", 159 "androidapp/res/values-w820dp/dimens.xml", 160 "androidapp/res/values/colors.xml", 161 "androidapp/res/values/dimens.xml", 162 "androidapp/res/values/strings.xml", 163 ] 164 165 # Needed for Bazel converter. 166 resource_dirs = [ "androidapp/res" ] 167 assert(resource_dirs != []) # Mark as used. 168 } 169 170 rtc_shared_library("network_tester_so") { 171 sources = [ "jni.cc" ] 172 173 deps = [ 174 ":network_tester", 175 "../../rtc_base:logging", 176 "../../rtc_base:threading", 177 ] 178 179 suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ] 180 configs += [ "//build/config/android:hide_all_but_jni" ] 181 182 output_extension = "so" 183 } 184} 185