Don't have test library depending on audio_processing_unittests.

Extract a echo_canceller_test_tools build target instead of depending on
audio_processing_unittests.

Change-Id: I4fa133ed3d90d0a2a62205814c543897ddb3f8e5
Bug: webrtc:498394143
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/491040
Commit-Queue: Jeremy Leconte <jleconte@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#48223}
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index 8fa3f9b..217aa21 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -407,6 +407,7 @@
           ":audioproc_protobuf_utils",
           ":audioproc_test_utils",
           ":audioproc_unittest_proto",
+          ":echo_canceller_test_tools",
           ":residual_echo_detector",
           ":rms_level",
           ":runtime_settings_protobuf_utils",
@@ -436,8 +437,6 @@
           "test/debug_dump_replayer.cc",
           "test/debug_dump_replayer.h",
           "test/debug_dump_test.cc",
-          "test/echo_canceller_test_tools.cc",
-          "test/echo_canceller_test_tools.h",
           "test/echo_canceller_test_tools_unittest.cc",
           "test/echo_control_mock.h",
         ]
@@ -628,3 +627,16 @@
     "//third_party/abseil-cpp/absl/strings:string_view",
   ]
 }
+
+rtc_library("echo_canceller_test_tools") {
+  visibility = [ "*" ]
+  testonly = true
+  sources = [
+    "test/echo_canceller_test_tools.cc",
+    "test/echo_canceller_test_tools.h",
+  ]
+  deps = [
+    "../../rtc_base:checks",
+    "../../rtc_base:random",
+  ]
+}
diff --git a/modules/audio_processing/aec3/BUILD.gn b/modules/audio_processing/aec3/BUILD.gn
index 9ea55f1..5f7e2ac 100644
--- a/modules/audio_processing/aec3/BUILD.gn
+++ b/modules/audio_processing/aec3/BUILD.gn
@@ -311,6 +311,7 @@
       ":vector_math",
       "..:apm_logging",
       "..:audio_buffer",
+      "..:echo_canceller_test_tools",
       "..:high_pass_filter",
       "../../../api:field_trials",
       "../../../api/audio:aec3_config",
@@ -379,8 +380,5 @@
         "vector_math_unittest.cc",
       ]
     }
-    if (!build_with_chromium) {
-      deps += [ "..:audio_processing_unittests" ]
-    }
   }
 }
diff --git a/modules/audio_processing/aec3/neural_residual_echo_estimator/BUILD.gn b/modules/audio_processing/aec3/neural_residual_echo_estimator/BUILD.gn
index c33bd39..6d828c9 100644
--- a/modules/audio_processing/aec3/neural_residual_echo_estimator/BUILD.gn
+++ b/modules/audio_processing/aec3/neural_residual_echo_estimator/BUILD.gn
@@ -103,6 +103,7 @@
         ":neural_residual_echo_estimator_proto",
         "..:aec3_block",
         "..:aec3_common",
+        "../..:echo_canceller_test_tools",
         "../../../../rtc_base:checks",
         "../../../../rtc_base:random",
         "../../../../test:fileutils",
@@ -117,7 +118,6 @@
         ]
       } else {
         deps += [
-          "../..:audio_processing_unittests",
           "//third_party/tflite:tflite_builtin_op_resolver_standalone",
           "//third_party/tflite:tflite_standalone",
         ]
diff --git a/modules/audio_processing/ns/BUILD.gn b/modules/audio_processing/ns/BUILD.gn
index 6324ed2..3b8c396 100644
--- a/modules/audio_processing/ns/BUILD.gn
+++ b/modules/audio_processing/ns/BUILD.gn
@@ -74,9 +74,5 @@
     if (rtc_enable_protobuf) {
       sources += []
     }
-
-    if (!build_with_chromium) {
-      deps += [ "..:audio_processing_unittests" ]
-    }
   }
 }