summaryrefslogtreecommitdiff
path: root/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-05 16:34:44 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-05 21:11:15 +0000
commit480f62b8350f17a398cbf4f02b76b4368a62dce6 (patch)
tree210b891000969392c87506f2c4b616a3f66d6d08 /xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
parent3c67fbdbabee4195b72d1bd1d568cad3ecad9e96 (diff)
downloadpdfium-480f62b8350f17a398cbf4f02b76b4368a62dce6.tar.xz
Merge XMLSyntaxParser Init into constructor
This Init() method is always called right after construction. Merge together for clarity. Change-Id: Iab5bfe937e82b7a310e373dd139399bc1be7cea6 Reviewed-on: https://pdfium-review.googlesource.com/3814 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp')
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp45
1 files changed, 15 insertions, 30 deletions
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
index e7e6894820..e54b2cecaf 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
+++ b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
@@ -28,8 +28,7 @@ TEST(CFDE_XMLSyntaxParser, CData) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -76,8 +75,7 @@ TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -113,8 +111,7 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangArrow) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
@@ -148,8 +145,7 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangBracketArrow) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -178,8 +174,7 @@ TEST(CFDE_XMLSyntaxParser, IncompleteCData) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -208,8 +203,7 @@ TEST(CFDE_XMLSyntaxParser, UnClosedCData) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -238,8 +232,7 @@ TEST(CFDE_XMLSyntaxParser, EmptyCData) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -275,8 +268,7 @@ TEST(CFDE_XMLSyntaxParser, Comment) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -309,8 +301,7 @@ TEST(CFDE_XMLSyntaxParser, IncorrectCommentStart) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -343,8 +334,7 @@ TEST(CFDE_XMLSyntaxParser, CommentEmpty) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -377,8 +367,7 @@ TEST(CFDE_XMLSyntaxParser, CommentThreeDash) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -405,8 +394,7 @@ TEST(CFDE_XMLSyntaxParser, CommentTwoDash) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -437,8 +425,7 @@ TEST(CFDE_XMLSyntaxParser, Entities) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -469,8 +456,7 @@ TEST(CFDE_XMLSyntaxParser, EntityOverflowHex) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());
@@ -501,8 +487,7 @@ TEST(CFDE_XMLSyntaxParser, EntityOverflowDecimal) {
size_t len = FXSYS_wcslen(input) * sizeof(wchar_t);
CFX_RetainPtr<IFGAS_Stream> stream = IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<wchar_t*>(input)), len, 0);
- CFDE_XMLSyntaxParser parser;
- parser.Init(stream, 256);
+ CFDE_XMLSyntaxParser parser(stream);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
EXPECT_EQ(L"script", parser.GetTagName());