Move a bunch of code out of testing/test_support.h.

They should either go into testing/utils/file_util.h,
testing/free_deleter.h, or testing/fx_string_testhelpers.h.
Then do IWYU and remove all the unnecessary test_support.h includes.

Change-Id: Idae09a08b96e2bc0b95ac1820ff305cdfa3f4e1a
Reviewed-on: https://pdfium-review.googlesource.com/c/49930
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp b/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp
index 1f8f788..b60b663 100644
--- a/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp
+++ b/core/fpdfapi/edit/cpdf_creator_embeddertest.cpp
@@ -16,6 +16,7 @@
 #include "testing/fake_file_access.h"
 #include "testing/gmock/include/gmock/gmock-matchers.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "testing/utils/file_util.h"
 #include "testing/utils/path_service.h"
 
 namespace {
diff --git a/fpdfsdk/fpdf_annot_embeddertest.cpp b/fpdfsdk/fpdf_annot_embeddertest.cpp
index b2ae719..185974b 100644
--- a/fpdfsdk/fpdf_annot_embeddertest.cpp
+++ b/fpdfsdk/fpdf_annot_embeddertest.cpp
@@ -15,6 +15,7 @@
 #include "public/fpdf_edit.h"
 #include "public/fpdfview.h"
 #include "testing/embedder_test.h"
+#include "testing/fx_string_testhelpers.h"
 #include "testing/gmock/include/gmock/gmock-matchers.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/fpdfsdk/fpdf_attachment_embeddertest.cpp b/fpdfsdk/fpdf_attachment_embeddertest.cpp
index 6ab82f8..f2fd769 100644
--- a/fpdfsdk/fpdf_attachment_embeddertest.cpp
+++ b/fpdfsdk/fpdf_attachment_embeddertest.cpp
@@ -9,6 +9,7 @@
 #include "public/fpdf_attachment.h"
 #include "public/fpdfview.h"
 #include "testing/embedder_test.h"
+#include "testing/fx_string_testhelpers.h"
 #include "testing/utils/hash.h"
 
 static constexpr char kDateKey[] = "CreationDate";
diff --git a/fpdfsdk/fpdf_dataavail_embeddertest.cpp b/fpdfsdk/fpdf_dataavail_embeddertest.cpp
index 58b989c..137c5c9 100644
--- a/fpdfsdk/fpdf_dataavail_embeddertest.cpp
+++ b/fpdfsdk/fpdf_dataavail_embeddertest.cpp
@@ -15,7 +15,7 @@
 #include "testing/embedder_test.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/range_set.h"
-#include "testing/test_support.h"
+#include "testing/utils/file_util.h"
 #include "testing/utils/path_service.h"
 
 namespace {
diff --git a/fpdfsdk/fpdf_doc_embeddertest.cpp b/fpdfsdk/fpdf_doc_embeddertest.cpp
index c4a154c..33f119a 100644
--- a/fpdfsdk/fpdf_doc_embeddertest.cpp
+++ b/fpdfsdk/fpdf_doc_embeddertest.cpp
@@ -15,8 +15,8 @@
 #include "public/fpdf_edit.h"
 #include "public/fpdfview.h"
 #include "testing/embedder_test.h"
+#include "testing/fx_string_testhelpers.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/test_support.h"
 
 class FPDFDocEmbedderTest : public EmbedderTest {};
 
diff --git a/fpdfsdk/fpdf_doc_unittest.cpp b/fpdfsdk/fpdf_doc_unittest.cpp
index 929c2a5..feabeb3 100644
--- a/fpdfsdk/fpdf_doc_unittest.cpp
+++ b/fpdfsdk/fpdf_doc_unittest.cpp
@@ -20,8 +20,8 @@
 #include "core/fpdfdoc/cpdf_dest.h"
 #include "fpdfsdk/cpdfsdk_helpers.h"
 #include "public/cpp/fpdf_scopers.h"
+#include "testing/fx_string_testhelpers.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/test_support.h"
 #include "third_party/base/ptr_util.h"
 
 class CPDF_TestDocument final : public CPDF_Document {
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index 895b9fe..11da769 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -23,9 +23,9 @@
 #include "public/fpdf_edit.h"
 #include "public/fpdfview.h"
 #include "testing/embedder_test.h"
+#include "testing/fx_string_testhelpers.h"
 #include "testing/gmock/include/gmock/gmock-matchers.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/test_support.h"
 #include "testing/utils/hash.h"
 
 class FPDFEditEmbedderTest : public EmbedderTest {
@@ -2230,7 +2230,8 @@
   const CPDF_Dictionary* font_dict = typed_font->GetFontDict();
   EXPECT_EQ("Font", font_dict->GetStringFor("Type"));
   EXPECT_EQ("Type0", font_dict->GetStringFor("Subtype"));
-  EXPECT_EQ("TimesNewRomanPSMT-Identity-H", font_dict->GetStringFor("BaseFont"));
+  EXPECT_EQ("TimesNewRomanPSMT-Identity-H",
+            font_dict->GetStringFor("BaseFont"));
   EXPECT_EQ("Identity-H", font_dict->GetStringFor("Encoding"));
   const CPDF_Array* descendant_array =
       font_dict->GetArrayFor("DescendantFonts");
diff --git a/fpdfsdk/fpdf_text_embeddertest.cpp b/fpdfsdk/fpdf_text_embeddertest.cpp
index 4b3bcc5..c5a99d3 100644
--- a/fpdfsdk/fpdf_text_embeddertest.cpp
+++ b/fpdfsdk/fpdf_text_embeddertest.cpp
@@ -14,8 +14,8 @@
 #include "public/fpdf_transformpage.h"
 #include "public/fpdfview.h"
 #include "testing/embedder_test.h"
+#include "testing/fx_string_testhelpers.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/test_support.h"
 
 namespace {
 
diff --git a/fpdfsdk/fpdf_view_embeddertest.cpp b/fpdfsdk/fpdf_view_embeddertest.cpp
index 5b6be41..5551edc 100644
--- a/fpdfsdk/fpdf_view_embeddertest.cpp
+++ b/fpdfsdk/fpdf_view_embeddertest.cpp
@@ -14,6 +14,7 @@
 #include "public/fpdfview.h"
 #include "testing/embedder_test.h"
 #include "testing/gtest/include/gtest/gtest.h"
+#include "testing/utils/file_util.h"
 #include "testing/utils/path_service.h"
 
 namespace {
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index c536bc8..c7e49c6 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -32,8 +32,9 @@
 #include "samples/pdfium_test_dump_helper.h"
 #include "samples/pdfium_test_event_helper.h"
 #include "samples/pdfium_test_write_helper.h"
+#include "testing/fx_string_testhelpers.h"
 #include "testing/test_loader.h"
-#include "testing/test_support.h"
+#include "testing/utils/file_util.h"
 #include "testing/utils/hash.h"
 #include "testing/utils/path_service.h"
 #include "third_party/base/logging.h"
diff --git a/samples/pdfium_test_dump_helper.cc b/samples/pdfium_test_dump_helper.cc
index 93a184a..46e4b27 100644
--- a/samples/pdfium_test_dump_helper.cc
+++ b/samples/pdfium_test_dump_helper.cc
@@ -14,7 +14,7 @@
 
 #include "public/cpp/fpdf_scopers.h"
 #include "public/fpdf_transformpage.h"
-#include "testing/test_support.h"
+#include "testing/fx_string_testhelpers.h"
 
 using GetBoxInfoFunc =
     std::function<bool(FPDF_PAGE, float*, float*, float*, float*)>;
diff --git a/samples/pdfium_test_event_helper.cc b/samples/pdfium_test_event_helper.cc
index 303feee..1db9a8c 100644
--- a/samples/pdfium_test_event_helper.cc
+++ b/samples/pdfium_test_event_helper.cc
@@ -11,7 +11,7 @@
 
 #include "public/fpdf_fwlevent.h"
 #include "public/fpdfview.h"
-#include "testing/test_support.h"
+#include "testing/fx_string_testhelpers.h"
 
 namespace {
 void SendCharCodeEvent(FPDF_FORMHANDLE form,
diff --git a/samples/pdfium_test_write_helper.cc b/samples/pdfium_test_write_helper.cc
index c436c97..fb783b9 100644
--- a/samples/pdfium_test_write_helper.cc
+++ b/samples/pdfium_test_write_helper.cc
@@ -13,8 +13,8 @@
 #include "public/fpdf_annot.h"
 #include "public/fpdf_attachment.h"
 #include "public/fpdf_edit.h"
+#include "testing/fx_string_testhelpers.h"
 #include "testing/image_diff/image_diff_png.h"
-#include "testing/test_support.h"
 #include "third_party/base/logging.h"
 
 namespace {
diff --git a/testing/BUILD.gn b/testing/BUILD.gn
index 6d582c2..a0531de 100644
--- a/testing/BUILD.gn
+++ b/testing/BUILD.gn
@@ -17,10 +17,11 @@
     "string_write_stream.h",
     "test_loader.cpp",
     "test_loader.h",
-    "test_support.cpp",
     "test_support.h",
     "utils/bitmap_saver.cpp",
     "utils/bitmap_saver.h",
+    "utils/file_util.cpp",
+    "utils/file_util.h",
     "utils/hash.cpp",
     "utils/hash.h",
     "utils/path_service.cpp",
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index febd4f2..13a3306 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -20,8 +20,8 @@
 #include "public/fpdfview.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/test_loader.h"
-#include "testing/test_support.h"
 #include "testing/utils/bitmap_saver.h"
+#include "testing/utils/file_util.h"
 #include "testing/utils/hash.h"
 #include "testing/utils/path_service.h"
 #include "third_party/base/logging.h"
diff --git a/testing/embedder_test.h b/testing/embedder_test.h
index ce19b88..8f094c2 100644
--- a/testing/embedder_test.h
+++ b/testing/embedder_test.h
@@ -17,8 +17,8 @@
 #include "public/fpdf_save.h"
 #include "public/fpdfview.h"
 #include "testing/fake_file_access.h"
+#include "testing/free_deleter.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/test_support.h"
 
 class TestLoader;
 
diff --git a/testing/embedder_test_timer_handling_delegate.h b/testing/embedder_test_timer_handling_delegate.h
index 34b4cbb..a32ad20 100644
--- a/testing/embedder_test_timer_handling_delegate.h
+++ b/testing/embedder_test_timer_handling_delegate.h
@@ -11,7 +11,7 @@
 #include <vector>
 
 #include "testing/embedder_test.h"
-#include "testing/test_support.h"
+#include "testing/fx_string_testhelpers.h"
 
 class EmbedderTestTimerHandlingDelegate final : public EmbedderTest::Delegate {
  public:
diff --git a/testing/free_deleter.h b/testing/free_deleter.h
new file mode 100644
index 0000000..58f40da
--- /dev/null
+++ b/testing/free_deleter.h
@@ -0,0 +1,19 @@
+// Copyright 2019 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TESTING_FREE_DELETER_H_
+#define TESTING_FREE_DELETER_H_
+
+#include <stdlib.h>
+
+namespace pdfium {
+
+// Used with std::unique_ptr to free() objects that can't be deleted.
+struct FreeDeleter {
+  inline void operator()(void* ptr) const { free(ptr); }
+};
+
+}  // namespace pdfium
+
+#endif  // TESTING_FREE_DELETER_H_
diff --git a/testing/fuzzers/pdfium_fuzzer_helper.cc b/testing/fuzzers/pdfium_fuzzer_helper.cc
index 75dc7dd..bc5bbe2 100644
--- a/testing/fuzzers/pdfium_fuzzer_helper.cc
+++ b/testing/fuzzers/pdfium_fuzzer_helper.cc
@@ -31,9 +31,9 @@
 #include "public/fpdf_ext.h"
 #include "public/fpdf_text.h"
 #include "testing/test_loader.h"
-#include "testing/test_support.h"
 
 #ifdef PDF_ENABLE_V8
+#include "testing/free_deleter.h"
 #include "testing/v8_initializer.h"
 #include "v8/include/v8-platform.h"
 #include "v8/include/v8.h"
diff --git a/testing/fx_string_testhelpers.cpp b/testing/fx_string_testhelpers.cpp
index 443cc89..d8e9661 100644
--- a/testing/fx_string_testhelpers.cpp
+++ b/testing/fx_string_testhelpers.cpp
@@ -6,7 +6,8 @@
 
 #include <iomanip>
 #include <ios>
-#include <string>
+
+#include "core/fxcrt/fx_string.h"
 
 std::ostream& operator<<(std::ostream& os, const CFX_DateTime& dt) {
   os << dt.GetYear() << "-" << std::to_string(dt.GetMonth()) << "-"
@@ -16,3 +17,56 @@
      << std::to_string(dt.GetMillisecond());
   return os;
 }
+
+std::vector<std::string> StringSplit(const std::string& str, char delimiter) {
+  std::vector<std::string> result;
+  size_t pos = 0;
+  while (1) {
+    size_t found = str.find(delimiter, pos);
+    if (found == std::string::npos)
+      break;
+
+    result.push_back(str.substr(pos, found - pos));
+    pos = found + 1;
+  }
+  result.push_back(str.substr(pos));
+  return result;
+}
+
+std::string GetPlatformString(FPDF_WIDESTRING wstr) {
+  WideString wide_string =
+      WideString::FromUTF16LE(wstr, WideString::WStringLength(wstr));
+  return std::string(wide_string.ToUTF8().c_str());
+}
+
+std::wstring GetPlatformWString(FPDF_WIDESTRING wstr) {
+  if (!wstr)
+    return nullptr;
+
+  size_t characters = 0;
+  while (wstr[characters])
+    ++characters;
+
+  std::wstring platform_string(characters, L'\0');
+  for (size_t i = 0; i < characters + 1; ++i) {
+    const unsigned char* ptr = reinterpret_cast<const unsigned char*>(&wstr[i]);
+    platform_string[i] = ptr[0] + 256 * ptr[1];
+  }
+  return platform_string;
+}
+
+std::unique_ptr<unsigned short, pdfium::FreeDeleter> GetFPDFWideString(
+    const std::wstring& wstr) {
+  size_t length = sizeof(uint16_t) * (wstr.length() + 1);
+  std::unique_ptr<unsigned short, pdfium::FreeDeleter> result(
+      static_cast<unsigned short*>(malloc(length)));
+  char* ptr = reinterpret_cast<char*>(result.get());
+  size_t i = 0;
+  for (wchar_t w : wstr) {
+    ptr[i++] = w & 0xff;
+    ptr[i++] = (w >> 8) & 0xff;
+  }
+  ptr[i++] = 0;
+  ptr[i] = 0;
+  return result;
+}
diff --git a/testing/fx_string_testhelpers.h b/testing/fx_string_testhelpers.h
index 34ac69d..9f3f759 100644
--- a/testing/fx_string_testhelpers.h
+++ b/testing/fx_string_testhelpers.h
@@ -5,11 +5,31 @@
 #ifndef TESTING_FX_STRING_TESTHELPERS_H_
 #define TESTING_FX_STRING_TESTHELPERS_H_
 
+#include <memory>
 #include <ostream>
+#include <string>
+#include <vector>
 
 #include "core/fxcrt/cfx_datetime.h"
+#include "public/fpdfview.h"
+#include "testing/free_deleter.h"
 
 // Output stream operator so GTEST macros work with CFX_DateTime objects.
 std::ostream& operator<<(std::ostream& os, const CFX_DateTime& dt);
 
+std::vector<std::string> StringSplit(const std::string& str, char delimiter);
+
+// Converts a FPDF_WIDESTRING to a std::string.
+// Deals with differences between UTF16LE and UTF8.
+std::string GetPlatformString(FPDF_WIDESTRING wstr);
+
+// Converts a FPDF_WIDESTRING to a std::wstring.
+// Deals with differences between UTF16LE and wchar_t.
+std::wstring GetPlatformWString(FPDF_WIDESTRING wstr);
+
+// Returns a newly allocated FPDF_WIDESTRING.
+// Deals with differences between UTF16LE and wchar_t.
+std::unique_ptr<unsigned short, pdfium::FreeDeleter> GetFPDFWideString(
+    const std::wstring& wstr);
+
 #endif  // TESTING_FX_STRING_TESTHELPERS_H_
diff --git a/testing/test_support.cpp b/testing/test_support.cpp
deleted file mode 100644
index 2bc83b3..0000000
--- a/testing/test_support.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2015 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "testing/test_support.h"
-
-#include <stdio.h>
-
-#include "core/fxcrt/fx_string.h"
-
-std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename,
-                                                           size_t* retlen) {
-  FILE* file = fopen(filename, "rb");
-  if (!file) {
-    fprintf(stderr, "Failed to open: %s\n", filename);
-    return nullptr;
-  }
-  (void)fseek(file, 0, SEEK_END);
-  size_t file_length = ftell(file);
-  if (!file_length) {
-    return nullptr;
-  }
-  (void)fseek(file, 0, SEEK_SET);
-  std::unique_ptr<char, pdfium::FreeDeleter> buffer(
-      static_cast<char*>(malloc(file_length)));
-  if (!buffer) {
-    return nullptr;
-  }
-  size_t bytes_read = fread(buffer.get(), 1, file_length, file);
-  (void)fclose(file);
-  if (bytes_read != file_length) {
-    fprintf(stderr, "Failed to read: %s\n", filename);
-    return nullptr;
-  }
-  *retlen = bytes_read;
-  return buffer;
-}
-
-std::string GetPlatformString(FPDF_WIDESTRING wstr) {
-  WideString wide_string =
-      WideString::FromUTF16LE(wstr, WideString::WStringLength(wstr));
-  return std::string(wide_string.ToUTF8().c_str());
-}
-
-std::wstring GetPlatformWString(FPDF_WIDESTRING wstr) {
-  if (!wstr)
-    return nullptr;
-
-  size_t characters = 0;
-  while (wstr[characters])
-    ++characters;
-
-  std::wstring platform_string(characters, L'\0');
-  for (size_t i = 0; i < characters + 1; ++i) {
-    const unsigned char* ptr = reinterpret_cast<const unsigned char*>(&wstr[i]);
-    platform_string[i] = ptr[0] + 256 * ptr[1];
-  }
-  return platform_string;
-}
-
-std::vector<std::string> StringSplit(const std::string& str, char delimiter) {
-  std::vector<std::string> result;
-  size_t pos = 0;
-  while (1) {
-    size_t found = str.find(delimiter, pos);
-    if (found == std::string::npos)
-      break;
-
-    result.push_back(str.substr(pos, found - pos));
-    pos = found + 1;
-  }
-  result.push_back(str.substr(pos));
-  return result;
-}
-
-std::unique_ptr<unsigned short, pdfium::FreeDeleter> GetFPDFWideString(
-    const std::wstring& wstr) {
-  size_t length = sizeof(uint16_t) * (wstr.length() + 1);
-  std::unique_ptr<unsigned short, pdfium::FreeDeleter> result(
-      static_cast<unsigned short*>(malloc(length)));
-  char* ptr = reinterpret_cast<char*>(result.get());
-  size_t i = 0;
-  for (wchar_t w : wstr) {
-    ptr[i++] = w & 0xff;
-    ptr[i++] = (w >> 8) & 0xff;
-  }
-  ptr[i++] = 0;
-  ptr[i] = 0;
-  return result;
-}
diff --git a/testing/test_support.h b/testing/test_support.h
index a033e75..f257787 100644
--- a/testing/test_support.h
+++ b/testing/test_support.h
@@ -5,14 +5,6 @@
 #ifndef TESTING_TEST_SUPPORT_H_
 #define TESTING_TEST_SUPPORT_H_
 
-#include <stdlib.h>
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "public/fpdfview.h"
-
 namespace pdfium {
 
 #define STR_IN_TEST_CASE(input_literal, ...)               \
@@ -50,30 +42,6 @@
   const wchar_t* expected;
 };
 
-// Used with std::unique_ptr to free() objects that can't be deleted.
-struct FreeDeleter {
-  inline void operator()(void* ptr) const { free(ptr); }
-};
-
 }  // namespace pdfium
 
-// Reads the entire contents of a file into a newly alloc'd buffer.
-std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename,
-                                                           size_t* retlen);
-
-std::vector<std::string> StringSplit(const std::string& str, char delimiter);
-
-// Converts a FPDF_WIDESTRING to a std::string.
-// Deals with differences between UTF16LE and UTF8.
-std::string GetPlatformString(FPDF_WIDESTRING wstr);
-
-// Converts a FPDF_WIDESTRING to a std::wstring.
-// Deals with differences between UTF16LE and wchar_t.
-std::wstring GetPlatformWString(FPDF_WIDESTRING wstr);
-
-// Returns a newly allocated FPDF_WIDESTRING.
-// Deals with differences between UTF16LE and wchar_t.
-std::unique_ptr<unsigned short, pdfium::FreeDeleter> GetFPDFWideString(
-    const std::wstring& wstr);
-
 #endif  // TESTING_TEST_SUPPORT_H_
diff --git a/testing/utils/file_util.cpp b/testing/utils/file_util.cpp
new file mode 100644
index 0000000..b239e20
--- /dev/null
+++ b/testing/utils/file_util.cpp
@@ -0,0 +1,35 @@
+// Copyright 2019 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "testing/utils/file_util.h"
+
+#include <stdio.h>
+
+std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename,
+                                                           size_t* retlen) {
+  FILE* file = fopen(filename, "rb");
+  if (!file) {
+    fprintf(stderr, "Failed to open: %s\n", filename);
+    return nullptr;
+  }
+  (void)fseek(file, 0, SEEK_END);
+  size_t file_length = ftell(file);
+  if (!file_length) {
+    return nullptr;
+  }
+  (void)fseek(file, 0, SEEK_SET);
+  std::unique_ptr<char, pdfium::FreeDeleter> buffer(
+      static_cast<char*>(malloc(file_length)));
+  if (!buffer) {
+    return nullptr;
+  }
+  size_t bytes_read = fread(buffer.get(), 1, file_length, file);
+  (void)fclose(file);
+  if (bytes_read != file_length) {
+    fprintf(stderr, "Failed to read: %s\n", filename);
+    return nullptr;
+  }
+  *retlen = bytes_read;
+  return buffer;
+}
diff --git a/testing/utils/file_util.h b/testing/utils/file_util.h
new file mode 100644
index 0000000..21b911a
--- /dev/null
+++ b/testing/utils/file_util.h
@@ -0,0 +1,18 @@
+// Copyright 2019 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TESTING_UTILS_FILE_UTIL_H_
+#define TESTING_UTILS_FILE_UTIL_H_
+
+#include <stdlib.h>
+
+#include <memory>
+
+#include "testing/free_deleter.h"
+
+// Reads the entire contents of a file into a newly alloc'd buffer.
+std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename,
+                                                           size_t* retlen);
+
+#endif  // TESTING_UTILS_FILE_UTIL_H_
diff --git a/testing/v8_initializer.cpp b/testing/v8_initializer.cpp
index 548be03..49ef257 100644
--- a/testing/v8_initializer.cpp
+++ b/testing/v8_initializer.cpp
@@ -4,7 +4,8 @@
 
 #include "testing/v8_initializer.h"
 
-#include "testing/test_support.h"
+#include "public/fpdfview.h"
+#include "testing/utils/file_util.h"
 #include "testing/utils/path_service.h"
 #include "v8/include/libplatform/libplatform.h"
 #include "v8/include/v8.h"