minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 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 | |
| 9 | import("../../webrtc.gni") |
| 10 | import("//third_party/protobuf/proto_library.gni") |
| 11 | |
| 12 | if (rtc_enable_protobuf) { |
| 13 | proto_library("network_tester_config_proto") { |
| 14 | sources = [ |
| 15 | "network_tester_config.proto", |
| 16 | ] |
kjellander | d2b63cf | 2017-06-30 03:04:59 -0700 | [diff] [blame] | 17 | proto_out_dir = "webrtc/rtc_tools/network_tester" |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | proto_library("network_tester_packet_proto") { |
| 21 | sources = [ |
| 22 | "network_tester_packet.proto", |
| 23 | ] |
kjellander | d2b63cf | 2017-06-30 03:04:59 -0700 | [diff] [blame] | 24 | proto_out_dir = "webrtc/rtc_tools/network_tester" |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | rtc_static_library("network_tester") { |
| 28 | sources = [ |
| 29 | "config_reader.cc", |
| 30 | "config_reader.h", |
michaelt | fcea39d | 2017-04-20 05:39:30 -0700 | [diff] [blame] | 31 | "packet_logger.cc", |
| 32 | "packet_logger.h", |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 33 | "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", |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 44 | "../../p2p", |
ehmaldonado | 9483b49 | 2017-07-10 04:50:54 -0700 | [diff] [blame^] | 45 | "../../rtc_base:protobuf_utils", |
| 46 | "../../rtc_base:rtc_task_queue", |
| 47 | "../../rtc_base:sequenced_task_checker", |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 48 | ] |
| 49 | |
| 50 | if (!build_with_chromium && is_clang) { |
| 51 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 52 | suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | network_tester_unittests_resources = [ |
| 57 | "//resources/network_tester/client_config.dat", |
| 58 | "//resources/network_tester/server_config.dat", |
| 59 | ] |
| 60 | |
| 61 | if (is_ios) { |
| 62 | bundle_data("network_tester_unittests_bundle_data") { |
| 63 | testonly = true |
| 64 | sources = network_tester_unittests_resources |
| 65 | outputs = [ |
| 66 | "{{bundle_resources_dir}}/{{source_file_part}}", |
| 67 | ] |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | rtc_source_set("network_tester_unittests") { |
kjellander | e0629c0 | 2017-04-25 04:04:50 -0700 | [diff] [blame] | 72 | testonly = true |
| 73 | |
| 74 | # Skip restricting visibility on mobile platforms since the tests on those |
| 75 | # gets additional generated targets which would require many lines here to |
| 76 | # cover (which would be confusing to read and hard to maintain). |
| 77 | if (!is_android && !is_ios) { |
kjellander | d2b63cf | 2017-06-30 03:04:59 -0700 | [diff] [blame] | 78 | visibility = [ "//webrtc/rtc_tools:tools_unittests" ] |
kjellander | e0629c0 | 2017-04-25 04:04:50 -0700 | [diff] [blame] | 79 | } |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 80 | sources = [ |
| 81 | "network_tester_unittest.cc", |
| 82 | ] |
| 83 | |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 84 | deps = [ |
| 85 | ":network_tester", |
| 86 | "//testing/gtest", |
ehmaldonado | 9483b49 | 2017-07-10 04:50:54 -0700 | [diff] [blame^] | 87 | "//webrtc/rtc_base:rtc_base_tests_utils", |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 88 | "//webrtc/test:test_support", |
| 89 | ] |
| 90 | |
| 91 | if (is_ios) { |
| 92 | deps += [ ":network_tester_unittests_bundle_data" ] |
| 93 | } |
| 94 | |
| 95 | defines = [ |
| 96 | "GTEST_RELATIVE_PATH", |
| 97 | "WEBRTC_NETWORK_TESTER_TEST_ENABLED", |
| 98 | ] |
| 99 | |
| 100 | data = network_tester_unittests_resources |
| 101 | |
| 102 | if (!build_with_chromium && is_clang) { |
| 103 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 104 | suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| 105 | } |
| 106 | } |
michaelt | fcea39d | 2017-04-20 05:39:30 -0700 | [diff] [blame] | 107 | |
| 108 | rtc_executable("network_tester_server") { |
| 109 | sources = [ |
| 110 | "server.cc", |
| 111 | ] |
| 112 | |
| 113 | deps = [ |
| 114 | ":network_tester", |
| 115 | ] |
| 116 | |
| 117 | if (!build_with_chromium && is_clang) { |
| 118 | # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). |
| 119 | suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] |
| 120 | } |
| 121 | } |
minyue | 939df96 | 2017-04-19 01:58:38 -0700 | [diff] [blame] | 122 | } |
michaelt | 2fe9ac3 | 2017-04-20 06:56:27 -0700 | [diff] [blame] | 123 | |
| 124 | if (is_android) { |
| 125 | android_apk("NetworkTesterMobile") { |
| 126 | testonly = true |
| 127 | apk_name = "NetworkTesterMobile" |
| 128 | android_manifest = "androidapp/AndroidManifest.xml" |
| 129 | |
| 130 | deps = [ |
| 131 | ":NetworkTesterMobile_javalib", |
| 132 | ":NetworkTesterMobile_resources", |
| 133 | "//base:base_java", |
Henrik Kjellander | c036276 | 2017-06-29 08:03:04 +0200 | [diff] [blame] | 134 | "//webrtc/rtc_base:base_java", |
michaelt | 2fe9ac3 | 2017-04-20 06:56:27 -0700 | [diff] [blame] | 135 | ] |
| 136 | |
kjellander | d2b63cf | 2017-06-30 03:04:59 -0700 | [diff] [blame] | 137 | shared_libraries = [ "//webrtc/rtc_tools/network_tester:network_tester_so" ] |
michaelt | 2fe9ac3 | 2017-04-20 06:56:27 -0700 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | android_library("NetworkTesterMobile_javalib") { |
| 141 | testonly = true |
| 142 | android_manifest = "androidapp/AndroidManifest.xml" |
| 143 | |
| 144 | java_files = [ |
| 145 | "androidapp/src/com/google/media/networktester/MainActivity.java", |
| 146 | "androidapp/src/com/google/media/networktester/NetworkTester.java", |
| 147 | ] |
| 148 | |
| 149 | deps = [ |
| 150 | ":NetworkTesterMobile_resources", |
Henrik Kjellander | c036276 | 2017-06-29 08:03:04 +0200 | [diff] [blame] | 151 | "//webrtc/rtc_base:base_java", |
michaelt | 2fe9ac3 | 2017-04-20 06:56:27 -0700 | [diff] [blame] | 152 | ] |
| 153 | } |
| 154 | |
| 155 | android_resources("NetworkTesterMobile_resources") { |
| 156 | testonly = true |
| 157 | resource_dirs = [ "androidapp/res" ] |
| 158 | custom_package = "com.google.media.networktester" |
| 159 | } |
| 160 | |
| 161 | rtc_shared_library("network_tester_so") { |
| 162 | sources = [ |
| 163 | "jni.cpp", |
| 164 | ] |
| 165 | |
| 166 | deps = [ |
| 167 | ":network_tester", |
| 168 | "../../system_wrappers:field_trial_default", |
| 169 | ] |
| 170 | |
| 171 | suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ] |
| 172 | configs += [ "//build/config/android:hide_all_but_jni" ] |
| 173 | |
| 174 | output_extension = "so" |
| 175 | } |
| 176 | } |