Reland "Extract HasIPv4Enabled/HasIPv6Enabled."

This is a reland of commit 86cfe50c0e3549544ca4a7ec097feac44f0e8437

The fix was to add a backwards compatible #include + build dep.
They will be removed once Chromium is migrated.

Original change's description:
> Extract HasIPv4Enabled/HasIPv6Enabled.
>
> Bug: b/292167110
> Change-Id: Idafa4ef23e87951bdd0276c29dee3e7f8be68476
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/312580
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#40478}

Bug: b/292167110
Change-Id: I9797f52adf15aba57e114d0a1efec0f757ead278
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/313264
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40491}
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 7dd8e9c..ceb16a7 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -879,7 +879,10 @@
     "net_helpers.cc",
     "net_helpers.h",
   ]
-  deps = [ "system:rtc_export" ]
+  deps = [
+    ":net_test_helpers",
+    "system:rtc_export",
+  ]
   if (is_android) {
     deps += [ ":ifaddrs_android" ]
   }
@@ -892,6 +895,26 @@
   absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
 }
 
+rtc_library("net_test_helpers") {
+  # TODO(mbonadei): Enable once net_helpers don't depend
+  # on this target  anymore.
+  # testonly = true
+  sources = [
+    "net_test_helpers.cc",
+    "net_test_helpers.h",
+  ]
+  deps = [ "system:rtc_export" ]
+  if (is_android) {
+    deps += [ ":ifaddrs_android" ]
+  }
+  if (is_win) {
+    deps += [
+      ":win32",
+      "win:windows_version",
+    ]
+  }
+}
+
 rtc_library("async_resolver_interface") {
   visibility = [ "*" ]
   sources = [
@@ -1778,6 +1801,7 @@
         ":logging",
         ":macromagic",
         ":net_helpers",
+        ":net_test_helpers",
         ":null_socket_server",
         ":platform_thread",
         ":rtc_base_tests_utils",
@@ -2043,6 +2067,7 @@
         ":logging",
         ":macromagic",
         ":net_helpers",
+        ":net_test_helpers",
         ":network",
         ":network_route",
         ":null_socket_server",