[Client Hints Fuzzer] Fix file URLs

When building a fuzzer that creates GURL, it turns out that you need to
load the ICU library https://crbug.com/778929. Although all file URLs
are invalid in this context, we should fix the fuzzer rather than trying
to block files so the code flow doesn't have to change.

Bug: 1346176
Change-Id: I7b14ce66bc7101e050d728c9a7f2e31960e5853a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3779839
Auto-Submit: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Eric Orth <ericorth@chromium.org>
Commit-Queue: Eric Orth <ericorth@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1026782}
diff --git a/services/network/public/cpp/BUILD.gn b/services/network/public/cpp/BUILD.gn
index 89052a5..97738fd 100644
--- a/services/network/public/cpp/BUILD.gn
+++ b/services/network/public/cpp/BUILD.gn
@@ -500,5 +500,9 @@
 
 fuzzer_test("client_hints_fuzzer") {
   sources = [ "client_hints_fuzzer.cc" ]
-  deps = [ ":cpp" ]
+  deps = [
+    ":cpp",
+    "//base",
+    "//base:i18n",
+  ]
 }
diff --git a/services/network/public/cpp/client_hints_fuzzer.cc b/services/network/public/cpp/client_hints_fuzzer.cc
index a48aca1..4c47bec 100644
--- a/services/network/public/cpp/client_hints_fuzzer.cc
+++ b/services/network/public/cpp/client_hints_fuzzer.cc
@@ -4,6 +4,15 @@
 
 #include "services/network/public/cpp/client_hints.h"
 
+#include "base/at_exit.h"
+#include "base/i18n/icu_util.h"
+
+// This is a workaround for https://crbug.com/778929.
+struct Environment {
+  Environment() { CHECK(base::i18n::InitializeICU()); }
+  base::AtExitManager at_exit_manager;
+};
+
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   const std::string test_data(reinterpret_cast<const char*>(data), size);
   network::ParseClientHintToDelegatedThirdPartiesHeader(