diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-04-24 15:25:31 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-24 15:25:31 +0000 |
commit | 90e03b9b3f459e8812301b58ec0952b136f23a53 (patch) | |
tree | 071aa9ccb988c52a432bb83e47149e75af8ff78e | |
parent | 2dca1cbf595618e06547a2c464d82c47b6acace6 (diff) | |
download | pdfium-90e03b9b3f459e8812301b58ec0952b136f23a53.tar.xz |
Remove duplicate data extraction from CFX_XMLParser
The methods to get a piece of data from the text buffer are all
identical. This CL collapses them all into a single GetTextData method.
Change-Id: Ibd2ace9023a3707505c4c80c6aeb01af666445d9
Reviewed-on: https://pdfium-review.googlesource.com/31273
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r-- | core/fxcrt/xml/cfx_xmlparser.cpp | 22 | ||||
-rw-r--r-- | core/fxcrt/xml/cfx_xmlparser.h | 17 | ||||
-rw-r--r-- | core/fxcrt/xml/cfx_xmlparser_unittest.cpp | 121 |
3 files changed, 67 insertions, 93 deletions
diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp index 357deb069d..09ae64ec8b 100644 --- a/core/fxcrt/xml/cfx_xmlparser.cpp +++ b/core/fxcrt/xml/cfx_xmlparser.cpp @@ -113,7 +113,7 @@ bool CFX_XMLParser::Parse() { if (m_pChild->GetType() != FX_XMLNODE_Element) return false; - m_ws1 = GetTagName(); + m_ws1 = GetTextData(); if (m_ws1.GetLength() > 0 && m_ws1 != static_cast<CFX_XMLElement*>(m_pChild)->GetName()) { return false; @@ -129,7 +129,7 @@ bool CFX_XMLParser::Parse() { iCount++; break; case FX_XmlSyntaxResult::TargetName: - m_ws1 = m_BlockBuffer.GetTextData(0, m_iTextDataLength); + m_ws1 = GetTextData(); if (m_ws1 == L"originalXFAVersion" || m_ws1 == L"acrobat") { auto child = pdfium::MakeUnique<CFX_XMLInstruction>(m_ws1); m_pChild = child.get(); @@ -140,7 +140,7 @@ bool CFX_XMLParser::Parse() { m_ws1.clear(); break; case FX_XmlSyntaxResult::TagName: { - m_ws1 = GetTagName(); + m_ws1 = GetTextData(); auto child = pdfium::MakeUnique<CFX_XMLElement>(m_ws1); m_pChild = child.get(); m_pParent->AppendChild(std::move(child)); @@ -149,12 +149,12 @@ bool CFX_XMLParser::Parse() { break; } case FX_XmlSyntaxResult::AttriName: - m_ws1 = GetAttributeName(); + m_ws1 = GetTextData(); break; case FX_XmlSyntaxResult::AttriValue: if (m_pChild && m_pChild->GetType() == FX_XMLNODE_Element) { - static_cast<CFX_XMLElement*>(m_pChild)->SetAttribute( - m_ws1, GetAttributeName()); + static_cast<CFX_XMLElement*>(m_pChild)->SetAttribute(m_ws1, + GetTextData()); } m_ws1.clear(); break; @@ -183,8 +183,7 @@ bool CFX_XMLParser::Parse() { if (!m_ws1.IsEmpty()) instruction->AppendData(m_ws1); - instruction->AppendData( - m_BlockBuffer.GetTextData(0, m_iTextDataLength)); + instruction->AppendData(GetTextData()); } m_ws1.clear(); break; @@ -549,9 +548,6 @@ FX_XmlSyntaxResult CFX_XMLParser::DoSyntaxParse() { if (ch == m_SkipChar) { m_SkipStack.pop(); if (m_SkipStack.empty()) { - if (m_BlockBuffer.GetDataLength() >= 9) - (void)m_BlockBuffer.GetTextData(0, 7); - m_iTextDataLength = m_BlockBuffer.GetDataLength(); m_BlockBuffer.Reset(true); std::tie(m_pCurrentBlock, m_iIndexInBlock) = @@ -727,3 +723,7 @@ void CFX_XMLParser::ParseTextChar(wchar_t character) { } m_Start++; } + +WideString CFX_XMLParser::GetTextData() const { + return m_BlockBuffer.GetTextData(0, m_iTextDataLength); +} diff --git a/core/fxcrt/xml/cfx_xmlparser.h b/core/fxcrt/xml/cfx_xmlparser.h index 03f649c933..503852753f 100644 --- a/core/fxcrt/xml/cfx_xmlparser.h +++ b/core/fxcrt/xml/cfx_xmlparser.h @@ -50,22 +50,7 @@ class CFX_XMLParser { protected: FX_XmlSyntaxResult DoSyntaxParse(); - - WideString GetTagName() const { - return m_BlockBuffer.GetTextData(0, m_iTextDataLength); - } - - WideString GetAttributeName() const { - return m_BlockBuffer.GetTextData(0, m_iTextDataLength); - } - - WideString GetAttributeValue() const { - return m_BlockBuffer.GetTextData(0, m_iTextDataLength); - } - - WideString GetTextData() const { - return m_BlockBuffer.GetTextData(0, m_iTextDataLength); - } + WideString GetTextData() const; private: enum class FDE_XmlSyntaxState { diff --git a/core/fxcrt/xml/cfx_xmlparser_unittest.cpp b/core/fxcrt/xml/cfx_xmlparser_unittest.cpp index 02addc70eb..badac2c532 100644 --- a/core/fxcrt/xml/cfx_xmlparser_unittest.cpp +++ b/core/fxcrt/xml/cfx_xmlparser_unittest.cpp @@ -24,17 +24,6 @@ class CFX_XMLTestParser : public CFX_XMLParser { ~CFX_XMLTestParser() override = default; FX_XmlSyntaxResult DoSyntaxParse() { return CFX_XMLParser::DoSyntaxParse(); } - - WideString GetTagName() const { return CFX_XMLParser::GetTagName(); } - - WideString GetAttributeName() const { - return CFX_XMLParser::GetAttributeName(); - } - - WideString GetAttributeValue() const { - return CFX_XMLParser::GetAttributeValue(); - } - WideString GetTextData() const { return CFX_XMLParser::GetTextData(); } }; @@ -68,12 +57,12 @@ TEST(CFX_XMLParserTest, CData) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); @@ -86,7 +75,7 @@ TEST(CFX_XMLParserTest, CData) { ASSERT_EQ(L"\n", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse()); } @@ -114,12 +103,12 @@ TEST(CFX_XMLParserTest, CDataWithInnerScript) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); @@ -132,7 +121,7 @@ TEST(CFX_XMLParserTest, CDataWithInnerScript) { ASSERT_EQ(L"\n", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse()); } @@ -150,12 +139,12 @@ TEST(CFX_XMLParserTest, ArrowBangArrow) { ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); @@ -165,7 +154,7 @@ TEST(CFX_XMLParserTest, ArrowBangArrow) { ASSERT_EQ(L"\n", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse()); } @@ -182,12 +171,12 @@ TEST(CFX_XMLParserTest, ArrowBangBracketArrow) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); @@ -210,12 +199,12 @@ TEST(CFX_XMLParserTest, IncompleteCData) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); @@ -238,12 +227,12 @@ TEST(CFX_XMLParserTest, UnClosedCData) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); @@ -266,12 +255,12 @@ TEST(CFX_XMLParserTest, EmptyCData) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); @@ -284,7 +273,7 @@ TEST(CFX_XMLParserTest, EmptyCData) { ASSERT_EQ(L"\n", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse()); } @@ -301,12 +290,12 @@ TEST(CFX_XMLParserTest, Comment) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); @@ -316,7 +305,7 @@ TEST(CFX_XMLParserTest, Comment) { ASSERT_EQ(L"\n", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse()); } @@ -333,12 +322,12 @@ TEST(CFX_XMLParserTest, IncorrectCommentStart) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); @@ -348,7 +337,7 @@ TEST(CFX_XMLParserTest, IncorrectCommentStart) { ASSERT_EQ(L"\n", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse()); } @@ -365,12 +354,12 @@ TEST(CFX_XMLParserTest, CommentEmpty) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); @@ -380,7 +369,7 @@ TEST(CFX_XMLParserTest, CommentEmpty) { ASSERT_EQ(L"\n", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse()); } @@ -397,12 +386,12 @@ TEST(CFX_XMLParserTest, CommentThreeDash) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); @@ -423,12 +412,12 @@ TEST(CFX_XMLParserTest, CommentTwoDash) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); @@ -453,19 +442,19 @@ TEST(CFX_XMLParserTest, Entities) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); ASSERT_EQ(L"BTH\xab48", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse()); } @@ -483,19 +472,19 @@ TEST(CFX_XMLParserTest, EntityOverflowHex) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); ASSERT_EQ(L" ", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse()); } @@ -513,19 +502,19 @@ TEST(CFX_XMLParserTest, EntityOverflowDecimal) { CFX_XMLTestParser parser(root.get(), stream); ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse()); - ASSERT_EQ(L"contentType", parser.GetAttributeName()); + ASSERT_EQ(L"contentType", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse()); - ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue()); + ASSERT_EQ(L"application/x-javascript", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse()); ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse()); ASSERT_EQ(L" ", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse()); - ASSERT_EQ(L"script", parser.GetTagName()); + ASSERT_EQ(L"script", parser.GetTextData()); ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse()); } |