Fix CPDF_Action::GetType() to properly check /S entries.

The /S entry should be a name object, and not a string object. Switch to
CPDF_Dictionary::GetNameFor(), which was specifically added for
performing this type of check, and then update unit test expectations.

Change-Id: Idfb57a5c587853e34a439d9354ceb9b7ff680601
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79298
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Hui Yingst <nigi@chromium.org>
diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp
index 1f88724..87e0f28 100644
--- a/core/fpdfdoc/cpdf_action.cpp
+++ b/core/fpdfdoc/cpdf_action.cpp
@@ -42,7 +42,7 @@
       return Type::kUnknown;
   }
 
-  ByteString csType = m_pDict->GetStringFor("S");
+  ByteString csType = m_pDict->GetNameFor("S");
   if (csType.IsEmpty())
     return Type::kUnknown;
 
diff --git a/core/fpdfdoc/cpdf_action_unittest.cpp b/core/fpdfdoc/cpdf_action_unittest.cpp
index 35639a5..100a6d6 100644
--- a/core/fpdfdoc/cpdf_action_unittest.cpp
+++ b/core/fpdfdoc/cpdf_action_unittest.cpp
@@ -109,16 +109,14 @@
       RetainPtr<CPDF_Dictionary> dict =
           CreateInvalidActionDictWithType(test_case.action_type);
       CPDF_Action action(dict.Get());
-      // TODO(thestig): Should return `CPDF_Action::Type::kUnknown`.
-      EXPECT_EQ(test_case.expected_type, action.GetType());
+      EXPECT_EQ(CPDF_Action::Type::kUnknown, action.GetType());
     }
     {
       // The action type (/S) must be a name.
       RetainPtr<CPDF_Dictionary> dict =
           CreateInvalidActionDictWithoutType(test_case.action_type);
       CPDF_Action action(dict.Get());
-      // TODO(thestig): Should return `CPDF_Action::Type::kUnknown`.
-      EXPECT_EQ(test_case.expected_type, action.GetType());
+      EXPECT_EQ(CPDF_Action::Type::kUnknown, action.GetType());
     }
   }