Consolidate repetitive checksum values for embedder tests.

This CL consolidates the repetitive expected checksums used in embedder
tests which render annotation_stamp_with_ap.pdf, text_form.pdf and
email_recommended.pdf, and enables the embedder tests which can now pass
for Skia/SkiaPaths after the consolidation.

Bug: pdfium:1500
Change-Id: I65989cfeb5d817410badea628f34e6dfbdda19ff
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/71990
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Hui Yingst <nigi@chromium.org>
diff --git a/core/fpdfapi/render/fpdf_progressive_render_embeddertest.cpp b/core/fpdfapi/render/fpdf_progressive_render_embeddertest.cpp
index d84ab65..b3daa4e 100644
--- a/core/fpdfapi/render/fpdf_progressive_render_embeddertest.cpp
+++ b/core/fpdfapi/render/fpdf_progressive_render_embeddertest.cpp
@@ -9,6 +9,7 @@
 #include "core/fxge/fx_dib.h"
 #include "public/fpdf_progressive.h"
 #include "testing/embedder_test.h"
+#include "testing/embedder_test_constants.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace {
@@ -19,6 +20,17 @@
 constexpr FX_ARGB kRed = 0xFFFF0000;
 constexpr FX_ARGB kWhite = 0xFFFFFFFF;
 
+#if defined(OS_WIN)
+static constexpr char kAnnotationStampWithApBaseContentChecksum[] =
+    "649d6792ea50faf98c013c2d81710595";
+#elif defined(OS_MACOSX)
+static constexpr char kAnnotationStampWithApBaseContentChecksum[] =
+    "83e9f5222c4c959b0b63a5cd24f773a1";
+#else
+static constexpr char kAnnotationStampWithApBaseContentChecksum[] =
+    "a24edc7740f1d6f76899652dcf825dea";
+#endif
+
 }  // namespace
 
 class FPDFProgressiveRenderEmbedderTest : public EmbedderTest {
@@ -214,14 +226,6 @@
 #define MAYBE_RenderWithoutPause RenderWithoutPause
 #endif
 TEST_F(FPDFProgressiveRenderEmbedderTest, MAYBE_RenderWithoutPause) {
-#if defined(OS_WIN)
-  static constexpr char kMd5BaseContent[] = "649d6792ea50faf98c013c2d81710595";
-#elif defined(OS_MACOSX)
-  static constexpr char kMd5BaseContent[] = "83e9f5222c4c959b0b63a5cd24f773a1";
-#else
-  static constexpr char kMd5BaseContent[] = "a24edc7740f1d6f76899652dcf825dea";
-#endif
-
   // Test rendering of page content using progressive render APIs
   // without pausing the rendering.
   ASSERT_TRUE(OpenDocument("annotation_stamp_with_ap.pdf"));
@@ -230,7 +234,8 @@
   FakePause pause(false);
   EXPECT_TRUE(StartRenderPage(page, &pause));
   ScopedFPDFBitmap bitmap = FinishRenderPage(page);
-  CompareBitmap(bitmap.get(), 595, 842, kMd5BaseContent);
+  CompareBitmap(bitmap.get(), 595, 842,
+                kAnnotationStampWithApBaseContentChecksum);
   UnloadPage(page);
 }
 
@@ -241,14 +246,6 @@
 #define MAYBE_RenderWithPause RenderWithPause
 #endif
 TEST_F(FPDFProgressiveRenderEmbedderTest, MAYBE_RenderWithPause) {
-#if defined(OS_WIN)
-  static constexpr char kMd5BaseContent[] = "649d6792ea50faf98c013c2d81710595";
-#elif defined(OS_MACOSX)
-  static constexpr char kMd5BaseContent[] = "83e9f5222c4c959b0b63a5cd24f773a1";
-#else
-  static constexpr char kMd5BaseContent[] = "a24edc7740f1d6f76899652dcf825dea";
-#endif
-
   // Test rendering of page content using progressive render APIs
   // with pause in rendering.
   ASSERT_TRUE(OpenDocument("annotation_stamp_with_ap.pdf"));
@@ -262,28 +259,12 @@
     render_done = ContinueRenderPage(page, &pause);
   }
   ScopedFPDFBitmap bitmap = FinishRenderPage(page);
-  CompareBitmap(bitmap.get(), 595, 842, kMd5BaseContent);
+  CompareBitmap(bitmap.get(), 595, 842,
+                kAnnotationStampWithApBaseContentChecksum);
   UnloadPage(page);
 }
 
