Reland of Base webrtc fuzzers on a template. (patchset #1 id:1 of https://codereview.webrtc.org/1528043002/ )

Reason for revert:
Found missing public_configs that broke Chromium libfuzzer build.

Original issue's description:
> Revert of Base webrtc fuzzers on a template. (patchset #1 id:1 of https://codereview.webrtc.org/1524993002/ )
>
> Reason for revert:
> Suspect this is breaking the build:
> https://build.chromium.org/p/chromium.fyi/builders/Libfuzzer%20Upload%20Linux/builds/1576/steps/compile/logs/stdio
>
> Original issue's description:
> > Base webrtc fuzzers on a template.
> >
> > Removes noisy dependencies on webrtc_fuzzer_main and removal of
> > find_bad_constructs, removes 1-6 lines of gn per fuzzer target.
> >
> > BUG=webrtc:4771
> > R=kjellander@webrtc.org
> >
> > Committed: https://crrev.com/5ea3da2cbbb0710f9617fb0627c0c4258437b09f
> > Cr-Commit-Position: refs/heads/master@{#11022}
>
> TBR=kjellander@webrtc.org,pbos@webrtc.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4771
>
> Committed: https://crrev.com/5e0218c66e0686dd00719f1e53f844efa94c9f42
> Cr-Commit-Position: refs/heads/master@{#11032}

TBR=kjellander@webrtc.org,tommi@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4771

Review URL: https://codereview.webrtc.org/1522003005 .

Cr-Original-Commit-Position: refs/heads/master@{#11035}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 78315b9813382a98b85294b097aa6a690743abaf
diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn
index 7b530b6..798f99e 100644
--- a/test/fuzzers/BUILD.gn
+++ b/test/fuzzers/BUILD.gn
@@ -7,7 +7,7 @@
 # be found in the AUTHORS file in the root of the source tree.
 
 import("//build/config/features.gni")
-import("//testing/test.gni")
+import("webrtc_fuzzer.gni")
 
 static_library("webrtc_fuzzer_main") {
   public_configs = [ "../..:common_inherited_config" ]
@@ -21,64 +21,42 @@
   ]
 }
 
-test("vp9_depacketizer_fuzzer") {
+webrtc_fuzzer_test("vp9_depacketizer_fuzzer") {
   sources = [
     "vp9_depacketizer_fuzzer.cc",
   ]
   deps = [
-    ":webrtc_fuzzer_main",
     "../../modules/rtp_rtcp",
   ]
-  if (is_clang) {
-    # Suppress warnings from Chrome's Clang plugins.
-    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
-    configs -= [ "//build/config/clang:find_bad_constructs" ]
-  }
 }
 
-test("vp8_qp_parser_fuzzer") {
+webrtc_fuzzer_test("vp8_qp_parser_fuzzer") {
   sources = [
     "vp8_qp_parser_fuzzer.cc",
   ]
   deps = [
-    ":webrtc_fuzzer_main",
     "../../modules/video_coding/",
   ]
-
-  if (is_clang) {
-    # Suppress warnings from Chrome's Clang plugins.
-    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
-    configs -= [ "//build/config/clang:find_bad_constructs" ]
-  }
 }
 
-test("producer_fec_fuzzer") {
+webrtc_fuzzer_test("producer_fec_fuzzer") {
   sources = [
     "producer_fec_fuzzer.cc",
   ]
   deps = [
-    ":webrtc_fuzzer_main",
     "../../modules/rtp_rtcp/",
   ]
-
-  if (is_clang) {
-    # Suppress warnings from Chrome's Clang plugins.
-    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
-    configs -= [ "//build/config/clang:find_bad_constructs" ]
-  }
 }
 
 source_set("audio_decoder_fuzzer") {
+  public_configs = [ "../..:common_inherited_config" ]
   sources = [
     "audio_decoder_fuzzer.cc",
     "audio_decoder_fuzzer.h",
   ]
-  deps = [
-    ":webrtc_fuzzer_main",
-  ]
 }
 
-test("audio_decoder_ilbc_fuzzer") {
+webrtc_fuzzer_test("audio_decoder_ilbc_fuzzer") {
   sources = [
     "audio_decoder_ilbc_fuzzer.cc",
   ]
@@ -88,7 +66,7 @@
   ]
 }
 
-test("audio_decoder_isac_fuzzer") {
+webrtc_fuzzer_test("audio_decoder_isac_fuzzer") {
   sources = [
     "audio_decoder_isac_fuzzer.cc",
   ]
@@ -98,7 +76,7 @@
   ]
 }
 
-test("audio_decoder_isacfix_fuzzer") {
+webrtc_fuzzer_test("audio_decoder_isacfix_fuzzer") {
   sources = [
     "audio_decoder_isacfix_fuzzer.cc",
   ]
@@ -108,7 +86,7 @@
   ]
 }
 
-test("audio_decoder_opus_fuzzer") {
+webrtc_fuzzer_test("audio_decoder_opus_fuzzer") {
   sources = [
     "audio_decoder_opus_fuzzer.cc",
   ]
diff --git a/test/fuzzers/webrtc_fuzzer.gni b/test/fuzzers/webrtc_fuzzer.gni
new file mode 100644
index 0000000..d264392
--- /dev/null
+++ b/test/fuzzers/webrtc_fuzzer.gni
@@ -0,0 +1,28 @@
+# Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS.  All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+import("//testing/test.gni")
+
+template("webrtc_fuzzer_test") {
+  assert(defined(invoker.sources), "Need sources in $target_name.")
+
+  test(target_name) {
+    forward_variables_from(invoker, [ "sources" ])
+    deps = [
+      ":webrtc_fuzzer_main",
+    ]
+    if (defined(invoker.deps)) {
+      deps += invoker.deps
+    }
+    if (is_clang) {
+      # Suppress warnings from Chrome's Clang plugins.
+      # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+      configs -= [ "//build/config/clang:find_bad_constructs" ]
+    }
+  }
+}