From 36cb55d7157dcba872f666e0e1fb75cae1a940a6 Mon Sep 17 00:00:00 2001 From: ehmaldonado Date: Wed, 25 Jan 2017 08:00:15 -0800 Subject: [PATCH] GN: Refactor modules_unittests to eliminate package boundary violations. Also move bwe_simulator to webrtc/modules/remote_bitrate_estimator BUG=webrtc:6954 NOTRY=True Review-Url: https://codereview.webrtc.org/2649563002 Cr-Commit-Position: refs/heads/master@{#16270} --- webrtc/modules/BUILD.gn | 87 +------------------ webrtc/modules/audio_coding/BUILD.gn | 44 ++++++++++ webrtc/modules/desktop_capture/BUILD.gn | 21 +++++ .../modules/remote_bitrate_estimator/BUILD.gn | 32 +++++++ webrtc/modules/rtp_rtcp/BUILD.gn | 16 ++++ webrtc/modules/video_coding/BUILD.gn | 30 +++++++ 6 files changed, 147 insertions(+), 83 deletions(-) diff --git a/webrtc/modules/BUILD.gn b/webrtc/modules/BUILD.gn index e44b35f4c3..c66acf115a 100644 --- a/webrtc/modules/BUILD.gn +++ b/webrtc/modules/BUILD.gn @@ -51,62 +51,16 @@ if (rtc_include_tests) { rtc_test("modules_tests") { testonly = true - videoprocessor_defines = [] - if (rtc_use_h264) { - videoprocessor_defines += [ "WEBRTC_VIDEOPROCESSOR_H264_TESTS" ] - } - - defines = audio_coding_defines + videoprocessor_defines - deps = [ - "..:webrtc_common", - "../common_video", - "../media:rtc_media_base", - "../modules/audio_coding", - "../modules/audio_coding:audio_format_conversion", - "../modules/rtp_rtcp", - "../modules/utility", - "../modules/video_coding", - "../modules/video_coding:video_codecs_test_framework", - "../system_wrappers", "../test:test_main", + "audio_coding:audio_coding_modules_tests", + "desktop_capture:desktop_capture_modules_tests", + "rtp_rtcp:rtp_rtcp_modules_tests", + "video_coding:video_coding_modules_tests", "//testing/gmock", "//testing/gtest", ] - sources = [ - "audio_coding/test/APITest.cc", - "audio_coding/test/Channel.cc", - "audio_coding/test/EncodeDecodeTest.cc", - "audio_coding/test/PCMFile.cc", - "audio_coding/test/PacketLossTest.cc", - "audio_coding/test/RTPFile.cc", - "audio_coding/test/TestAllCodecs.cc", - "audio_coding/test/TestRedFec.cc", - "audio_coding/test/TestStereo.cc", - "audio_coding/test/TestVADDTX.cc", - "audio_coding/test/Tester.cc", - "audio_coding/test/TwoWayCommunication.cc", - "audio_coding/test/iSACTest.cc", - "audio_coding/test/opus_test.cc", - "audio_coding/test/target_delay_unittest.cc", - "audio_coding/test/utility.cc", - "rtp_rtcp/test/testFec/test_fec.cc", - "video_coding/codecs/test/videoprocessor_integrationtest.cc", - "video_coding/codecs/vp8/test/vp8_impl_unittest.cc", - ] - - if (rtc_desktop_capture_supported) { - deps += [ - "desktop_capture:desktop_capture_mock", - "desktop_capture:screen_drawer", - ] - sources += [ - "desktop_capture/screen_capturer_integration_test.cc", - "desktop_capture/screen_drawer_unittest.cc", - ] - } - data = modules_tests_resources if (is_android) { @@ -292,37 +246,4 @@ if (rtc_include_tests) { ldflags = [ "-ObjC" ] } } - - rtc_test("bwe_simulator") { - testonly = true - - deps = [] - sources = [ - "remote_bitrate_estimator/bwe_simulations.cc", - ] - - if (!build_with_chromium && is_clang) { - # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). - suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] - } - - if (is_win) { - cflags = [ - # TODO(kjellander): bugs.webrtc.org/261: Fix this warning. - "/wd4373", # virtual function override. - ] - } - - deps += [ - "..:webrtc_common", - "../base:rtc_base_approved", - "../test:test_common", - "../test:test_main", - "remote_bitrate_estimator:bwe_simulator_lib", - "video_capture", - "//testing/gmock", - "//testing/gtest", - "//third_party/gflags", - ] - } } diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn index b67a0192ec..caf954e1ee 100644 --- a/webrtc/modules/audio_coding/BUILD.gn +++ b/webrtc/modules/audio_coding/BUILD.gn @@ -1139,6 +1139,50 @@ if (rtc_include_tests) { } } + rtc_source_set("audio_coding_modules_tests") { + testonly = true + sources = [ + "test/APITest.cc", + "test/Channel.cc", + "test/EncodeDecodeTest.cc", + "test/PCMFile.cc", + "test/PacketLossTest.cc", + "test/RTPFile.cc", + "test/TestAllCodecs.cc", + "test/TestRedFec.cc", + "test/TestStereo.cc", + "test/TestVADDTX.cc", + "test/Tester.cc", + "test/TwoWayCommunication.cc", + "test/iSACTest.cc", + "test/opus_test.cc", + "test/target_delay_unittest.cc", + "test/utility.cc", + ] + deps = [ + ":audio_coding", + ":audio_format_conversion", + ":builtin_audio_decoder_factory", + ":pcm16b_c", + "../..:webrtc_common", + "../../base:rtc_base_approved", + "../../system_wrappers:system_wrappers", + "../../test:fileutils", + "../../test:test_support", + ] + defines = audio_coding_defines + if (is_win) { + cflags = [ + # TODO(kjellander): bugs.webrtc.org/261: Fix this warning. + "/wd4373", # virtual function override. + ] + } + if (!build_with_chromium && is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] + } + } + rtc_source_set("audio_coding_perf_tests") { testonly = true sources = [ diff --git a/webrtc/modules/desktop_capture/BUILD.gn b/webrtc/modules/desktop_capture/BUILD.gn index 9c9a46631e..e4f5b309c9 100644 --- a/webrtc/modules/desktop_capture/BUILD.gn +++ b/webrtc/modules/desktop_capture/BUILD.gn @@ -33,6 +33,27 @@ rtc_static_library("primitives") { } if (rtc_include_tests) { + rtc_source_set("desktop_capture_modules_tests") { + testonly = true + sources = [] + deps = [] + if (rtc_desktop_capture_supported) { + deps += [ + ":desktop_capture_mock", + ":primitives", + ":screen_drawer", + "../../base:rtc_base", + "../../base:rtc_base_approved", + "../../system_wrappers:system_wrappers", + "../../test:test_support", + ] + sources += [ + "screen_capturer_integration_test.cc", + "screen_drawer_unittest.cc", + ] + } + } + rtc_source_set("desktop_capture_unittests") { testonly = true sources = [] diff --git a/webrtc/modules/remote_bitrate_estimator/BUILD.gn b/webrtc/modules/remote_bitrate_estimator/BUILD.gn index 13e2382b84..feadc8d88a 100644 --- a/webrtc/modules/remote_bitrate_estimator/BUILD.gn +++ b/webrtc/modules/remote_bitrate_estimator/BUILD.gn @@ -185,4 +185,36 @@ if (rtc_include_tests) { suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] } } + + rtc_test("bwe_simulator") { + testonly = true + + sources = [ + "bwe_simulations.cc", + ] + deps = [ + ":bwe_simulator_lib", + ":remote_bitrate_estimator", + "../..:webrtc_common", + "../../base:rtc_base_approved", + "../../test:test_common", + "../../test:test_main", + "../video_capture", + "//testing/gmock", + "//testing/gtest", + "//third_party/gflags", + ] + + if (!build_with_chromium && is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] + } + + if (is_win) { + cflags = [ + # TODO(kjellander): bugs.webrtc.org/261: Fix this warning. + "/wd4373", # virtual function override. + ] + } + } } diff --git a/webrtc/modules/rtp_rtcp/BUILD.gn b/webrtc/modules/rtp_rtcp/BUILD.gn index 4fa4d4963d..b7166ef459 100644 --- a/webrtc/modules/rtp_rtcp/BUILD.gn +++ b/webrtc/modules/rtp_rtcp/BUILD.gn @@ -211,6 +211,22 @@ if (rtc_include_tests) { ] } # test_packet_masks_metrics + rtc_source_set("rtp_rtcp_modules_tests") { + testonly = true + sources = [ + "test/testFec/test_fec.cc", + ] + deps = [ + ":rtp_rtcp", + "../../base:rtc_base_approved", + "../../test:test_support", + ] + if (!build_with_chromium && is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] + } + } + rtc_source_set("rtp_rtcp_unittests") { testonly = true sources = [ diff --git a/webrtc/modules/video_coding/BUILD.gn b/webrtc/modules/video_coding/BUILD.gn index 5750d10178..9b5b5e35ff 100644 --- a/webrtc/modules/video_coding/BUILD.gn +++ b/webrtc/modules/video_coding/BUILD.gn @@ -310,6 +310,36 @@ if (rtc_include_tests) { "../../test:test_support", ] } + + rtc_source_set("video_coding_modules_tests") { + testonly = true + sources = [ + "codecs/test/videoprocessor_integrationtest.cc", + "codecs/vp8/test/vp8_impl_unittest.cc", + ] + deps = [ + ":video_codecs_test_framework", + ":video_coding", + ":webrtc_h264", + ":webrtc_vp8", + ":webrtc_vp9", + "../..:webrtc_common", + "../../api:video_frame_api", + "../../base:rtc_base_approved", + "../../common_video:common_video", + "../../media:rtc_media_base", + "../../test:test_support", + "../../test:video_test_common", + ] + if (rtc_use_h264) { + defines = [ "WEBRTC_VIDEOPROCESSOR_H264_TESTS" ] + } + if (!build_with_chromium && is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + suppressed_configs += [ "//build/config/clang:find_bad_constructs" ] + } + } + rtc_source_set("video_coding_unittests") { testonly = true sources = [