Improve FPDFSysFontInfoEmbedderTest.DefaultTTFMap.

Use gmock matchers to more easily test FPDF_GetDefaultTTFMap(). Also
tighten the test expecations to check the exact set of values
FPDF_GetDefaultTTFMap() should return.

Fix some typos along the way.

Change-Id: I0402699f4a86e802a87e591cf7f296c1cb8665be
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/73791
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/fpdf_sysfontinfo_embeddertest.cpp b/fpdfsdk/fpdf_sysfontinfo_embeddertest.cpp
index e9c828d..72f1b8b 100644
--- a/fpdfsdk/fpdf_sysfontinfo_embeddertest.cpp
+++ b/fpdfsdk/fpdf_sysfontinfo_embeddertest.cpp
@@ -4,12 +4,12 @@
 
 #include "public/fpdf_sysfontinfo.h"
 
-#include <set>
+#include <vector>
 
 #include "testing/embedder_test.h"
 #include "testing/embedder_test_environment.h"
+#include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/stl_util.h"
 
 namespace {
 
@@ -80,7 +80,7 @@
     EmbedderTest::TearDown();
 
     // Bouncing the library is the only reliable way to undo the
-    // FPDF_SetSystemFontInfo() call at the momemt.
+    // FPDF_SetSystemFontInfo() call at the moment.
     EmbedderTestEnvironment::GetInstance()->TearDown();
     EmbedderTestEnvironment::GetInstance()->SetUp();
   }
@@ -104,7 +104,7 @@
     EmbedderTest::TearDown();
 
     // Bouncing the library is the only reliable way to undo the
-    // FPDF_SetSystemFontInfo() call at the momemt.
+    // FPDF_SetSystemFontInfo() call at the moment.
     EmbedderTestEnvironment::GetInstance()->TearDown();
 
     // After shutdown, it is safe to release the font info.
@@ -145,31 +145,26 @@
 }
 
 TEST_F(FPDFSysFontInfoEmbedderTest, DefaultTTFMap) {
-  static const int kAllowedCharsets[] = {
-      FXFONT_ANSI_CHARSET,        FXFONT_DEFAULT_CHARSET,
-      FXFONT_SYMBOL_CHARSET,      FXFONT_SHIFTJIS_CHARSET,
+  static constexpr int kExpectedCharsets[] = {
+      FXFONT_ANSI_CHARSET,        FXFONT_SHIFTJIS_CHARSET,
       FXFONT_HANGEUL_CHARSET,     FXFONT_GB2312_CHARSET,
       FXFONT_CHINESEBIG5_CHARSET, FXFONT_ARABIC_CHARSET,
       FXFONT_CYRILLIC_CHARSET,    FXFONT_EASTERNEUROPEAN_CHARSET,
   };
-  std::set<int> seen_charsets;
+  std::vector<int> charsets;
 
   const FPDF_CharsetFontMap* cfmap = FPDF_GetDefaultTTFMap();
   ASSERT_TRUE(cfmap);
 
   // Stop at either end mark.
   while (cfmap->charset != -1 && cfmap->fontname) {
-    // Only returns values described as legitimate in public header.
-    EXPECT_TRUE(pdfium::Contains(kAllowedCharsets, cfmap->charset))
-        << " for " << cfmap->charset;
-
-    // Duplicates are not allowed.
-    EXPECT_TRUE(seen_charsets.insert(cfmap->charset).second)
-        << " for " << cfmap->charset;
+    charsets.push_back(cfmap->charset);
     ++cfmap;
   }
 
   // Confirm end marks only occur as a pair.
   EXPECT_EQ(cfmap->charset, -1);
   EXPECT_EQ(cfmap->fontname, nullptr);
+
+  EXPECT_THAT(charsets, testing::UnorderedElementsAreArray(kExpectedCharsets));
 }