GN: Add common_audio_unittests and common_video_unittests

BUG=webrtc:5949
TESTED=Built and ran the tests on Mac.
NOTRY=True

Review-Url: https://codereview.webrtc.org/2040073002
Cr-Commit-Position: refs/heads/master@{#13061}
diff --git a/webrtc/common_audio/BUILD.gn b/webrtc/common_audio/BUILD.gn
index eef0a76..50c4439 100644
--- a/webrtc/common_audio/BUILD.gn
+++ b/webrtc/common_audio/BUILD.gn
@@ -8,6 +8,7 @@
 
 import("//build/config/arm.gni")
 import("../build/webrtc.gni")
+import("//testing/test.gni")
 
 config("common_audio_config") {
   include_dirs = [
@@ -248,3 +249,66 @@
     }
   }
 }
+
+if (rtc_include_tests) {
+  test("common_audio_unittests") {
+    testonly = true
+
+    sources = [
+      "audio_converter_unittest.cc",
+      "audio_ring_buffer_unittest.cc",
+      "audio_util_unittest.cc",
+      "blocker_unittest.cc",
+      "fir_filter_unittest.cc",
+      "lapped_transform_unittest.cc",
+      "real_fourier_unittest.cc",
+      "resampler/push_resampler_unittest.cc",
+      "resampler/push_sinc_resampler_unittest.cc",
+      "resampler/resampler_unittest.cc",
+      "resampler/sinusoidal_linear_chirp_source.cc",
+      "resampler/sinusoidal_linear_chirp_source.h",
+      "ring_buffer_unittest.cc",
+      "signal_processing/real_fft_unittest.cc",
+      "signal_processing/signal_processing_unittest.cc",
+      "sparse_fir_filter_unittest.cc",
+      "vad/vad_core_unittest.cc",
+      "vad/vad_filterbank_unittest.cc",
+      "vad/vad_gmm_unittest.cc",
+      "vad/vad_sp_unittest.cc",
+      "vad/vad_unittest.cc",
+      "vad/vad_unittest.h",
+      "wav_file_unittest.cc",
+      "wav_header_unittest.cc",
+      "window_generator_unittest.cc",
+    ]
+
+    # Does not compile on iOS for arm: webrtc:5544.
+    if (!is_ios || target_cpu != "arm" || target_cpu != "arm64") {
+      sources += [ "resampler/sinc_resampler_unittest.cc" ]
+    }
+
+    configs += [ "..:common_config" ]
+    public_configs = [ "..:common_inherited_config" ]
+
+    if (rtc_use_openmax_dl) {
+      defines = [ "RTC_USE_OPENMAX_DL" ]
+    }
+
+    if (is_clang) {
+      # Suppress warnings from the Chromium Clang plugin.
+      # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+      configs -= [ "//build/config/clang:find_bad_constructs" ]
+    }
+
+    deps = [
+      ":common_audio",
+      "../test:test_support_main",
+      "//testing/gmock",
+      "//testing/gtest",
+    ]
+
+    if (is_android) {
+      deps += [ "//testing/android/native_test:native_test_support" ]
+    }
+  }
+}
diff --git a/webrtc/common_video/BUILD.gn b/webrtc/common_video/BUILD.gn
index 4714606..cb3e390 100644
--- a/webrtc/common_video/BUILD.gn
+++ b/webrtc/common_video/BUILD.gn
@@ -7,6 +7,7 @@
 # be found in the AUTHORS file in the root of the source tree.
 
 import("../build/webrtc.gni")
+import("//testing/test.gni")
 
 config("common_video_config") {
   include_dirs = [
@@ -80,3 +81,51 @@
     libs = [ "CoreVideo.framework" ]
   }
 }
+
+if (rtc_include_tests) {
+  test("common_video_unittests") {
+    testonly = true
+
+    sources = [
+      "bitrate_adjuster_unittest.cc",
+      "h264/pps_parser_unittest.cc",
+      "h264/sps_parser_unittest.cc",
+      "h264/sps_vui_rewriter_unittest.cc",
+      "i420_buffer_pool_unittest.cc",
+      "i420_video_frame_unittest.cc",
+      "libyuv/libyuv_unittest.cc",
+      "libyuv/scaler_unittest.cc",
+    ]
+
+    configs += [ "..:common_config" ]
+    public_configs = [ "..:common_inherited_config" ]
+
+    # TODO(jschuh): Bug 1348: fix this warning.
+    configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
+
+    if (is_clang) {
+      # Suppress warnings from the Chromium Clang plugin.
+      # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+      configs -= [ "//build/config/clang:find_bad_constructs" ]
+    }
+
+    deps = [
+      ":common_video",
+      "../system_wrappers:system_wrappers",
+      "../test:test_support_main",
+      "../test:video_test_common",
+      "//testing/gmock",
+      "//testing/gtest",
+    ]
+
+    if (is_android) {
+      deps += [ "//testing/android/native_test:native_test_support" ]
+
+      # This needs to be kept in sync with the .isolate file.
+      # TODO(kjellander); Move this to android_assets targets instead.
+      data = [
+        "//resources/foreman_cif.yuv",
+      ]
+    }
+  }
+}