• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/task_queue",
43      "../../api/task_queue:default_task_queue_factory",
44      "../../p2p",
45      "../../rtc_base",
46      "../../rtc_base:checks",
47      "../../rtc_base:ignore_wundef",
48      "../../rtc_base:protobuf_utils",
49      "../../rtc_base:rtc_base_approved",
50      "../../rtc_base:rtc_task_queue",
51      "../../rtc_base/synchronization:mutex",
52      "../../rtc_base/synchronization:sequence_checker",
53      "../../rtc_base/third_party/sigslot",
54    ]
55    absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
56  }
57
58  network_tester_unittests_resources = [
59    "../../resources/network_tester/client_config.dat",
60    "../../resources/network_tester/server_config.dat",
61  ]
62
63  if (is_ios) {
64    bundle_data("network_tester_unittests_bundle_data") {
65      testonly = true
66      sources = network_tester_unittests_resources
67      outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
68    }
69  }
70
71  rtc_library("network_tester_unittests") {
72    testonly = true
73
74    sources = [ "network_tester_unittest.cc" ]
75
76    deps = [
77      ":network_tester",
78      "../../rtc_base:gunit_helpers",
79      "../../test:fileutils",
80      "../../test:test_support",
81      "//testing/gtest",
82    ]
83
84    if (is_ios) {
85      deps += [ ":network_tester_unittests_bundle_data" ]
86    }
87
88    defines = [ "WEBRTC_NETWORK_TESTER_TEST_ENABLED" ]
89
90    data = network_tester_unittests_resources
91  }
92
93  rtc_executable("network_tester_server") {
94    sources = [ "server.cc" ]
95
96    deps = [ ":network_tester" ]
97  }
98}
99
100if (is_android) {
101  rtc_android_apk("NetworkTesterMobile") {
102    testonly = true
103    apk_name = "NetworkTesterMobile"
104    android_manifest = "androidapp/AndroidManifest.xml"
105    min_sdk_version = 21
106    target_sdk_version = 24
107
108    deps = [
109      ":NetworkTesterMobile_javalib",
110      ":NetworkTesterMobile_resources",
111      "../../rtc_base:base_java",
112    ]
113
114    shared_libraries = [ "../../rtc_tools/network_tester:network_tester_so" ]
115  }
116
117  rtc_android_library("NetworkTesterMobile_javalib") {
118    testonly = true
119    android_manifest = "androidapp/AndroidManifest.xml"
120
121    sources = [
122      "androidapp/src/com/google/media/networktester/MainActivity.java",
123      "androidapp/src/com/google/media/networktester/NetworkTester.java",
124    ]
125
126    deps = [
127      ":NetworkTesterMobile_resources",
128      "../../rtc_base:base_java",
129    ]
130  }
131
132  android_resources("NetworkTesterMobile_resources") {
133    testonly = true
134    custom_package = "com.google.media.networktester"
135    sources = [
136      "androidapp/res/layout/activity_main.xml",
137      "androidapp/res/mipmap-hdpi/ic_launcher.png",
138      "androidapp/res/mipmap-mdpi/ic_launcher.png",
139      "androidapp/res/mipmap-xhdpi/ic_launcher.png",
140      "androidapp/res/mipmap-xxhdpi/ic_launcher.png",
141      "androidapp/res/mipmap-xxxhdpi/ic_launcher.png",
142      "androidapp/res/values-v17/styles.xml",
143      "androidapp/res/values-w820dp/dimens.xml",
144      "androidapp/res/values/colors.xml",
145      "androidapp/res/values/dimens.xml",
146      "androidapp/res/values/strings.xml",
147    ]
148
149    # Needed for Bazel converter.
150    resource_dirs = [ "androidapp/res" ]
151    assert(resource_dirs != [])  # Mark as used.
152  }
153
154  rtc_shared_library("network_tester_so") {
155    sources = [ "jni.cpp" ]
156
157    deps = [ ":network_tester" ]
158
159    suppressed_configs += [ "//build/config/android:hide_all_but_jni_onload" ]
160    configs += [ "//build/config/android:hide_all_but_jni" ]
161
162    output_extension = "so"
163  }
164}
165