Extract functionality of test_main into separate library.

Extract functionality of test_main into separate library to be able to
reuse it if another main will be required.

Bug: webrtc:5996
Change-Id: I2925b4240bd0e4fb884b43bb16667ca2d6216bbd
Reviewed-on: https://webrtc-review.googlesource.com/c/105921
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25172}
diff --git a/test/BUILD.gn b/test/BUILD.gn
index b38e215..8602bbf 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -196,19 +196,18 @@
 }
 
 if (rtc_include_tests) {
-  rtc_source_set("test_main") {
+  rtc_source_set("test_main_lib") {
     visibility = [ "*" ]
     testonly = true
     sources = [
-      "test_main.cc",
+      "test_main_lib.cc",
+      "test_main_lib.h",
     ]
 
-    public_deps = [
-      ":test_support",
-    ]
     deps = [
       ":field_trial",
       ":perf_test",
+      ":test_support",
       "../rtc_base:rtc_base",
       "../system_wrappers:field_trial",
       "../system_wrappers:metrics",
@@ -222,6 +221,18 @@
     ]
   }
 
+  rtc_source_set("test_main") {
+    visibility = [ "*" ]
+    testonly = true
+    sources = [
+      "test_main.cc",
+    ]
+
+    deps = [
+      ":test_main_lib",
+    ]
+  }
+
   rtc_source_set("video_test_support") {
     testonly = true