Fix pdfium_test in Chromium builds when Skia is enabled by default

Do additional Chromium-only initialization in pdfium_test for Skia,
when Skia is enabled by default. The existing code only handles the case
when Skia is explicitly selected.

Bug: 384605089
Change-Id: I050d7dd418e81b3eca404daf481ee373f37413ba
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/127850
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
diff --git a/testing/pdfium_test.cc b/testing/pdfium_test.cc
index c3b6620..9e21ad4 100644
--- a/testing/pdfium_test.cc
+++ b/testing/pdfium_test.cc
@@ -1897,16 +1897,19 @@
 
 #if defined(PDF_ENABLE_SKIA)
     case RendererType::kSkia:
-#if defined(BUILD_WITH_CHROMIUM)
-      // Needed to support Chromium's copy of Skia, which uses a
-      // `DiscardableMemoryAllocator`.
-      chromium_support::InitializeDiscardableMemoryAllocator();
-#endif  // defined(BUILD_WITH_CHROMIUM)
       config.m_RendererType = FPDF_RENDERERTYPE_SKIA;
       break;
 #endif  // defined(PDF_ENABLE_SKIA)
   }
 
+#if defined(PDF_ENABLE_SKIA) && defined(BUILD_WITH_CHROMIUM)
+  // Needed to support Chromium's copy of Skia, which uses a
+  // `DiscardableMemoryAllocator`.
+  if (config.m_RendererType == FPDF_RENDERERTYPE_SKIA) {
+    chromium_support::InitializeDiscardableMemoryAllocator();
+  }
+#endif
+
   std::function<void()> idler = []() {};
 #ifdef PDF_ENABLE_V8
 #ifdef V8_USE_EXTERNAL_STARTUP_DATA