diff options
Diffstat (limited to 'xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp')
-rw-r--r-- | xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp | 79 |
1 files changed, 47 insertions, 32 deletions
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp index aecb3ee39e..45ad3bb2f0 100644 --- a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp +++ b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp @@ -6,10 +6,10 @@ #include <memory> +#include "core/fxcrt/cfx_seekablestreamproxy.h" +#include "core/fxcrt/fx_codepage.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" -#include "xfa/fgas/crt/cfgas_stream.h" -#include "xfa/fgas/crt/fgas_codepage.h" class CFDE_XMLSyntaxParserTest : public pdfium::FPDF_Test {}; @@ -28,8 +28,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, CData) { L" app.alert(\"Tclams\");\n" L" "; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -75,8 +76,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, CDataWithInnerScript) { L" </script>\n" L" "; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -111,8 +113,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangArrow) { " <!>\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -145,8 +148,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangBracketArrow) { " <![>\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -174,8 +178,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, IncompleteCData) { " <![CDATA>\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -203,8 +208,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, UnClosedCData) { " <![CDATA[\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -232,8 +238,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, EmptyCData) { " <![CDATA[]]>\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -268,8 +275,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, Comment) { " <!-- A Comment -->\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -301,8 +309,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, IncorrectCommentStart) { " <!- A Comment -->\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -334,8 +343,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentEmpty) { " <!---->\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -367,8 +377,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentThreeDash) { " <!--->\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -394,8 +405,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentTwoDash) { " <!-->\n" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -425,8 +437,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, Entities) { "�" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -456,8 +469,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowHex) { "�" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); @@ -487,8 +501,9 @@ TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowDecimal) { "�" "</script>"; - CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>( - reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); + CFX_RetainPtr<CFX_SeekableStreamProxy> stream = + pdfium::MakeRetain<CFX_SeekableStreamProxy>( + reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)); stream->SetCodePage(FX_CODEPAGE_UTF8); CFDE_XMLSyntaxParser parser(stream); |