summaryrefslogtreecommitdiff
path: root/core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-07-25 20:13:48 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-25 20:13:48 +0000
commita5d2bf1131fed479195011cbf6463df3612d31f6 (patch)
tree170dc3ca4b242be2b4148fd0c718d25db8966210 /core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp
parentc356472262b736607d3daf07046d4796c3a51eee (diff)
downloadpdfium-a5d2bf1131fed479195011cbf6463df3612d31f6.tar.xz
Remove CFX_MemoryStream uses in tests.
Replace with CFX_BufferSeekableReadStream, which allows for spans and const inputs. Change CXFA_DocumentParser to take IFX_SeekableReadStream instead of IFX_SeekableStream in the process. Change-Id: I0168451350c9fc250231f0414c38738a4d86ca42 Reviewed-on: https://pdfium-review.googlesource.com/38852 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp')
-rw-r--r--core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp b/core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp
index 0c43c59ccd..74ef87e344 100644
--- a/core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp
+++ b/core/fxcrt/xml/cfx_xmlinstruction_unittest.cpp
@@ -3,10 +3,11 @@
// found in the LICENSE file.
#include "core/fxcrt/xml/cfx_xmlinstruction.h"
-#include "core/fxcrt/cfx_memorystream.h"
+
#include "core/fxcrt/xml/cfx_xmldocument.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "core/fxcrt/xml/cfx_xmlparser.h"
+#include "testing/fx_string_testhelpers.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/string_write_stream.h"
#include "testing/test_support.h"
@@ -82,13 +83,12 @@ TEST(CFX_XMLInstructionTest, SaveAcrobat) {
}
TEST(CFX_XMLInstructionTest, ParseAndReSave) {
- const char* input =
+ static const char input[] =
"<?acrobat http://www.xfa.org/schema/xfa-template/3.3/ Display:1 ?>\n"
"<node></node>";
- auto in_stream = pdfium::MakeRetain<CFX_MemoryStream>(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input),
- false);
+ auto in_stream = pdfium::MakeRetain<CFX_BufferSeekableReadStream>(
+ pdfium::as_bytes(pdfium::make_span(input)));
CFX_XMLParser parser(in_stream);
std::unique_ptr<CFX_XMLDocument> doc = parser.Parse();
@@ -116,14 +116,13 @@ TEST(CFX_XMLInstructionTest, ParseAndReSave) {
}
TEST(CFX_XMLInstructionTest, ParseAndReSaveInnerInstruction) {
- const char* input =
+ static const char input[] =
"<node>\n"
"<?acrobat http://www.xfa.org/schema/xfa-template/3.3/ Display:1 ?>\n"
"</node>";
- auto in_stream = pdfium::MakeRetain<CFX_MemoryStream>(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input),
- false);
+ auto in_stream = pdfium::MakeRetain<CFX_BufferSeekableReadStream>(
+ pdfium::as_bytes(pdfium::make_span(input)));
CFX_XMLParser parser(in_stream);
std::unique_ptr<CFX_XMLDocument> doc = parser.Parse();