From 081d41208489a318163a306789de4139b2dddfc7 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 28 Aug 2017 18:00:37 -0700 Subject: Make some CPDF_StreamContentParser methods static. For methods that are only exposed for testing. Once they are static, there is no need for dummy CPDF_StreamContentParser constructor calls in the unit tests. Adjust the CPDF_StreamContentParser constructor now that one of the parameters can no longer be a nullptr. Change-Id: If29b02ea216002a7bb325b1913281f58b70382aa Reviewed-on: https://pdfium-review.googlesource.com/12230 Commit-Queue: dsinclair Reviewed-by: dsinclair --- .../page/cpdf_streamcontentparser_unittest.cpp | 38 ++++++++++++---------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp') diff --git a/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp b/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp index ffc0d95107..6b43935a1d 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp @@ -6,35 +6,39 @@ #include "testing/gtest/include/gtest/gtest.h" TEST(cpdf_streamcontentparser, PDF_FindKeyAbbreviation) { - CPDF_StreamContentParser parser(nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, 0); - EXPECT_EQ(CFX_ByteStringC("BitsPerComponent"), - parser.FindKeyAbbreviationForTesting(CFX_ByteStringC("BPC"))); + CPDF_StreamContentParser::FindKeyAbbreviationForTesting( + CFX_ByteStringC("BPC"))); EXPECT_EQ(CFX_ByteStringC("Width"), - parser.FindKeyAbbreviationForTesting(CFX_ByteStringC("W"))); + CPDF_StreamContentParser::FindKeyAbbreviationForTesting( + CFX_ByteStringC("W"))); EXPECT_EQ(CFX_ByteStringC(""), - parser.FindKeyAbbreviationForTesting(CFX_ByteStringC(""))); + CPDF_StreamContentParser::FindKeyAbbreviationForTesting( + CFX_ByteStringC(""))); EXPECT_EQ(CFX_ByteStringC(""), - parser.FindKeyAbbreviationForTesting(CFX_ByteStringC("NoInList"))); + CPDF_StreamContentParser::FindKeyAbbreviationForTesting( + CFX_ByteStringC("NoInList"))); // Prefix should not match. EXPECT_EQ(CFX_ByteStringC(""), - parser.FindKeyAbbreviationForTesting(CFX_ByteStringC("WW"))); + CPDF_StreamContentParser::FindKeyAbbreviationForTesting( + CFX_ByteStringC("WW"))); } TEST(cpdf_streamcontentparser, PDF_FindValueAbbreviation) { - CPDF_StreamContentParser parser(nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, 0); - EXPECT_EQ(CFX_ByteStringC("DeviceGray"), - parser.FindValueAbbreviationForTesting(CFX_ByteStringC("G"))); + CPDF_StreamContentParser::FindValueAbbreviationForTesting( + CFX_ByteStringC("G"))); EXPECT_EQ(CFX_ByteStringC("DCTDecode"), - parser.FindValueAbbreviationForTesting(CFX_ByteStringC("DCT"))); + CPDF_StreamContentParser::FindValueAbbreviationForTesting( + CFX_ByteStringC("DCT"))); + EXPECT_EQ(CFX_ByteStringC(""), + CPDF_StreamContentParser::FindValueAbbreviationForTesting( + CFX_ByteStringC(""))); EXPECT_EQ(CFX_ByteStringC(""), - parser.FindValueAbbreviationForTesting(CFX_ByteStringC(""))); - EXPECT_EQ(CFX_ByteStringC(""), parser.FindValueAbbreviationForTesting( - CFX_ByteStringC("NoInList"))); + CPDF_StreamContentParser::FindValueAbbreviationForTesting( + CFX_ByteStringC("NoInList"))); // Prefix should not match. EXPECT_EQ(CFX_ByteStringC(""), - parser.FindValueAbbreviationForTesting(CFX_ByteStringC("II"))); + CPDF_StreamContentParser::FindValueAbbreviationForTesting( + CFX_ByteStringC("II"))); } -- cgit v1.2.3