Update gn files to support Mozilla build

Bug: webrtc:8670
No-Presubmit: true
Change-Id: I085dc63daa8274b5068540cbf56b6330f40643fa
Reviewed-on: https://webrtc-review.googlesource.com/38920
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21624}
diff --git a/webrtc.gni b/webrtc.gni
index ae68318..fb1d77c 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -5,14 +5,12 @@
 # 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("//build/config/arm.gni")
 import("//build/config/features.gni")
 import("//build/config/mips.gni")
 import("//build/config/sanitizers/sanitizers.gni")
 import("//build/config/ui.gni")
 import("//build_overrides/build.gni")
-import("//testing/test.gni")
 
 if (!build_with_chromium && is_component_build) {
   print("The Gn argument `is_component_build` is currently " +
@@ -57,9 +55,6 @@
   # Selects fixed-point code where possible.
   rtc_prefer_fixed_point = false
 
-  # Enables the use of protocol buffers for debug recordings.
-  rtc_enable_protobuf = true
-
   # Disable the code for the intelligibility enhancer by default.
   rtc_enable_intelligibility_enhancer = false
 
@@ -74,9 +69,6 @@
   # Set this to true to enable BWE test logging.
   rtc_enable_bwe_test_logging = false
 
-  # Set this to disable building with support for SCTP data channels.
-  rtc_enable_sctp = true
-
   # Set this to false to skip building examples.
   rtc_build_examples = true
 
@@ -86,16 +78,6 @@
   # Set this to false to skip building code that requires X11.
   rtc_use_x11 = use_x11
 
-  # Disable these to not build components which can be externally provided.
-  rtc_build_json = true
-  rtc_build_libsrtp = true
-  rtc_build_libvpx = true
-  rtc_libvpx_build_vp9 = true
-  rtc_build_openmax_dl = true
-  rtc_build_opus = true
-  rtc_build_ssl = true
-  rtc_build_usrsctp = true
-
   # Enable to use the Mozilla internal settings.
   build_with_mozilla = false
 
@@ -118,28 +100,10 @@
   # use an external implementation.
   rtc_link_task_queue_impl = true
 
-  # Enable libevent task queues on platforms that support it.
-  # rtc_link_task_queue_impl must be set to true for this to
-  # have an effect.
-  if (is_win || is_mac || is_ios || is_nacl) {
-    rtc_enable_libevent = false
-    rtc_build_libevent = false
-  } else {
-    rtc_enable_libevent = true
-    rtc_build_libevent = true
-  }
-
   if (current_cpu == "arm" || current_cpu == "arm64") {
     rtc_prefer_fixed_point = true
   }
 
-  if (!is_ios && (current_cpu != "arm" || arm_version >= 7) &&
-      current_cpu != "mips64el") {
-    rtc_use_openmax_dl = true
-  } else {
-    rtc_use_openmax_dl = false
-  }
-
   # Determines whether NEON code will be built.
   rtc_build_with_neon =
       (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
@@ -175,17 +139,55 @@
   # as Chromium, must turn this flag off so that WebRTC does not also
   # initialize.
   rtc_initialize_ffmpeg = !build_with_chromium
+}
 
-  # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
-  # build environments, even if available for Chromium builds.
-  rtc_use_gtk = !build_with_chromium
+if (!build_with_mozilla) {
+  import("//testing/test.gni")
 }
 
 # A second declare_args block, so that declarations within it can
 # depend on the possibly overridden variables in the first
 # declare_args block.
 declare_args() {
-  rtc_restrict_logging = build_with_chromium
+  # Enables the use of protocol buffers for debug recordings.
+  rtc_enable_protobuf = !build_with_mozilla
+
+  # Set this to disable building with support for SCTP data channels.
+  rtc_enable_sctp = !build_with_mozilla
+
+  # Disable these to not build components which can be externally provided.
+  rtc_build_json = !build_with_mozilla
+  rtc_build_libsrtp = !build_with_mozilla
+  rtc_build_libvpx = !build_with_mozilla
+  rtc_libvpx_build_vp9 = !build_with_mozilla
+  rtc_build_openmax_dl = !build_with_mozilla
+  rtc_build_opus = !build_with_mozilla
+  rtc_build_ssl = !build_with_mozilla
+  rtc_build_usrsctp = !build_with_mozilla
+
+  # Enable libevent task queues on platforms that support it.
+  # rtc_link_task_queue_impl must be set to true for this to
+  # have an effect.
+  if (is_win || is_mac || is_ios || is_nacl) {
+    rtc_enable_libevent = false
+    rtc_build_libevent = false
+  } else {
+    rtc_enable_libevent = true
+    rtc_build_libevent = !build_with_mozilla
+  }
+
+  if (!is_ios && (current_cpu != "arm" || arm_version >= 7) &&
+      current_cpu != "mips64el" && !build_with_mozilla) {
+    rtc_use_openmax_dl = true
+  } else {
+    rtc_use_openmax_dl = false
+  }
+
+  # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
+  # build environments, even if available for Chromium builds.
+  rtc_use_gtk = !build_with_chromium && !build_with_mozilla
+
+  rtc_restrict_logging = build_with_chromium || build_with_mozilla
 
   # Excluded in Chromium since its prerequisites don't require Pulse Audio.
   rtc_include_pulse_audio = !build_with_chromium
@@ -195,7 +197,7 @@
   rtc_include_internal_audio_device = !build_with_chromium
 
   # Include tests in standalone checkout.
-  rtc_include_tests = !build_with_chromium
+  rtc_include_tests = !build_with_chromium && !build_with_mozilla
 }
 
 # Make it possible to provide custom locations for some libraries (move these