Move third_party/base/test/scoped_locale.* to testing

Move helpers used for testing to the testing directory. Also shorten the
pdfium::base nested namespace to namespace pdfium.

Bug: pdfium:2127
Change-Id: If26a9054b75178b1781d1c5a5572fb69125fcc05
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/116672
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 7be7cc9..24383ff 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -521,7 +521,6 @@
     ":pdfium_public_headers",
     "core/fxcrt",
     "testing:embedder_test_support",
-    "third_party:pdfium_base_test_support",
     "//testing/gmock",
     "//testing/gtest",
   ]
diff --git a/fpdfsdk/fpdf_transformpage_embeddertest.cpp b/fpdfsdk/fpdf_transformpage_embeddertest.cpp
index 9089841..56e66fa 100644
--- a/fpdfsdk/fpdf_transformpage_embeddertest.cpp
+++ b/fpdfsdk/fpdf_transformpage_embeddertest.cpp
@@ -10,7 +10,7 @@
 #include "testing/embedder_test_constants.h"
 
 #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
-#include "third_party/base/test/scoped_locale.h"
+#include "testing/scoped_locale.h"
 #endif
 
 using pdfium::RectanglesChecksum;
@@ -485,7 +485,7 @@
 
 #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
 TEST_F(FPDFTransformEmbedderTest, TransFormWithClipAndSaveWithLocale) {
-  pdfium::base::ScopedLocale scoped_locale("da_DK.UTF-8");
+  pdfium::ScopedLocale scoped_locale("da_DK.UTF-8");
 
   {
     ASSERT_TRUE(OpenDocument("rectangles.pdf"));
diff --git a/testing/BUILD.gn b/testing/BUILD.gn
index d61f8f3..f7c087a 100644
--- a/testing/BUILD.gn
+++ b/testing/BUILD.gn
@@ -52,6 +52,13 @@
     "../:pdfium_noshorten_config",
   ]
   visibility = [ "../*" ]
+  if (is_posix) {
+    sources += [
+      "scoped_locale.cc",
+      "scoped_locale.h",
+    ]
+    deps += [ "//testing/gtest" ]
+  }
   if (pdf_use_partition_alloc) {
     sources += [
       "allocator_shim_config.cpp",
diff --git a/third_party/base/test/scoped_locale.cc b/testing/scoped_locale.cc
similarity index 78%
rename from third_party/base/test/scoped_locale.cc
rename to testing/scoped_locale.cc
index 2643dd9..5b8644a 100644
--- a/third_party/base/test/scoped_locale.cc
+++ b/testing/scoped_locale.cc
@@ -1,15 +1,14 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2024 The PDFium Authors
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "third_party/base/test/scoped_locale.h"
+#include "testing/scoped_locale.h"
 
 #include <locale.h>
 
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace pdfium {
-namespace base {
 
 ScopedLocale::ScopedLocale(const std::string& locale) {
   prev_locale_ = setlocale(LC_ALL, nullptr);
@@ -21,5 +20,4 @@
   EXPECT_STREQ(prev_locale_.c_str(), setlocale(LC_ALL, prev_locale_.c_str()));
 }
 
-}  // namespace base
 }  // namespace pdfium
diff --git a/third_party/base/test/scoped_locale.h b/testing/scoped_locale.h
similarity index 67%
rename from third_party/base/test/scoped_locale.h
rename to testing/scoped_locale.h
index ef6d6ea..dd0b977 100644
--- a/third_party/base/test/scoped_locale.h
+++ b/testing/scoped_locale.h
@@ -1,14 +1,13 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2024 The PDFium Authors
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef THIRD_PARTY_BASE_TEST_SCOPED_LOCALE_H_
-#define THIRD_PARTY_BASE_TEST_SCOPED_LOCALE_H_
+#ifndef TESTING_SCOPED_LOCALE_H_
+#define TESTING_SCOPED_LOCALE_H_
 
 #include <string>
 
 namespace pdfium {
-namespace base {
 
 // Sets the given |locale| on construction, and restores the previous locale
 // on destruction.
@@ -24,7 +23,6 @@
   ScopedLocale& operator=(const ScopedLocale&) = delete;
 };
 
-}  // namespace base
 }  // namespace pdfium
 
-#endif  // THIRD_PARTY_BASE_TEST_SCOPED_LOCALE_H_
+#endif  // TESTING_SCOPED_LOCALE_H_
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index d0e6bb3..b6a4829 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -569,20 +569,3 @@
     "//third_party/abseil-cpp:absl",
   ]
 }
-
-source_set("pdfium_base_test_support") {
-  testonly = true
-  sources = []
-  configs += [
-    "../:pdfium_strict_config",
-    "../:pdfium_noshorten_config",
-  ]
-  deps = []
-  if (is_posix) {
-    sources += [
-      "base/test/scoped_locale.cc",
-      "base/test/scoped_locale.h",
-    ]
-    deps += [ "//testing/gtest" ]
-  }
-}