Move TestLoader into testing/test_loader.h.

Change-Id: Ifb3bfcf574fe3a2ee34946172850b19aa0534a39
Reviewed-on: https://pdfium-review.googlesource.com/c/49911
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 091d08a..69f5118 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -32,6 +32,7 @@
 #include "samples/pdfium_test_dump_helper.h"
 #include "samples/pdfium_test_event_helper.h"
 #include "samples/pdfium_test_write_helper.h"
+#include "testing/test_loader.h"
 #include "testing/test_support.h"
 #include "testing/utils/hash.h"
 #include "testing/utils/path_service.h"
diff --git a/testing/BUILD.gn b/testing/BUILD.gn
index f659121..2c51468 100644
--- a/testing/BUILD.gn
+++ b/testing/BUILD.gn
@@ -15,6 +15,8 @@
     "pseudo_retainable.h",
     "string_write_stream.cpp",
     "string_write_stream.h",
+    "test_loader.cpp",
+    "test_loader.h",
     "test_support.cpp",
     "test_support.h",
     "utils/bitmap_saver.cpp",
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index bcdd41a..cdc10aa 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -19,6 +19,7 @@
 #include "public/fpdf_text.h"
 #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/hash.h"
diff --git a/testing/fuzzers/pdfium_fuzzer_helper.cc b/testing/fuzzers/pdfium_fuzzer_helper.cc
index d2ed52a..f128d8a 100644
--- a/testing/fuzzers/pdfium_fuzzer_helper.cc
+++ b/testing/fuzzers/pdfium_fuzzer_helper.cc
@@ -30,6 +30,7 @@
 #include "public/fpdf_dataavail.h"
 #include "public/fpdf_ext.h"
 #include "public/fpdf_text.h"
+#include "testing/test_loader.h"
 #include "testing/test_support.h"
 
 #ifdef PDF_ENABLE_V8
diff --git a/testing/test_loader.cpp b/testing/test_loader.cpp
new file mode 100644
index 0000000..0bc5153
--- /dev/null
+++ b/testing/test_loader.cpp
@@ -0,0 +1,27 @@
+// 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/test_loader.h"
+
+#include <string.h>
+
+#include "third_party/base/logging.h"
+
+TestLoader::TestLoader(const char* pBuf, size_t len)
+    : m_pBuf(pBuf), m_Len(len) {}
+
+// static
+int TestLoader::GetBlock(void* param,
+                         unsigned long pos,
+                         unsigned char* pBuf,
+                         unsigned long size) {
+  TestLoader* pLoader = static_cast<TestLoader*>(param);
+  if (pos + size < pos || pos + size > pLoader->m_Len) {
+    NOTREACHED();
+    return 0;
+  }
+
+  memcpy(pBuf, pLoader->m_pBuf + pos, size);
+  return 1;
+}
diff --git a/testing/test_loader.h b/testing/test_loader.h
new file mode 100644
index 0000000..ed01f6c
--- /dev/null
+++ b/testing/test_loader.h
@@ -0,0 +1,23 @@
+// 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_TEST_LOADER_H_
+#define TESTING_TEST_LOADER_H_
+
+#include <stdlib.h>
+
+class TestLoader {
+ public:
+  TestLoader(const char* pBuf, size_t len);
+  static int GetBlock(void* param,
+                      unsigned long pos,
+                      unsigned char* pBuf,
+                      unsigned long size);
+
+ private:
+  const char* const m_pBuf;
+  const size_t m_Len;
+};
+
+#endif  // TESTING_TEST_LOADER_H_
diff --git a/testing/test_support.cpp b/testing/test_support.cpp
index e9030a1..2bc83b3 100644
--- a/testing/test_support.cpp
+++ b/testing/test_support.cpp
@@ -5,7 +5,6 @@
 #include "testing/test_support.h"
 
 #include <stdio.h>
-#include <string.h>
 
 #include "core/fxcrt/fx_string.h"
 
@@ -89,22 +88,3 @@
   ptr[i] = 0;
   return result;
 }
-
-TestLoader::TestLoader(const char* pBuf, size_t len)
-    : m_pBuf(pBuf), m_Len(len) {
-}
-
-// static
-int TestLoader::GetBlock(void* param,
-                         unsigned long pos,
-                         unsigned char* pBuf,
-                         unsigned long size) {
-  TestLoader* pLoader = static_cast<TestLoader*>(param);
-  if (pos + size < pos || pos + size > pLoader->m_Len) {
-    NOTREACHED();
-    return 0;
-  }
-
-  memcpy(pBuf, pLoader->m_pBuf + pos, size);
-  return 1;
-}
diff --git a/testing/test_support.h b/testing/test_support.h
index ef70c62..91b43d7 100644
--- a/testing/test_support.h
+++ b/testing/test_support.h
@@ -80,19 +80,6 @@
 std::unique_ptr<unsigned short, pdfium::FreeDeleter> GetFPDFWideString(
     const std::wstring& wstr);
 
-class TestLoader {
- public:
-  TestLoader(const char* pBuf, size_t len);
-  static int GetBlock(void* param,
-                      unsigned long pos,
-                      unsigned char* pBuf,
-                      unsigned long size);
-
- private:
-  const char* const m_pBuf;
-  const size_t m_Len;
-};
-
 #ifdef PDF_ENABLE_XFA
 CFGAS_FontMgr* GetGlobalFontManager();
 #endif  // PDF_ENABLE_XFA