[NFC][scudo] Move macro into a shared header

GitOrigin-RevId: 46f2fdb840d66c41a3ee751208f42529c185e29e
diff --git a/tests/combined_test.cpp b/tests/combined_test.cpp
index bbe304e..7e334f5 100644
--- a/tests/combined_test.cpp
+++ b/tests/combined_test.cpp
@@ -76,20 +76,13 @@
   ~TestAllocator() { this->unmapTestOnly(); }
 };
 
-namespace testing {
-namespace internal {
-#define SCUDO_DEFINE_GTEST_TYPE_NAME(TYPE)                                     \
-  template <> std::string GetTypeName<scudo::TYPE>() { return #TYPE; }
-SCUDO_DEFINE_GTEST_TYPE_NAME(AndroidSvelteConfig)
+SCUDO_DEFINE_GTEST_TYPE_NAME(scudo::AndroidSvelteConfig)
 #if SCUDO_FUCHSIA
-SCUDO_DEFINE_GTEST_TYPE_NAME(FuchsiaConfig)
+SCUDO_DEFINE_GTEST_TYPE_NAME(scudo::FuchsiaConfig)
 #else
-SCUDO_DEFINE_GTEST_TYPE_NAME(DefaultConfig)
-SCUDO_DEFINE_GTEST_TYPE_NAME(AndroidConfig)
+SCUDO_DEFINE_GTEST_TYPE_NAME(scudo::DefaultConfig)
+SCUDO_DEFINE_GTEST_TYPE_NAME(scudo::AndroidConfig)
 #endif
-#undef SCUDO_DEFINE_GTEST_TYPE_NAME
-} // namespace internal
-} // namespace testing
 
 template <class Config> struct ScudoCombinedTest : public ::testing::Test {
   ScudoCombinedTest() {
diff --git a/tests/primary_test.cpp b/tests/primary_test.cpp
index 2707985..80fe135 100644
--- a/tests/primary_test.cpp
+++ b/tests/primary_test.cpp
@@ -65,16 +65,9 @@
   ~TestAllocator() { this->unmapTestOnly(); }
 };
 
-namespace testing {
-namespace internal {
-#define SCUDO_DEFINE_GTEST_TYPE_NAME(TYPE)                                     \
-  template <> std::string GetTypeName<TYPE>() { return #TYPE; }
 SCUDO_DEFINE_GTEST_TYPE_NAME(TestConfig1)
 SCUDO_DEFINE_GTEST_TYPE_NAME(TestConfig2)
 SCUDO_DEFINE_GTEST_TYPE_NAME(TestConfig3)
-#undef SCUDO_DEFINE_GTEST_TYPE_NAME
-} // namespace internal
-} // namespace testing
 
 template <class BaseConfig> struct ScudoPrimaryTest : public ::testing::Test {};
 
diff --git a/tests/scudo_unit_test.h b/tests/scudo_unit_test.h
index 22356c7..f919599 100644
--- a/tests/scudo_unit_test.h
+++ b/tests/scudo_unit_test.h
@@ -32,3 +32,8 @@
 #endif
 
 extern bool UseQuarantine;
+
+#define SCUDO_DEFINE_GTEST_TYPE_NAME(TYPE)                                     \
+  template <> std::string testing::internal::GetTypeName<TYPE>() {             \
+    return #TYPE;                                                              \
+  }