-// TODO(crbug.com/pdfium/11): Fix this test and enable.
-#if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-#define MAYBE_RenderAnnotWithPause DISABLED_RenderAnnotWithPause
-#else
-#define MAYBE_RenderAnnotWithPause RenderAnnotWithPause
-#endif
-TEST_F(FPDFProgressiveRenderEmbedderTest, MAYBE_RenderAnnotWithPause) {
-#if defined(OS_WIN)
-  static constexpr char kMd5ContentWithAnnot[] =
-      "6aa001a77ec05d0f1b0d1d22e28744d4";
-#elif defined(OS_MACOSX)
-  static constexpr char kMd5ContentWithAnnot[] =
-      "80d7b6cc7b13a78d77a6151bc846e80b";
-#else
-  static constexpr char kMd5ContentWithAnnot[] =
-      "b42cef463483e668eaf4055a65e4f1f5";
-#endif
-
+TEST_F(FPDFProgressiveRenderEmbedderTest, RenderAnnotWithPause) {
   // Test rendering of the page with annotations using progressive render APIs
   // with pause in rendering.
   ASSERT_TRUE(OpenDocument("annotation_stamp_with_ap.pdf"));
@@ -297,28 +278,11 @@
     render_done = ContinueRenderPage(page, &pause);
   }
   ScopedFPDFBitmap bitmap = FinishRenderPage(page);
-  CompareBitmap(bitmap.get(), 595, 842, kMd5ContentWithAnnot);
+  CompareBitmap(bitmap.get(), 595, 842, pdfium::kAnnotationStampWithApChecksum);
   UnloadPage(page);
 }
 
-// TODO(crbug.com/pdfium/11): Fix this test and enable.
-#if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-#define MAYBE_RenderFormsWithPause DISABLED_RenderFormsWithPause
-#else
-#define MAYBE_RenderFormsWithPause RenderFormsWithPause
-#endif
-TEST_F(FPDFProgressiveRenderEmbedderTest, MAYBE_RenderFormsWithPause) {
-#if defined(OS_WIN)
-  static constexpr char kMd5ContentWithForms[] =
-      "d3204faa62b607f0bd3893c9c22cabcb";
-#elif defined(OS_MACOSX)
-  static constexpr char kMd5ContentWithForms[] =
-      "d485541d958fef08d24e8eca3e537023";
-#else
-  static constexpr char kMd5ContentWithForms[] =
-      "b890950d4b9bc163b1a96797f3004b53";
-#endif
-
+TEST_F(FPDFProgressiveRenderEmbedderTest, RenderFormsWithPause) {
   // Test rendering of the page with forms using progressive render APIs
   // with pause in rendering.
   ASSERT_TRUE(OpenDocument("text_form.pdf"));
@@ -332,7 +296,7 @@
     render_done = ContinueRenderPage(page, &pause);
   }
   ScopedFPDFBitmap bitmap = FinishRenderPageWithForms(page, form_handle_);
-  CompareBitmap(bitmap.get(), 300, 300, kMd5ContentWithForms);
+  CompareBitmap(bitmap.get(), 300, 300, pdfium::kTextFormChecksum);
   UnloadPage(page);
 }
 
