Remove the fileutils hack for good.

Or, well, to be fair it still kind of does the same thing, but
the thing it's (void)ing in is a lot more related to what it
actually happening. I could not find another way to solve this
since fileutils is fundamentally optional to unit tests, but the
flag isn't.

Bug: webrtc:9792
Change-Id: I6ebf012246bc259883bc0aaf73ac7fea5525dd1f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/157101
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29501}
diff --git a/test/BUILD.gn b/test/BUILD.gn
index 96321ee..401ffcf 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -264,12 +264,6 @@
       "//testing/gtest",
       "//third_party/abseil-cpp/absl/flags:flag",
       "//third_party/abseil-cpp/absl/flags:parse",
-
-      # TODO(bugs.webrtc.org/9792): This is needed for downstream projects on
-      # Android, where it's replaced by an internal version of fileutils that
-      # has a certain flag. Remove this once the internal fileutils has been
-      # eliminated.
-      "../test:fileutils",
     ]
   }
 
diff --git a/test/test_main_lib.cc b/test/test_main_lib.cc
index 178eda7..df74182 100644
--- a/test/test_main_lib.cc
+++ b/test/test_main_lib.cc
@@ -27,8 +27,6 @@
 #include "test/field_trial.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
-#include "test/testsupport/file_utils.h"
-#include "test/testsupport/file_utils_override.h"
 #include "test/testsupport/perf_test.h"
 #include "test/testsupport/resources_dir_flag.h"
 
@@ -108,9 +106,10 @@
     ::testing::InitGoogleMock(argc, argv);
     absl::ParseCommandLine(*argc, argv);
 
-    std::string resources_dir = absl::GetFlag(FLAGS_resources_dir);
-    if (!resources_dir.empty())
-      test::internal::OverrideResourcesDir(resources_dir);
+    // Make sure we always pull in the --resources_dir flag, even if the test
+    // binary doesn't link with fileutils (downstream expects all test mains to
+    // have this flag).
+    (void)absl::GetFlag(FLAGS_resources_dir);
 
     // Default to LS_INFO, even for release builds to provide better test
     // logging.
@@ -130,13 +129,6 @@
       rtc::tracing::StartInternalCapture(trace_event_path.c_str());
     }
 
-    // TODO(bugs.webrtc.org/9792): we need to reference something from
-    // fileutils.h so that our downstream hack where we replace fileutils.cc
-    // works. Otherwise the downstream flag implementation will take over and
-    // botch the flag introduced by the hack. Remove this awful thing once the
-    // downstream implementation has been eliminated.
-    (void)webrtc::test::JoinFilename("horrible", "hack");
-
     // InitFieldTrialsFromString stores the char*, so the char array must
     // outlive the application.
     field_trials_ = absl::GetFlag(FLAGS_force_fieldtrials);
diff --git a/test/testsupport/file_utils_override.cc b/test/testsupport/file_utils_override.cc
index 3106d0f..0980691 100644
--- a/test/testsupport/file_utils_override.cc
+++ b/test/testsupport/file_utils_override.cc
@@ -150,12 +150,6 @@
 #endif
 }
 
-void OverrideResourcesDir(const std::string& resources_dir) {
-  RTC_CHECK(false)
-      << "Setting the resource dir is not supported in open-source "
-         "tests.";
-}
-
 }  // namespace internal
 }  // namespace test
 }  // namespace webrtc
diff --git a/test/testsupport/file_utils_override.h b/test/testsupport/file_utils_override.h
index 235c839..8b8484d 100644
--- a/test/testsupport/file_utils_override.h
+++ b/test/testsupport/file_utils_override.h
@@ -48,15 +48,6 @@
 //    extension - File extension, without the dot, i.e. "bmp" or "yuv".
 std::string ResourcePath(const std::string& name, const std::string& extension);
 
-// Overrides the root resource dir. See ResourcePath for more information.
-//
-// This is not necessary in most cases, but it can be if we're running on
-// phones and copy over resources to some custom location.
-//
-// Arguments:
-//    resources_dir - Where resources are located.
-void OverrideResourcesDir(const std::string& resources_dir);
-
 }  // namespace internal
 }  // namespace test
 }  // namespace webrtc