OLD | NEW |
1 # Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license | 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 | 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 | 5 # tree. An additional intellectual property rights grant can be found |
6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
8 | 8 |
9 # TODO(kjellander): Convert the rest of the test.gyp targets and put here. | 9 import("//build/config/ui.gni") |
| 10 import("//testing/test.gni") |
| 11 if (is_android) { |
| 12 import("//build/config/android/rules.gni") |
| 13 } |
10 | 14 |
11 source_set("test") { | 15 source_set("test") { |
12 testonly = true | 16 testonly = true |
13 | 17 |
14 deps = [ | 18 deps = [ |
| 19 ":channel_transport", |
15 ":field_trial", | 20 ":field_trial", |
| 21 ":rtp_test_utils", |
| 22 ":test_common", |
| 23 ":test_renderer", |
16 ":test_support", | 24 ":test_support", |
17 ":test_support_main", | 25 ":test_support_main", |
| 26 ":test_support_main_threaded_mac", |
| 27 ":test_support_unittests", |
| 28 ":video_test_common", |
| 29 ] |
| 30 } |
| 31 |
| 32 config("channel_transport_warnings_config") { |
| 33 if (is_win) { |
| 34 cflags = [ "/wd4302" ] # cast truncation |
| 35 |
| 36 if (is_clang) { |
| 37 # GN orders flags on a target before flags from configs. The default confi
g |
| 38 # adds -Wall, and this flag have to be after -Wall -- so they need to |
| 39 # come from a config and cannot be on the target directly. |
| 40 cflags += [ |
| 41 "-Wno-parentheses-equality", |
| 42 "-Wno-reorder", |
| 43 "-Wno-tautological-constant-out-of-range-compare", |
| 44 "-Wno-unused-private-field", |
| 45 ] |
| 46 } |
| 47 } |
| 48 } |
| 49 |
| 50 source_set("channel_transport") { |
| 51 testonly = true |
| 52 sources = [ |
| 53 "channel_transport/channel_transport.cc", |
| 54 "channel_transport/channel_transport.h", |
| 55 "channel_transport/traffic_control_win.cc", |
| 56 "channel_transport/traffic_control_win.h", |
| 57 "channel_transport/udp_socket2_manager_win.cc", |
| 58 "channel_transport/udp_socket2_manager_win.h", |
| 59 "channel_transport/udp_socket2_win.cc", |
| 60 "channel_transport/udp_socket2_win.h", |
| 61 "channel_transport/udp_socket_manager_posix.cc", |
| 62 "channel_transport/udp_socket_manager_posix.h", |
| 63 "channel_transport/udp_socket_manager_wrapper.cc", |
| 64 "channel_transport/udp_socket_manager_wrapper.h", |
| 65 "channel_transport/udp_socket_posix.cc", |
| 66 "channel_transport/udp_socket_posix.h", |
| 67 "channel_transport/udp_socket_wrapper.cc", |
| 68 "channel_transport/udp_socket_wrapper.h", |
| 69 "channel_transport/udp_transport.h", |
| 70 "channel_transport/udp_transport_impl.cc", |
| 71 "channel_transport/udp_transport_impl.h", |
| 72 ] |
| 73 |
| 74 configs += [ |
| 75 "..:common_config", |
| 76 ":channel_transport_warnings_config", |
| 77 ] |
| 78 public_configs = [ "..:common_inherited_config" ] |
| 79 |
| 80 if (is_clang && !is_nacl) { |
| 81 # Suppress warnings from the Chromium Clang plugin. |
| 82 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. |
| 83 configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 84 } |
| 85 |
| 86 deps = [ |
| 87 "..:webrtc_common", |
| 88 "../system_wrappers", |
| 89 "//testing/gtest", |
| 90 ] |
| 91 } |
| 92 |
| 93 source_set("video_test_common") { |
| 94 testonly = true |
| 95 sources = [ |
| 96 "fake_texture_frame.cc", |
| 97 "fake_texture_frame.h", |
| 98 "frame_generator.cc", |
| 99 "frame_generator.h", |
| 100 "frame_utils.cc", |
| 101 "frame_utils.h", |
| 102 ] |
| 103 |
| 104 configs += [ "..:common_config" ] |
| 105 public_configs = [ "..:common_inherited_config" ] |
| 106 |
| 107 if (is_clang && !is_nacl) { |
| 108 # Suppress warnings from the Chromium Clang plugin. |
| 109 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. |
| 110 configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 111 } |
| 112 |
| 113 deps = [ |
| 114 "../common_video", |
| 115 ] |
| 116 } |
| 117 |
| 118 source_set("rtp_test_utils") { |
| 119 testonly = true |
| 120 sources = [ |
| 121 "rtcp_packet_parser.cc", |
| 122 "rtcp_packet_parser.h", |
| 123 "rtp_file_reader.cc", |
| 124 "rtp_file_reader.h", |
| 125 "rtp_file_writer.cc", |
| 126 "rtp_file_writer.h", |
| 127 ] |
| 128 |
| 129 configs += [ "..:common_config" ] |
| 130 public_configs = [ "..:common_inherited_config" ] |
| 131 |
| 132 if (is_clang && !is_nacl) { |
| 133 # Suppress warnings from the Chromium Clang plugin. |
| 134 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. |
| 135 configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 136 } |
| 137 |
| 138 deps = [ |
| 139 "..:webrtc_common", |
| 140 "../modules/rtp_rtcp", |
| 141 "//testing/gtest", |
18 ] | 142 ] |
19 } | 143 } |
20 | 144 |
21 source_set("field_trial") { | 145 source_set("field_trial") { |
| 146 testonly = true |
22 sources = [ | 147 sources = [ |
23 "field_trial.cc", | 148 "field_trial.cc", |
24 "field_trial.h", | 149 "field_trial.h", |
25 ] | 150 ] |
26 | 151 |
27 deps = [ | 152 deps = [ |
28 "..:webrtc_common", | 153 "..:webrtc_common", |
29 "../system_wrappers", | 154 "../system_wrappers", |
30 "../system_wrappers:field_trial_default", | 155 "../system_wrappers:field_trial_default", |
31 ] | 156 ] |
32 | 157 |
33 configs += [ "..:common_config" ] | 158 configs += [ "..:common_config" ] |
34 public_configs = [ "..:common_inherited_config" ] | 159 public_configs = [ "..:common_inherited_config" ] |
35 } | 160 } |
36 | 161 |
| 162 source_set("test_main") { |
| 163 testonly = true |
| 164 sources = [ |
| 165 "test_main.cc", |
| 166 ] |
| 167 |
| 168 deps = [ |
| 169 ":field_trial", |
| 170 ":test_support", |
| 171 "../system_wrappers:metrics_default", |
| 172 "//testing/gtest", |
| 173 "//third_party/gflags", |
| 174 ] |
| 175 |
| 176 configs += [ "..:common_config" ] |
| 177 public_configs = [ "..:common_inherited_config" ] |
| 178 } |
| 179 |
37 source_set("test_support") { | 180 source_set("test_support") { |
38 testonly = true | 181 testonly = true |
39 | 182 |
40 sources = [ | 183 sources = [ |
41 "testsupport/fileutils.cc", | 184 "testsupport/fileutils.cc", |
42 "testsupport/fileutils.h", | 185 "testsupport/fileutils.h", |
43 "testsupport/frame_reader.cc", | 186 "testsupport/frame_reader.cc", |
44 "testsupport/frame_reader.h", | 187 "testsupport/frame_reader.h", |
45 "testsupport/frame_writer.cc", | 188 "testsupport/frame_writer.cc", |
46 "testsupport/frame_writer.h", | 189 "testsupport/frame_writer.h", |
47 "testsupport/iosfileutils.mm", | 190 "testsupport/iosfileutils.mm", |
48 "testsupport/mock/mock_frame_reader.h", | 191 "testsupport/mock/mock_frame_reader.h", |
49 "testsupport/mock/mock_frame_writer.h", | 192 "testsupport/mock/mock_frame_writer.h", |
50 "testsupport/packet_reader.cc", | 193 "testsupport/packet_reader.cc", |
51 "testsupport/packet_reader.h", | 194 "testsupport/packet_reader.h", |
52 "testsupport/perf_test.cc", | 195 "testsupport/perf_test.cc", |
53 "testsupport/perf_test.h", | 196 "testsupport/perf_test.h", |
54 "testsupport/trace_to_stderr.cc", | 197 "testsupport/trace_to_stderr.cc", |
55 "testsupport/trace_to_stderr.h", | 198 "testsupport/trace_to_stderr.h", |
56 ] | 199 ] |
57 | 200 |
58 deps = [ | 201 deps = [ |
59 "../base:gtest_prod", | 202 "../base:gtest_prod", |
60 "../system_wrappers", | 203 "../system_wrappers", |
61 "//testing/gmock", | 204 "//testing/gmock", |
62 "//testing/gtest", | 205 "//testing/gtest", |
63 ] | 206 ] |
64 | 207 |
65 if (is_ios) { | 208 if (is_ios) { |
66 cflags = [ "-fobjc-arc" ] # CLANG_ENABLE_OBJC_ARC = YES. | 209 configs += [ "//build/config/compiler:enable_arc" ] |
| 210 } |
| 211 |
| 212 if (use_x11) { |
| 213 deps += [ "//tools/xdisplaycheck" ] |
67 } | 214 } |
68 | 215 |
69 if (is_android) { | 216 if (is_android) { |
70 deps += [ "//base:base" ] | 217 deps += [ "//base:base" ] |
71 } | 218 } |
72 | 219 |
73 configs += [ "..:common_config" ] | 220 configs += [ "..:common_config" ] |
74 public_configs = [ "..:common_inherited_config" ] | 221 public_configs = [ "..:common_inherited_config" ] |
75 } | 222 } |
76 | 223 |
| 224 # Depend on this target when you want to have test_support but also the |
| 225 # main method needed for gtest to execute! |
77 source_set("test_support_main") { | 226 source_set("test_support_main") { |
78 testonly = true | 227 testonly = true |
79 | 228 |
80 sources = [ | 229 sources = [ |
81 "run_all_unittests.cc", | 230 "run_all_unittests.cc", |
82 "test_suite.cc", | 231 "test_suite.cc", |
83 "test_suite.h", | 232 "test_suite.h", |
84 ] | 233 ] |
85 | 234 |
86 deps = [ | 235 deps = [ |
87 ":field_trial", | 236 ":field_trial", |
88 ":test_support", | 237 ":test_support", |
89 "../system_wrappers:metrics_default", | 238 "../system_wrappers:metrics_default", |
90 "//testing/gmock", | 239 "//testing/gmock", |
91 "//testing/gtest", | 240 "//testing/gtest", |
92 "//third_party/gflags", | 241 "//third_party/gflags", |
93 ] | 242 ] |
94 | 243 |
95 configs += [ "..:common_config" ] | 244 configs += [ "..:common_config" ] |
96 public_configs = [ "..:common_inherited_config" ] | 245 public_configs = [ "..:common_inherited_config" ] |
97 } | 246 } |
| 247 |
| 248 # Depend on this target when you want to have test_support and a special |
| 249 # main for mac which will run your test on a worker thread and consume |
| 250 # events on the main thread. Useful if you want to access a webcam. |
| 251 # This main will provide all the scaffolding and objective-c black magic |
| 252 # for you. All you need to do is to implement a function in the |
| 253 # run_threaded_main_mac.h file (ImplementThisToRunYourTest). |
| 254 source_set("test_support_main_threaded_mac") { |
| 255 testonly = true |
| 256 |
| 257 sources = [ |
| 258 "testsupport/mac/run_threaded_main_mac.h", |
| 259 "testsupport/mac/run_threaded_main_mac.mm", |
| 260 ] |
| 261 |
| 262 configs += [ "..:common_config" ] |
| 263 public_configs = [ "..:common_inherited_config" ] |
| 264 |
| 265 deps = [ |
| 266 ":test_support", |
| 267 ] |
| 268 } |
| 269 |
| 270 test("test_support_unittests") { |
| 271 deps = [] |
| 272 sources = [ |
| 273 "channel_transport/udp_socket_manager_unittest.cc", |
| 274 "channel_transport/udp_socket_wrapper_unittest.cc", |
| 275 "channel_transport/udp_transport_unittest.cc", |
| 276 "fake_network_pipe_unittest.cc", |
| 277 "frame_generator_unittest.cc", |
| 278 "rtp_file_reader_unittest.cc", |
| 279 "rtp_file_writer_unittest.cc", |
| 280 "testsupport/always_passing_unittest.cc", |
| 281 "testsupport/fileutils_unittest.cc", |
| 282 "testsupport/frame_reader_unittest.cc", |
| 283 "testsupport/frame_writer_unittest.cc", |
| 284 "testsupport/packet_reader_unittest.cc", |
| 285 "testsupport/perf_test_unittest.cc", |
| 286 "testsupport/unittest_utils.h", |
| 287 ] |
| 288 |
| 289 configs += [ "..:common_config" ] |
| 290 public_configs = [ "..:common_inherited_config" ] |
| 291 |
| 292 if (is_win) { |
| 293 cflags = [ |
| 294 # TODO(jschuh): Bug 1348: fix this warning. |
| 295 "/wd4267", # size_t to int truncations |
| 296 ] |
| 297 } |
| 298 |
| 299 if (is_clang) { |
| 300 # Suppress warnings from the Chromium Clang plugin. |
| 301 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. |
| 302 configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 303 } |
| 304 |
| 305 if (is_android) { |
| 306 deps += [ "//testing/android/native_test:native_test_support" ] |
| 307 |
| 308 # This needs to be kept in sync with the test_support_unittests.isolate file
. |
| 309 # TODO(kjellander); Move this to android_assets targets instead. |
| 310 data = [ |
| 311 "//resources/video_coding/frame-ethernet-ii.pcap", |
| 312 "//resources/video_coding/frame-loopback.pcap", |
| 313 "//resources/video_coding/pltype103.rtp", |
| 314 "//resources/video_coding/pltype103_header_only.rtp", |
| 315 "//resources/video_coding/ssrcs-2.pcap", |
| 316 "//resources/video_coding/ssrcs-3.pcap", |
| 317 ] |
| 318 } |
| 319 deps += [ |
| 320 ":channel_transport", |
| 321 ":test_common", |
| 322 ":test_support_main", |
| 323 "../modules/video_capture", |
| 324 "//testing/gmock", |
| 325 "//testing/gtest", |
| 326 ] |
| 327 } |
| 328 |
| 329 source_set("test_common") { |
| 330 testonly = true |
| 331 sources = [ |
| 332 "call_test.cc", |
| 333 "call_test.h", |
| 334 "configurable_frame_size_encoder.cc", |
| 335 "configurable_frame_size_encoder.h", |
| 336 "constants.cc", |
| 337 "constants.h", |
| 338 "direct_transport.cc", |
| 339 "direct_transport.h", |
| 340 "drifting_clock.cc", |
| 341 "drifting_clock.h", |
| 342 "encoder_settings.cc", |
| 343 "encoder_settings.h", |
| 344 "fake_audio_device.cc", |
| 345 "fake_audio_device.h", |
| 346 "fake_decoder.cc", |
| 347 "fake_decoder.h", |
| 348 "fake_encoder.cc", |
| 349 "fake_encoder.h", |
| 350 "fake_network_pipe.cc", |
| 351 "fake_network_pipe.h", |
| 352 "frame_generator_capturer.cc", |
| 353 "frame_generator_capturer.h", |
| 354 "layer_filtering_transport.cc", |
| 355 "layer_filtering_transport.h", |
| 356 "mock_transport.h", |
| 357 "mock_voe_channel_proxy.h", |
| 358 "mock_voice_engine.h", |
| 359 "null_transport.cc", |
| 360 "null_transport.h", |
| 361 "rtp_rtcp_observer.h", |
| 362 "statistics.cc", |
| 363 "statistics.h", |
| 364 "vcm_capturer.cc", |
| 365 "vcm_capturer.h", |
| 366 "video_capturer.cc", |
| 367 "video_capturer.h", |
| 368 "win/run_loop_win.cc", |
| 369 ] |
| 370 if (!is_win) { |
| 371 sources += [ |
| 372 "run_loop.cc", |
| 373 "run_loop.h", |
| 374 ] |
| 375 } |
| 376 |
| 377 configs += [ "..:common_config" ] |
| 378 public_configs = [ "..:common_inherited_config" ] |
| 379 |
| 380 if (is_clang && !is_nacl) { |
| 381 # Suppress warnings from the Chromium Clang plugin. |
| 382 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. |
| 383 configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 384 } |
| 385 |
| 386 deps = [ |
| 387 ":rtp_test_utils", |
| 388 ":test_support", |
| 389 ":video_test_common", |
| 390 "..:webrtc", |
| 391 "..:webrtc_common", |
| 392 "../base:rtc_base_approved", |
| 393 "../modules/media_file", |
| 394 "//testing/gmock", |
| 395 "//testing/gtest", |
| 396 "//third_party/gflags", |
| 397 ] |
| 398 } |
| 399 |
| 400 config("test_renderer_exported_config") { |
| 401 if (is_win && is_clang) { |
| 402 # GN orders flags on a target before flags from configs. The default config |
| 403 # adds -Wall, and this flag have to be after -Wall -- so they need to |
| 404 # come from a config and cannot be on the target directly. |
| 405 cflags += [ |
| 406 "-Wno-bool-conversion", |
| 407 "-Wno-comment", |
| 408 "-Wno-delete-non-virtual-dtor", |
| 409 ] |
| 410 } |
| 411 } |
| 412 |
| 413 source_set("test_renderer") { |
| 414 testonly = true |
| 415 libs = [] |
| 416 sources = [ |
| 417 "linux/glx_renderer.cc", |
| 418 "linux/glx_renderer.h", |
| 419 "linux/video_renderer_linux.cc", |
| 420 "mac/video_renderer_mac.h", |
| 421 "mac/video_renderer_mac.mm", |
| 422 "video_renderer.cc", |
| 423 "video_renderer.h", |
| 424 "win/d3d_renderer.cc", |
| 425 "win/d3d_renderer.h", |
| 426 ] |
| 427 if (!is_linux && !is_mac && !is_win) { |
| 428 sources += [ "null_platform_renderer.cc" ] |
| 429 } |
| 430 if (is_linux || is_mac) { |
| 431 sources += [ |
| 432 "gl/gl_renderer.cc", |
| 433 "gl/gl_renderer.h", |
| 434 ] |
| 435 } |
| 436 |
| 437 if (is_linux) { |
| 438 libs += [ |
| 439 "Xext", |
| 440 "X11", |
| 441 "GL", |
| 442 ] |
| 443 } |
| 444 if (is_android) { |
| 445 libs += [ |
| 446 "GLESv2", |
| 447 "log", |
| 448 ] |
| 449 } |
| 450 if (is_mac) { |
| 451 libs = [ |
| 452 "Cocoa.framework", |
| 453 "OpenGL.framework", |
| 454 "CoreVideo.framework", |
| 455 ] |
| 456 } |
| 457 |
| 458 configs += [ "..:common_config" ] |
| 459 public_configs = [ |
| 460 "..:common_inherited_config", |
| 461 ":test_renderer_exported_config", |
| 462 ] |
| 463 |
| 464 if (is_clang && !is_nacl) { |
| 465 # Suppress warnings from the Chromium Clang plugin. |
| 466 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. |
| 467 configs -= [ "//build/config/clang:find_bad_constructs" ] |
| 468 } |
| 469 |
| 470 deps = [ |
| 471 ":test_support", |
| 472 ":video_test_common", |
| 473 "../modules/media_file", |
| 474 "//testing/gtest", |
| 475 ] |
| 476 } |
OLD | NEW |