diff --git a/fpdfsdk/fpdf_annot_embeddertest.cpp b/fpdfsdk/fpdf_annot_embeddertest.cpp
index 1f93bb8..6bb9216 100644
--- a/fpdfsdk/fpdf_annot_embeddertest.cpp
+++ b/fpdfsdk/fpdf_annot_embeddertest.cpp
@@ -33,6 +33,8 @@
 #include "third_party/base/span.h"
 #include "third_party/base/stl_util.h"
 
+using pdfium::kAnnotationStampWithApChecksum;
+
 namespace {
 
 const wchar_t kStreamData[] =
@@ -42,27 +44,6 @@
     L"223.7 732.4 c 232.6 729.9 242.0 730.8 251.2 730.8 c 257.5 730.8 "
     L"263.0 732.9 269.0 734.4 c S";
 
-#if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-#if defined(OS_LINUX)
-const char kAnnotationStampWithApChecksum[] =
-    "db83eaadc92967e3ac9bebfc6178ca75";
-#else
-const char kAnnotationStampWithApChecksum[] =
-    "3c87b4a8e51245964357fb5f5fbc612b";
-#endif  // defined(OS_LINUX)
-#else
-#if defined(OS_WIN)
-const char kAnnotationStampWithApChecksum[] =
-    "6aa001a77ec05d0f1b0d1d22e28744d4";
-#elif defined(OS_MACOSX)
-const char kAnnotationStampWithApChecksum[] =
-    "80d7b6cc7b13a78d77a6151bc846e80b";
-#else
-const char kAnnotationStampWithApChecksum[] =
-    "b42cef463483e668eaf4055a65e4f1f5";
-#endif
-#endif  // defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-
 void VerifyFocusableAnnotSubtypes(
     FPDF_FORMHANDLE form_handle,
     pdfium::span<const FPDF_ANNOTATION_SUBTYPE> expected_subtypes) {
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp
index 5cf40cd..43353a6 100644
--- a/fpdfsdk/fpdf_formfill_embeddertest.cpp
+++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp
@@ -21,6 +21,8 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/base/stl_util.h"
 
+using pdfium::kTextFormChecksum;
+
 using testing::_;
 using testing::InSequence;
 using testing::NiceMock;
@@ -28,22 +30,6 @@
 
 using FPDFFormFillEmbedderTest = EmbedderTest;
 
-namespace {
-
-#if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-const char kTextFormChecksum[] = "17efe329169f5b7681fbe939894a35de";
-#else
-#if defined(OS_WIN)
-const char kTextFormChecksum[] = "d3204faa62b607f0bd3893c9c22cabcb";
-#elif defined(OS_MACOSX)
-const char kTextFormChecksum[] = "d485541d958fef08d24e8eca3e537023";
-#else
-const char kTextFormChecksum[] = "b890950d4b9bc163b1a96797f3004b53";
-#endif
-#endif  // defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
-
-}  // namespace
-
 // A base class for many related tests that involve clicking and typing into
 // form fields.
 class FPDFFormFillInteractiveEmbedderTest : public FPDFFormFillEmbedderTest {
diff --git a/testing/embedder_test_constants.cpp b/testing/embedder_test_constants.cpp
index e4d8534..a871e71 100644
--- a/testing/embedder_test_constants.cpp
+++ b/testing/embedder_test_constants.cpp
@@ -8,6 +8,27 @@
 
 namespace pdfium {
 
+#if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
+#if defined(OS_LINUX)
+const char kAnnotationStampWithApChecksum[] =
+    "db83eaadc92967e3ac9bebfc6178ca75";
+#else
+const char kAnnotationStampWithApChecksum[] =
+    "3c87b4a8e51245964357fb5f5fbc612b";
+#endif  // defined(OS_LINUX)
+#else
+#if defined(OS_WIN)
+const char kAnnotationStampWithApChecksum[] =
+    "6aa001a77ec05d0f1b0d1d22e28744d4";
+#elif defined(OS_MACOSX)
+const char kAnnotationStampWithApChecksum[] =
+    "80d7b6cc7b13a78d77a6151bc846e80b";
+#else
+const char kAnnotationStampWithApChecksum[] =
+    "b42cef463483e668eaf4055a65e4f1f5";
+#endif
+#endif  // defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
+
 const char kBlankPage612By792Checksum[] = "1940568c9ba33bac5d0b1ee9558c76b3";
 
 #if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
@@ -52,4 +73,16 @@
 const char kRectanglesChecksum[] = "0a90de37f52127619c3dfb642b5fa2fe";
 #endif
 
+#if defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
+const char kTextFormChecksum[] = "17efe329169f5b7681fbe939894a35de";
+#else
+#if defined(OS_WIN)
+const char kTextFormChecksum[] = "d3204faa62b607f0bd3893c9c22cabcb";
+#elif defined(OS_MACOSX)
+const char kTextFormChecksum[] = "d485541d958fef08d24e8eca3e537023";
+#else
+const char kTextFormChecksum[] = "b890950d4b9bc163b1a96797f3004b53";
+#endif
+#endif  // defined(_SKIA_SUPPORT_) || defined(_SKIA_SUPPORT_PATHS_)
+
 }  // namespace pdfium
diff --git a/testing/embedder_test_constants.h b/testing/embedder_test_constants.h
index 016bacc..41fe790 100644
--- a/testing/embedder_test_constants.h
+++ b/testing/embedder_test_constants.h
@@ -7,6 +7,9 @@
 
 namespace pdfium {
 
+// MD5 hash for rendering annotation_stamp_with_ap.pdf with annotations.
+extern const char kAnnotationStampWithApChecksum[];
+
 // MD5 hash for rendering a 612x792 blank page.
 extern const char kBlankPage612By792Checksum[];
 
@@ -25,6 +28,9 @@
 // MD5 hash for rendering rectangles.pdf.
 extern const char kRectanglesChecksum[];
 
+// MD5 hash for rendering text_form.pdf.
+extern const char kTextFormChecksum[];
+
 }  // namespace pdfium
 
 #endif  // TESTING_EMBEDDER_TEST_CONSTANTS_H_
diff --git a/xfa/fwl/cfwl_edit_embeddertest.cpp b/xfa/fwl/cfwl_edit_embeddertest.cpp
index e9a741f..d44b8d0 100644
--- a/xfa/fwl/cfwl_edit_embeddertest.cpp
+++ b/xfa/fwl/cfwl_edit_embeddertest.cpp
@@ -10,6 +10,13 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/xfa_js_embedder_test.h"
 
+namespace {
+
+const char kEmailRecommendedFilledChecksum[] =
+    "211e4e46eb347aa2bc7c425556d600b0";
+
+}  // namespace
+
 class CFWLEditEmbedderTest : public XFAJSEmbedderTest {
  protected:
   void SetUp() override {
@@ -110,11 +117,10 @@
   for (size_t i = 0; i < 10; ++i)
     FORM_OnChar(form_handle(), page(), 'a' + i, 0);
 
-  const char kFilledMD5[] = "211e4e46eb347aa2bc7c425556d600b0";
   {
     ScopedFPDFBitmap page_bitmap =
         RenderLoadedPageWithFlags(page(), FPDF_ANNOT);
-    CompareBitmap(page_bitmap.get(), 612, 792, kFilledMD5);
+    CompareBitmap(page_bitmap.get(), 612, 792, kEmailRecommendedFilledChecksum);
   }
 }
 
@@ -134,11 +140,10 @@
   for (size_t i = 5; i < 10; ++i)
     FORM_OnChar(form_handle(), page(), 'a' + i, 0);
 
-  const char kFilledMD5[] = "211e4e46eb347aa2bc7c425556d600b0";
   {
     ScopedFPDFBitmap page_bitmap =
         RenderLoadedPageWithFlags(page(), FPDF_ANNOT);
-    CompareBitmap(page_bitmap.get(), 612, 792, kFilledMD5);
+    CompareBitmap(page_bitmap.get(), 612, 792, kEmailRecommendedFilledChecksum);
   }
 }