xref: /aosp_15_r20/external/webrtc/test/BUILD.gn (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1# Copyright (c) 2014 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("//build/config/ui.gni")
10import("//third_party/google_benchmark/buildconfig.gni")
11import("../webrtc.gni")
12if (is_android) {
13  import("//build/config/android/rules.gni")
14}
15
16if (!build_with_chromium) {
17  group("test") {
18    testonly = true
19
20    deps = [
21      ":copy_to_file_audio_capturer",
22      ":rtp_test_utils",
23      ":test_common",
24      ":test_renderer",
25      ":test_support",
26      ":video_test_common",
27    ]
28
29    if (rtc_include_tests) {
30      deps += [
31        ":test_main",
32        ":test_support_unittests",
33        "pc/e2e",
34      ]
35    }
36  }
37}
38
39rtc_library("frame_generator_impl") {
40  visibility = [
41    ":*",
42    "../api:create_frame_generator",
43  ]
44  testonly = true
45  sources = [
46    "frame_generator.cc",
47    "frame_generator.h",
48    "testsupport/ivf_video_frame_generator.cc",
49    "testsupport/ivf_video_frame_generator.h",
50  ]
51  deps = [
52    ":frame_utils",
53    "../api:frame_generator_api",
54    "../api:scoped_refptr",
55    "../api:sequence_checker",
56    "../api/video:encoded_image",
57    "../api/video:video_frame",
58    "../api/video:video_frame_i010",
59    "../api/video:video_rtp_headers",
60    "../api/video_codecs:video_codecs_api",
61    "../common_video",
62    "../media:rtc_media_base",
63    "../modules/video_coding:video_codec_interface",
64    "../modules/video_coding:video_coding_utility",
65    "../modules/video_coding:webrtc_h264",
66    "../modules/video_coding:webrtc_vp8",
67    "../modules/video_coding:webrtc_vp9",
68    "../rtc_base",
69    "../rtc_base:checks",
70    "../rtc_base:criticalsection",
71    "../rtc_base:logging",
72    "../rtc_base:random",
73    "../rtc_base:rtc_event",
74    "../rtc_base/synchronization:mutex",
75    "../rtc_base/system:file_wrapper",
76    "../system_wrappers",
77  ]
78  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
79}
80
81rtc_library("frame_utils") {
82  visibility = [ "*" ]
83  testonly = true
84  sources = [
85    "frame_utils.cc",
86    "frame_utils.h",
87  ]
88  deps = [
89    "../api:scoped_refptr",
90    "../api/video:video_frame",
91  ]
92}
93
94rtc_library("video_test_common") {
95  visibility = [ "*" ]
96  testonly = true
97  sources = [
98    "fake_texture_frame.cc",
99    "fake_texture_frame.h",
100    "fake_videorenderer.h",
101    "frame_forwarder.cc",
102    "frame_forwarder.h",
103    "frame_generator_capturer.cc",
104    "frame_generator_capturer.h",
105    "mappable_native_buffer.cc",
106    "mappable_native_buffer.h",
107    "test_video_capturer.cc",
108    "test_video_capturer.h",
109    "video_codec_settings.h",
110    "video_decoder_proxy_factory.h",
111    "video_encoder_nullable_proxy_factory.h",
112    "video_encoder_proxy_factory.h",
113  ]
114
115  deps = [
116    ":fileutils",
117    ":frame_utils",
118    ":scoped_key_value_config",
119    "../api:array_view",
120    "../api:create_frame_generator",
121    "../api:frame_generator_api",
122    "../api:scoped_refptr",
123    "../api/task_queue",
124    "../api/video:video_frame",
125    "../api/video:video_rtp_headers",
126    "../api/video_codecs:video_codecs_api",
127    "../common_video",
128    "../media:rtc_media_base",
129    "../rtc_base",
130    "../rtc_base:checks",
131    "../rtc_base:criticalsection",
132    "../rtc_base:logging",
133    "../rtc_base:refcount",
134    "../rtc_base:rtc_task_queue",
135    "../rtc_base:timeutils",
136    "../rtc_base/synchronization:mutex",
137    "../rtc_base/task_utils:repeating_task",
138    "../system_wrappers",
139  ]
140  absl_deps = [
141    "//third_party/abseil-cpp/absl/algorithm:container",
142    "//third_party/abseil-cpp/absl/strings",
143  ]
144}
145
146rtc_library("audio_test_common") {
147  visibility = [ "*" ]
148  testonly = true
149  sources = [
150    "audio_decoder_proxy_factory.h",
151    "function_audio_decoder_factory.h",
152  ]
153  deps = [
154    "../api/audio_codecs:audio_codecs_api",
155    "../rtc_base:checks",
156  ]
157  absl_deps = [ "//third_party/abseil-cpp/absl/memory" ]
158}
159
160if (!build_with_chromium) {
161  if (is_mac || is_ios) {
162    rtc_library("video_test_mac") {
163      testonly = true
164      sources = [
165        "mac_capturer.h",
166        "mac_capturer.mm",
167      ]
168      deps = [
169        ":video_test_common",
170        "../api:libjingle_peerconnection_api",
171        "../api:media_stream_interface",
172        "../api:scoped_refptr",
173        "../modules/video_capture:video_capture_module",
174        "../rtc_base",
175        "../rtc_base:threading",
176        "../sdk:base_objc",
177        "../sdk:native_api",
178        "../sdk:native_video",
179        "../sdk:videocapture_objc",
180      ]
181    }
182  }
183
184  rtc_library("platform_video_capturer") {
185    testonly = true
186    sources = [
187      "platform_video_capturer.cc",
188      "platform_video_capturer.h",
189    ]
190    deps = [ ":video_test_common" ]
191    absl_deps = [ "//third_party/abseil-cpp/absl/memory" ]
192    if (is_mac || is_ios) {
193      deps += [ ":video_test_mac" ]
194    } else {
195      sources += [
196        "vcm_capturer.cc",
197        "vcm_capturer.h",
198      ]
199      deps += [
200        ":scoped_key_value_config",
201        "../api:scoped_refptr",
202        "../modules/video_capture:video_capture_module",
203        "../rtc_base:checks",
204        "../rtc_base:logging",
205      ]
206    }
207  }
208}
209
210rtc_library("rtp_test_utils") {
211  testonly = true
212  sources = [
213    "rtcp_packet_parser.cc",
214    "rtcp_packet_parser.h",
215    "rtp_file_reader.cc",
216    "rtp_file_reader.h",
217    "rtp_file_writer.cc",
218    "rtp_file_writer.h",
219  ]
220
221  deps = [
222    "../api:array_view",
223    "../api:rtp_parameters",
224    "../modules/rtp_rtcp",
225    "../modules/rtp_rtcp:rtp_rtcp_format",
226    "../rtc_base:checks",
227    "../rtc_base:criticalsection",
228    "../rtc_base:logging",
229    "../rtc_base:macromagic",
230    "../rtc_base/synchronization:mutex",
231    "../rtc_base/system:arch",
232  ]
233  absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
234}
235
236rtc_library("field_trial") {
237  testonly = true
238  visibility = [ "*" ]
239  sources = [
240    "field_trial.cc",
241    "field_trial.h",
242  ]
243
244  absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
245  deps = [
246    "../rtc_base:checks",
247    "../system_wrappers:field_trial",
248  ]
249}
250
251rtc_library("explicit_key_value_config") {
252  sources = [
253    "explicit_key_value_config.cc",
254    "explicit_key_value_config.h",
255  ]
256
257  deps = [
258    "../api:field_trials_registry",
259    "../rtc_base:checks",
260  ]
261  absl_deps = [ "//third_party/abseil-cpp/absl/strings:strings" ]
262}
263
264rtc_library("scoped_key_value_config") {
265  testonly = true
266  visibility = [ "*" ]
267  sources = [
268    "scoped_key_value_config.cc",
269    "scoped_key_value_config.h",
270  ]
271
272  deps = [
273    ":field_trial",
274    "../api:field_trials_registry",
275    "../rtc_base:checks",
276    "../system_wrappers:field_trial",
277  ]
278  absl_deps = [ "//third_party/abseil-cpp/absl/strings:strings" ]
279}
280
281rtc_library("perf_test") {
282  visibility = [ "*" ]
283  testonly = true
284  sources = [
285    "testsupport/perf_test.cc",
286    "testsupport/perf_test.h",
287    "testsupport/perf_test_histogram_writer.h",
288    "testsupport/perf_test_result_writer.h",
289  ]
290  deps = [
291    "../api:array_view",
292    "../api/numerics",
293    "../rtc_base:checks",
294    "../rtc_base:criticalsection",
295    "../rtc_base:logging",
296    "../rtc_base:rtc_numerics",
297    "../rtc_base:stringutils",
298    "../rtc_base/synchronization:mutex",
299    "../test:fileutils",
300  ]
301  absl_deps = [
302    "//third_party/abseil-cpp/absl/strings",
303    "//third_party/abseil-cpp/absl/types:optional",
304  ]
305  if (rtc_enable_protobuf) {
306    sources += [ "testsupport/perf_test_histogram_writer.cc" ]
307    deps += [
308      "//third_party/catapult/tracing/tracing:histogram",
309      "//third_party/catapult/tracing/tracing:reserved_infos",
310    ]
311  } else {
312    sources += [ "testsupport/perf_test_histogram_writer_no_protobuf.cc" ]
313  }
314}
315
316if (is_ios) {
317  rtc_library("test_support_objc") {
318    testonly = true
319    visibility = [
320      ":google_test_runner_objc",
321      ":test_support",
322    ]
323    sources = [
324      "ios/coverage_util_ios.h",
325      "ios/coverage_util_ios.mm",
326      "ios/google_test_runner_delegate.h",
327      "ios/test_support.h",
328      "ios/test_support.mm",
329    ]
330    deps = [
331      ":perf_test",
332      "../api/test/metrics:chrome_perf_dashboard_metrics_exporter",
333      "../api/test/metrics:global_metrics_logger_and_exporter",
334      "../api/test/metrics:metrics_exporter",
335      "../api/test/metrics:metrics_set_proto_file_exporter",
336      "../api/test/metrics:print_result_proxy_metrics_exporter",
337      "../api/test/metrics:stdout_metrics_exporter",
338      "../sdk:helpers_objc",
339    ]
340    absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
341    configs += [ ":test_support_objc_config" ]
342  }
343
344  rtc_library("google_test_runner_objc") {
345    testonly = true
346    visibility = [ "*" ]
347    sources = [ "ios/google_test_runner.mm" ]
348    deps = [ ":test_support_objc" ]
349    configs += [ "//build/config/ios:xctest_config" ]
350    frameworks = [ "UIKit.framework" ]
351  }
352
353  config("test_support_objc_config") {
354    defines = []
355
356    if (use_clang_coverage) {
357      defines += [ "WEBRTC_IOS_ENABLE_COVERAGE" ]
358    }
359  }
360}
361
362config("suppress_warning_4373") {
363  if (is_win) {
364    cflags = [
365      # MSVC has a bug which generates this warning when using mocks; see the
366      # section on warning 4373 in he googlemock FAQ. This warning isn't the
367      # least relevant for us, anyway.
368      "/wd4373",
369    ]
370  }
371}
372
373config("test_main_direct_config") {
374  visibility = [ ":*" ]
375  defines = [ "WEBRTC_UNIT_TEST" ]
376}
377rtc_source_set("test_support") {
378  visibility = [ "*" ]
379  testonly = true
380
381  all_dependent_configs = [
382    ":suppress_warning_4373",
383    "//third_party/googletest:gmock_config",
384    "//third_party/googletest:gtest_config",
385  ]
386
387  sources = [
388    "gmock.h",
389    "gtest.h",
390  ]
391
392  public_deps = []  # no-presubmit-check TODO(webrtc:8603)
393  if (is_ios) {
394    public_deps +=  # no-presubmit-check TODO(webrtc:8603)
395        [ ":test_support_objc" ]
396  }
397
398  public_configs = [ ":test_main_direct_config" ]
399  deps = [
400    "../rtc_base:ignore_wundef",
401    "//testing/gmock",
402    "//testing/gtest",
403  ]
404}
405
406rtc_library("fixed_fps_video_frame_writer_adapter") {
407  visibility = [ "*" ]
408  testonly = true
409  sources = [
410    "testsupport/fixed_fps_video_frame_writer_adapter.cc",
411    "testsupport/fixed_fps_video_frame_writer_adapter.h",
412  ]
413  deps = [
414    ":video_test_support",
415    "../api/test/video:video_frame_writer",
416    "../api/units:time_delta",
417    "../api/video:video_frame",
418    "../rtc_base:checks",
419    "../system_wrappers",
420  ]
421  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
422}
423
424rtc_library("video_test_support") {
425  testonly = true
426
427  sources = [
428    "testsupport/frame_reader.h",
429    "testsupport/frame_writer.h",
430    "testsupport/mock/mock_frame_reader.h",
431    "testsupport/video_frame_writer.cc",
432    "testsupport/video_frame_writer.h",
433    "testsupport/y4m_frame_reader.cc",
434    "testsupport/y4m_frame_writer.cc",
435    "testsupport/yuv_frame_reader.cc",
436    "testsupport/yuv_frame_writer.cc",
437  ]
438
439  deps = [
440    ":fileutils",
441    ":frame_utils",
442    ":test_support",
443    ":video_test_common",
444    "../api:scoped_refptr",
445    "../api:sequence_checker",
446    "../api/test/video:video_frame_writer",
447    "../api/video:encoded_image",
448    "../api/video:video_frame",
449    "../api/video_codecs:video_codecs_api",
450    "../common_video",
451    "../media:rtc_media_base",
452    "../modules/video_coding:video_codec_interface",
453    "../modules/video_coding:video_coding_utility",
454    "../modules/video_coding:webrtc_h264",
455    "../modules/video_coding:webrtc_vp8",
456    "../modules/video_coding:webrtc_vp9",
457    "../rtc_base:buffer",
458    "../rtc_base:checks",
459    "../rtc_base:criticalsection",
460    "../rtc_base:logging",
461    "../rtc_base:rtc_event",
462    "../rtc_base:stringutils",
463    "../rtc_base/system:file_wrapper",
464  ]
465  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
466
467  if (!is_ios) {
468    deps += [ "//third_party:jpeg" ]
469    sources += [ "testsupport/jpeg_frame_writer.cc" ]
470  } else {
471    sources += [ "testsupport/jpeg_frame_writer_ios.cc" ]
472  }
473}
474
475if (rtc_include_tests && enable_google_benchmarks) {
476  rtc_library("benchmark_main") {
477    testonly = true
478    sources = [ "benchmark_main.cc" ]
479
480    deps = [ "//third_party/google_benchmark" ]
481  }
482}
483
484if (rtc_include_tests && !build_with_chromium) {
485  rtc_library("resources_dir_flag") {
486    testonly = true
487    visibility = [ "*" ]
488    sources = [
489      "testsupport/resources_dir_flag.cc",
490      "testsupport/resources_dir_flag.h",
491    ]
492    absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
493  }
494
495  rtc_library("test_flags") {
496    visibility = [ "*" ]
497    testonly = true
498    sources = [
499      "test_flags.cc",
500      "test_flags.h",
501    ]
502    absl_deps = [ "//third_party/abseil-cpp/absl/flags:flag" ]
503  }
504
505  rtc_library("test_main_lib") {
506    visibility = [ "*" ]
507    testonly = true
508    sources = [
509      "test_main_lib.cc",
510      "test_main_lib.h",
511    ]
512
513    deps = [
514      ":field_trial",
515      ":perf_test",
516      ":resources_dir_flag",
517      ":test_flags",
518      ":test_support",
519      "../api/test/metrics:chrome_perf_dashboard_metrics_exporter",
520      "../api/test/metrics:global_metrics_logger_and_exporter",
521      "../api/test/metrics:metrics_exporter",
522      "../api/test/metrics:metrics_set_proto_file_exporter",
523      "../api/test/metrics:print_result_proxy_metrics_exporter",
524      "../api/test/metrics:stdout_metrics_exporter",
525      "../rtc_base",
526      "../rtc_base:checks",
527      "../rtc_base:event_tracer",
528      "../rtc_base:logging",
529      "../rtc_base:threading",
530      "../system_wrappers:field_trial",
531      "../system_wrappers:metrics",
532    ]
533    absl_deps = [
534      "//third_party/abseil-cpp/absl/flags:flag",
535      "//third_party/abseil-cpp/absl/memory",
536      "//third_party/abseil-cpp/absl/strings:strings",
537      "//third_party/abseil-cpp/absl/types:optional",
538    ]
539  }
540
541  rtc_library("test_main") {
542    visibility = [ "*" ]
543    testonly = true
544    sources = [ "test_main.cc" ]
545
546    deps = [
547      ":test_main_lib",
548      ":test_support",
549    ]
550
551    absl_deps = [
552      "//third_party/abseil-cpp/absl/debugging:failure_signal_handler",
553      "//third_party/abseil-cpp/absl/debugging:symbolize",
554      "//third_party/abseil-cpp/absl/flags:parse",
555    ]
556  }
557
558  rtc_library("test_support_test_artifacts") {
559    testonly = true
560    sources = [
561      "testsupport/test_artifacts.cc",
562      "testsupport/test_artifacts.h",
563    ]
564    deps = [
565      ":fileutils",
566      "../rtc_base:logging",
567      "../rtc_base/system:file_wrapper",
568    ]
569    absl_deps = [
570      "//third_party/abseil-cpp/absl/flags:flag",
571      "//third_party/abseil-cpp/absl/flags:parse",
572    ]
573  }
574
575  test_support_unittests_resources = [
576    "../resources/foreman_cif_short.yuv",
577    "../resources/video_coding/frame-ethernet-ii.pcap",
578    "../resources/video_coding/frame-loopback.pcap",
579    "../resources/video_coding/pltype103.rtp",
580    "../resources/video_coding/pltype103_header_only.rtp",
581    "../resources/video_coding/ssrcs-2.pcap",
582    "../resources/video_coding/ssrcs-3.pcap",
583  ]
584
585  if (is_ios) {
586    bundle_data("test_support_unittests_bundle_data") {
587      testonly = true
588      sources = test_support_unittests_resources
589      outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
590    }
591  }
592
593  rtc_library("fixed_fps_video_frame_writer_adapter_test") {
594    testonly = true
595    sources = [ "testsupport/fixed_fps_video_frame_writer_adapter_test.cc" ]
596    deps = [
597      ":fixed_fps_video_frame_writer_adapter",
598      ":test_support",
599      ":video_test_support",
600      "../api/units:time_delta",
601      "../api/units:timestamp",
602      "../api/video:video_frame",
603      "../rtc_base/synchronization:mutex",
604      "time_controller",
605    ]
606    absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
607  }
608
609  rtc_test("test_support_unittests") {
610    deps = [
611      ":call_config_utils",
612      ":copy_to_file_audio_capturer_unittest",
613      ":direct_transport",
614      ":fake_video_codecs",
615      ":fileutils",
616      ":fileutils_unittests",
617      ":fixed_fps_video_frame_writer_adapter_test",
618      ":frame_generator_impl",
619      ":perf_test",
620      ":rtc_expect_death",
621      ":rtp_test_utils",
622      ":run_loop",
623      ":scoped_key_value_config",
624      ":test_main",
625      ":test_support",
626      ":test_support_test_artifacts",
627      ":video_test_common",
628      ":video_test_support",
629      "../api:array_view",
630      "../api:create_frame_generator",
631      "../api:create_simulcast_test_fixture_api",
632      "../api:frame_generator_api",
633      "../api:scoped_refptr",
634      "../api:simulcast_test_fixture_api",
635      "../api/task_queue:task_queue_test",
636      "../api/test/video:function_video_factory",
637      "../api/test/video:video_frame_writer",
638      "../api/units:time_delta",
639      "../api/video:encoded_image",
640      "../api/video:video_frame",
641      "../api/video_codecs:video_codecs_api",
642      "../call:video_stream_api",
643      "../common_video",
644      "../media:rtc_media_base",
645      "../modules/rtp_rtcp:rtp_rtcp_format",
646      "../modules/video_coding:simulcast_test_fixture_impl",
647      "../modules/video_coding:video_codec_interface",
648      "../modules/video_coding:video_coding_utility",
649      "../modules/video_coding:webrtc_h264",
650      "../modules/video_coding:webrtc_vp8",
651      "../modules/video_coding:webrtc_vp9",
652      "../rtc_base:criticalsection",
653      "../rtc_base:rtc_event",
654      "../rtc_base:rtc_task_queue",
655      "../rtc_base/synchronization:mutex",
656      "../rtc_base/system:file_wrapper",
657      "pc/e2e:e2e_unittests",
658      "pc/e2e/analyzer/video:video_analyzer_unittests",
659      "peer_scenario/tests",
660      "scenario:scenario_unittests",
661      "time_controller:time_controller",
662      "time_controller:time_controller_unittests",
663    ]
664    absl_deps = [
665      "//third_party/abseil-cpp/absl/flags:flag",
666      "//third_party/abseil-cpp/absl/strings",
667      "//third_party/abseil-cpp/absl/types:optional",
668    ]
669    sources = [
670      "call_config_utils_unittest.cc",
671      "direct_transport_unittest.cc",
672      "fake_vp8_encoder_unittest.cc",
673      "frame_generator_capturer_unittest.cc",
674      "frame_generator_unittest.cc",
675      "rtp_file_reader_unittest.cc",
676      "rtp_file_writer_unittest.cc",
677      "run_loop_unittest.cc",
678      "testsupport/ivf_video_frame_generator_unittest.cc",
679      "testsupport/perf_test_unittest.cc",
680      "testsupport/test_artifacts_unittest.cc",
681      "testsupport/video_frame_writer_unittest.cc",
682      "testsupport/y4m_frame_reader_unittest.cc",
683      "testsupport/y4m_frame_writer_unittest.cc",
684      "testsupport/yuv_frame_reader_unittest.cc",
685      "testsupport/yuv_frame_writer_unittest.cc",
686    ]
687
688    if (rtc_enable_protobuf) {
689      sources += [ "testsupport/perf_test_histogram_writer_unittest.cc" ]
690      deps += [ "//third_party/catapult/tracing/tracing:histogram" ]
691    }
692
693    data = test_support_unittests_resources
694    if (is_android) {
695      deps += [ "//testing/android/native_test:native_test_support" ]
696      shard_timeout = 900
697    }
698
699    if (is_ios) {
700      deps += [ ":test_support_unittests_bundle_data" ]
701    }
702
703    if (!is_android) {
704      # This is needed in order to avoid:
705      # undefined symbol: webrtc::videocapturemodule::VideoCaptureImpl::Create
706      deps += [ "../modules/video_capture:video_capture_internal_impl" ]
707    }
708  }
709}
710
711if (is_ios) {
712  rtc_library("fileutils_ios_objc") {
713    visibility = [
714      ":fileutils",
715      ":fileutils_override_impl",
716    ]
717    sources = [
718      "testsupport/ios_file_utils.h",
719      "testsupport/ios_file_utils.mm",
720    ]
721    deps = [
722      "../rtc_base:checks",
723      "../sdk:helpers_objc",
724    ]
725    absl_deps = [ "//third_party/abseil-cpp/absl/strings:strings" ]
726  }
727}
728
729if (is_mac) {
730  rtc_library("fileutils_mac_objc") {
731    visibility = [
732      ":fileutils",
733      ":fileutils_override_impl",
734    ]
735    sources = [
736      "testsupport/mac_file_utils.h",
737      "testsupport/mac_file_utils.mm",
738    ]
739    deps = [ "../rtc_base:checks" ]
740  }
741}
742
743rtc_library("fileutils") {
744  testonly = true
745  visibility = [ "*" ]
746  sources = [
747    "testsupport/file_utils.cc",
748    "testsupport/file_utils.h",
749  ]
750  deps = [
751    ":fileutils_override_api",
752    ":fileutils_override_impl",
753    "../rtc_base:checks",
754    "../rtc_base:stringutils",
755  ]
756  absl_deps = [
757    "//third_party/abseil-cpp/absl/base:core_headers",
758    "//third_party/abseil-cpp/absl/strings:strings",
759    "//third_party/abseil-cpp/absl/types:optional",
760  ]
761  if (is_ios) {
762    deps += [ ":fileutils_ios_objc" ]
763  }
764  if (is_mac) {
765    deps += [ ":fileutils_mac_objc" ]
766  }
767  if (is_win) {
768    deps += [ "../rtc_base:win32" ]
769  }
770}
771
772# We separate header into own target to make it possible for downstream
773# projects to override implementation.
774rtc_source_set("fileutils_override_api") {
775  testonly = true
776  sources = [ "testsupport/file_utils_override.h" ]
777  absl_deps = [ "//third_party/abseil-cpp/absl/strings:strings" ]
778}
779
780rtc_library("fileutils_override_impl") {
781  testonly = true
782  visibility = [ ":fileutils" ]
783  sources = [ "testsupport/file_utils_override.cc" ]
784  deps = [
785    ":fileutils_override_api",
786    "../rtc_base:checks",
787    "../rtc_base:macromagic",
788    "../rtc_base:stringutils",
789  ]
790  absl_deps = [
791    "//third_party/abseil-cpp/absl/strings:strings",
792    "//third_party/abseil-cpp/absl/types:optional",
793  ]
794  if (is_ios) {
795    deps += [ ":fileutils_ios_objc" ]
796  }
797  if (is_mac) {
798    deps += [ ":fileutils_mac_objc" ]
799  }
800  if (is_win) {
801    deps += [ "../rtc_base:win32" ]
802  }
803}
804
805rtc_source_set("run_test") {
806  testonly = true
807  if (is_mac) {
808    public_deps = [ ":run_test_objc" ]  # no-presubmit-check TODO(webrtc:8603)
809  } else {
810    public_deps =  # no-presubmit-check TODO(webrtc:8603)
811        [ ":run_test_generic" ]
812  }
813}
814
815rtc_source_set("run_test_interface") {
816  sources = [ "run_test.h" ]
817}
818
819if (is_mac) {
820  rtc_library("run_test_objc") {
821    testonly = true
822    visibility = [ ":run_test" ]
823    sources = [ "mac/run_test.mm" ]
824    deps = [ ":run_test_interface" ]
825  }
826}
827
828rtc_library("run_test_generic") {
829  testonly = true
830  visibility = [ ":run_test" ]
831  sources = [ "run_test.cc" ]
832  deps = [ ":run_test_interface" ]
833}
834
835rtc_library("fileutils_unittests") {
836  testonly = true
837  visibility = [ ":*" ]  # Only targets in this file can depend on this.
838  sources = [ "testsupport/file_utils_unittest.cc" ]
839  deps = [
840    ":fileutils",
841    ":test_support",
842    "../rtc_base:checks",
843  ]
844  absl_deps = [
845    "//third_party/abseil-cpp/absl/strings:strings",
846    "//third_party/abseil-cpp/absl/types:optional",
847  ]
848}
849
850rtc_library("direct_transport") {
851  visibility = [ "*" ]
852  testonly = true
853  sources = [
854    "direct_transport.cc",
855    "direct_transport.h",
856  ]
857  deps = [
858    "../api:sequence_checker",
859    "../api:simulated_network_api",
860    "../api:transport_api",
861    "../api/task_queue",
862    "../api/units:time_delta",
863    "../call:call_interfaces",
864    "../call:simulated_packet_receiver",
865    "../modules/rtp_rtcp:rtp_rtcp_format",
866    "../rtc_base:macromagic",
867    "../rtc_base:timeutils",
868    "../rtc_base/synchronization:mutex",
869    "../rtc_base/task_utils:repeating_task",
870  ]
871  absl_deps = [ "//third_party/abseil-cpp/absl/memory" ]
872  public_deps =  # no-presubmit-check TODO(webrtc:8603)
873      [ "../call:fake_network" ]
874}
875
876rtc_library("fake_video_codecs") {
877  allow_poison = [ "software_video_codecs" ]
878  visibility = [ "*" ]
879  sources = [
880    "configurable_frame_size_encoder.cc",
881    "configurable_frame_size_encoder.h",
882    "fake_decoder.cc",
883    "fake_decoder.h",
884    "fake_encoder.cc",
885    "fake_encoder.h",
886    "fake_vp8_decoder.cc",
887    "fake_vp8_decoder.h",
888    "fake_vp8_encoder.cc",
889    "fake_vp8_encoder.h",
890  ]
891  deps = [
892    "../api:fec_controller_api",
893    "../api:scoped_refptr",
894    "../api:sequence_checker",
895    "../api/task_queue",
896    "../api/video:encoded_image",
897    "../api/video:video_bitrate_allocation",
898    "../api/video:video_frame",
899    "../api/video:video_rtp_headers",
900    "../api/video_codecs:video_codecs_api",
901    "../api/video_codecs:vp8_temporal_layers_factory",
902    "../modules/video_coding:codec_globals_headers",
903    "../modules/video_coding:video_codec_interface",
904    "../modules/video_coding:video_coding_utility",
905    "../rtc_base:checks",
906    "../rtc_base:criticalsection",
907    "../rtc_base:macromagic",
908    "../rtc_base:rtc_task_queue",
909    "../rtc_base:timeutils",
910    "../rtc_base/synchronization:mutex",
911    "../system_wrappers",
912  ]
913  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
914}
915
916rtc_library("null_transport") {
917  testonly = true
918  sources = [
919    "null_transport.cc",
920    "null_transport.h",
921  ]
922  deps = [ "../api:transport_api" ]
923}
924
925rtc_library("encoder_settings") {
926  testonly = true
927  sources = [
928    "encoder_settings.cc",
929    "encoder_settings.h",
930  ]
931  deps = [
932    "../api:scoped_refptr",
933    "../api/video_codecs:video_codecs_api",
934    "../call:rtp_interfaces",
935    "../call:video_stream_api",
936    "../rtc_base:checks",
937    "../rtc_base:refcount",
938    "../video/config:encoder_config",
939  ]
940}
941
942rtc_library("rtc_expect_death") {
943  testonly = true
944  sources = [ "testsupport/rtc_expect_death.h" ]
945  deps = [ ":test_support" ]
946}
947
948rtc_library("run_loop") {
949  testonly = true
950  sources = [
951    "run_loop.cc",
952    "run_loop.h",
953  ]
954  deps = [
955    "../api/task_queue",
956    "../rtc_base:threading",
957    "../rtc_base:timeutils",
958  ]
959  absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
960}
961
962rtc_library("test_common") {
963  testonly = true
964  sources = [
965    "call_test.cc",
966    "call_test.h",
967    "drifting_clock.cc",
968    "drifting_clock.h",
969    "layer_filtering_transport.cc",
970    "layer_filtering_transport.h",
971    "rtp_rtcp_observer.h",
972  ]
973
974  deps = [
975    ":direct_transport",
976    ":encoder_settings",
977    ":fake_video_codecs",
978    ":fileutils",
979    ":mock_transport",
980    ":run_loop",
981    ":scoped_key_value_config",
982    ":test_support",
983    ":video_test_common",
984    "../api:array_view",
985    "../api:create_frame_generator",
986    "../api:frame_generator_api",
987    "../api:rtp_headers",
988    "../api:rtp_parameters",
989    "../api:simulated_network_api",
990    "../api:transport_api",
991    "../api/audio_codecs:builtin_audio_decoder_factory",
992    "../api/audio_codecs:builtin_audio_encoder_factory",
993    "../api/rtc_event_log",
994    "../api/task_queue",
995    "../api/task_queue:default_task_queue_factory",
996    "../api/test/video:function_video_factory",
997    "../api/transport:field_trial_based_config",
998    "../api/units:time_delta",
999    "../api/video:builtin_video_bitrate_allocator_factory",
1000    "../api/video:video_bitrate_allocator_factory",
1001    "../api/video:video_frame",
1002    "../api/video_codecs:video_codecs_api",
1003    "../call",
1004    "../call:call_interfaces",
1005    "../call:fake_network",
1006    "../call:simulated_network",
1007    "../call:simulated_packet_receiver",
1008    "../call:video_stream_api",
1009    "../modules/audio_device:audio_device_impl",
1010    "../modules/audio_mixer:audio_mixer_impl",
1011    "../modules/rtp_rtcp",
1012    "../modules/rtp_rtcp:rtp_rtcp_format",
1013    "../modules/rtp_rtcp:rtp_video_header",
1014    "../modules/video_coding:codec_globals_headers",
1015    "../rtc_base:checks",
1016    "../rtc_base:criticalsection",
1017    "../rtc_base:rtc_base",
1018    "../rtc_base:rtc_event",
1019    "../rtc_base:task_queue_for_test",
1020    "../rtc_base:threading",
1021    "../rtc_base:timeutils",
1022    "../system_wrappers",
1023    "../system_wrappers:field_trial",
1024    "../video/config:encoder_config",
1025  ]
1026  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
1027  if (!is_android && !build_with_chromium) {
1028    deps += [ "../modules/video_capture:video_capture_internal_impl" ]
1029  }
1030}
1031
1032rtc_library("mock_transport") {
1033  testonly = true
1034  sources = [
1035    "mock_transport.cc",
1036    "mock_transport.h",
1037  ]
1038  deps = [
1039    ":test_support",
1040    "../api:transport_api",
1041  ]
1042}
1043
1044rtc_source_set("test_renderer") {
1045  public_deps =  # no-presubmit-check TODO(webrtc:8603)
1046      [ ":test_renderer_generic" ]
1047  testonly = true
1048  if (is_mac) {
1049    public_deps +=  # no-presubmit-check TODO(webrtc:8603)
1050        [ ":test_renderer_objc" ]
1051  }
1052}
1053
1054rtc_library("mock_frame_transformer") {
1055  visibility = [ "*" ]
1056  testonly = true
1057  sources = [ "mock_frame_transformer.h" ]
1058  deps = [
1059    "../api:frame_transformer_interface",
1060    "../test:test_support",
1061  ]
1062}
1063
1064rtc_library("mock_transformable_frame") {
1065  visibility = [ "*" ]
1066
1067  testonly = true
1068  sources = [ "mock_transformable_frame.h" ]
1069
1070  deps = [
1071    "../api:frame_transformer_interface",
1072    "../test:test_support",
1073  ]
1074}
1075
1076if (is_mac) {
1077  rtc_library("test_renderer_objc") {
1078    testonly = true
1079    visibility = [ ":test_renderer" ]
1080    sources = [
1081      "mac/video_renderer_mac.h",
1082      "mac/video_renderer_mac.mm",
1083    ]
1084    deps = [ ":test_renderer_generic" ]
1085    frameworks = [
1086      "Cocoa.framework",
1087      "OpenGL.framework",
1088      "CoreVideo.framework",
1089    ]
1090    defines = [ "GL_SILENCE_DEPRECATION" ]
1091  }
1092}
1093
1094rtc_library("test_renderer_generic") {
1095  testonly = true
1096  visibility = [
1097    ":test_renderer",
1098    ":test_renderer_objc",
1099  ]
1100  libs = []
1101  sources = [
1102    "video_renderer.cc",
1103    "video_renderer.h",
1104  ]
1105  deps = [
1106    "../api/video:video_frame",
1107    "../common_video",
1108    "../rtc_base:checks",
1109  ]
1110  if (is_win) {
1111    sources += [
1112      "win/d3d_renderer.cc",
1113      "win/d3d_renderer.h",
1114    ]
1115    deps += [ "../api:scoped_refptr" ]
1116  }
1117  if (!((is_linux || is_chromeos) && rtc_use_x11) && !is_mac && !is_win) {
1118    sources += [ "null_platform_renderer.cc" ]
1119  }
1120  if (((is_linux || is_chromeos) && rtc_use_x11) || is_mac) {
1121    sources += [
1122      "gl/gl_renderer.cc",
1123      "gl/gl_renderer.h",
1124    ]
1125  }
1126  if (is_mac) {
1127    defines = [ "GL_SILENCE_DEPRECATION" ]
1128  }
1129
1130  if ((is_linux || is_chromeos) && rtc_use_x11) {
1131    sources += [
1132      "linux/glx_renderer.cc",
1133      "linux/glx_renderer.h",
1134      "linux/video_renderer_linux.cc",
1135    ]
1136    libs += [
1137      "Xext",
1138      "X11",
1139      "GL",
1140    ]
1141  }
1142  if (is_android) {
1143    libs += [
1144      "GLESv2",
1145      "log",
1146    ]
1147  }
1148}
1149
1150rtc_library("audio_codec_mocks") {
1151  testonly = true
1152  sources = [
1153    "mock_audio_decoder.cc",
1154    "mock_audio_decoder.h",
1155    "mock_audio_decoder_factory.h",
1156    "mock_audio_encoder.cc",
1157    "mock_audio_encoder.h",
1158    "mock_audio_encoder_factory.h",
1159  ]
1160
1161  deps = [
1162    ":test_support",
1163    "../api:array_view",
1164    "../api:make_ref_counted",
1165    "../api:scoped_refptr",
1166    "../api/audio_codecs:audio_codecs_api",
1167    "../api/audio_codecs:builtin_audio_decoder_factory",
1168  ]
1169}
1170
1171rtc_library("copy_to_file_audio_capturer") {
1172  testonly = true
1173  sources = [
1174    "testsupport/copy_to_file_audio_capturer.cc",
1175    "testsupport/copy_to_file_audio_capturer.h",
1176  ]
1177  deps = [
1178    "../api:array_view",
1179    "../common_audio",
1180    "../modules/audio_device:audio_device_impl",
1181    "../rtc_base:buffer",
1182  ]
1183  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
1184}
1185
1186rtc_library("copy_to_file_audio_capturer_unittest") {
1187  testonly = true
1188  sources = [ "testsupport/copy_to_file_audio_capturer_unittest.cc" ]
1189  deps = [
1190    ":copy_to_file_audio_capturer",
1191    ":fileutils",
1192    ":test_support",
1193    "../modules/audio_device:audio_device_impl",
1194  ]
1195}
1196
1197if (!build_with_chromium && is_android) {
1198  rtc_android_library("native_test_java") {
1199    testonly = true
1200    sources = [
1201      "android/org/webrtc/native_test/RTCNativeUnitTest.java",
1202      "android/org/webrtc/native_test/RTCNativeUnitTestActivity.java",
1203    ]
1204    deps = [
1205      "../rtc_base:base_java",
1206      "//testing/android/native_test:native_test_java",
1207    ]
1208  }
1209}
1210
1211rtc_library("call_config_utils") {
1212  # TODO(bugs.webrtc.org/10814): Remove rtc_json_suppressions as soon as it
1213  # gets removed upstream.
1214  public_configs = [ "../rtc_base:rtc_json_suppressions" ]
1215  sources = [
1216    "call_config_utils.cc",
1217    "call_config_utils.h",
1218  ]
1219  deps = [
1220    "../call:video_stream_api",
1221    "../rtc_base:rtc_json",
1222  ]
1223}
1224
1225rtc_library("fake_encoded_frame") {
1226  testonly = true
1227  sources = [
1228    "fake_encoded_frame.cc",
1229    "fake_encoded_frame.h",
1230  ]
1231  deps = [
1232    ":test_support",
1233    "../api:rtp_packet_info",
1234    "../api/video:encoded_frame",
1235    "../api/video:encoded_image",
1236    "../api/video:video_frame_type",
1237    "../api/video:video_rtp_headers",
1238  ]
1239  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
1240}
1241