Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp |
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp |
index 8e953a6ee37986e41b83620f6f5b1d466ac3941d..640feac9aad497af4875e3a95d77d7ae4df68b42 100644 |
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp |
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp |
@@ -26,6 +26,7 @@ class CPDF_TestParser : public CPDF_Parser { |
// Add test case as private friend so that RebuildCrossRef in CPDF_Parser |
// can be accessed. |
FRIEND_TEST(fpdf_parser_parser, RebuildCrossRefCorrectly); |
+ FRIEND_TEST(fpdf_parser_parser, RebuildCrossRefFailed); |
}; |
// TODO(thestig) Using unique_ptr with ReleaseDeleter is still not ideal. |
@@ -211,3 +212,13 @@ TEST(fpdf_parser_parser, RebuildCrossRefCorrectly) { |
EXPECT_EQ(versions[i], parser.m_ObjVersion.GetAt(i)); |
} |
} |
+ |
+TEST(fpdf_parser_parser, RebuildCrossRefFailed) { |
+ CPDF_TestParser parser; |
+ std::string test_file; |
+ ASSERT_TRUE(PathService::GetTestFilePath( |
+ "parser_rebuildxref_error_notrailer.pdf", &test_file)); |
+ ASSERT_TRUE(parser.InitTest(test_file.c_str())) << test_file; |
+ |
+ ASSERT_FALSE(parser.RebuildCrossRef()); |
+} |