summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_read_validator_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/fpdfapi/parser/cpdf_read_validator_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/fpdfapi/parser/cpdf_read_validator_unittest.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_read_validator_unittest.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/core/fpdfapi/parser/cpdf_read_validator_unittest.cpp b/core/fpdfapi/parser/cpdf_read_validator_unittest.cpp
index 247abaa9f4..ccfb451dd8 100644
--- a/core/fpdfapi/parser/cpdf_read_validator_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_read_validator_unittest.cpp
@@ -8,8 +8,6 @@
#include <utility>
#include <vector>
-#include "core/fxcrt/cfx_memorystream.h"
-#include "core/fxcrt/fx_stream.h"
#include "testing/fx_string_testhelpers.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -67,8 +65,7 @@ class MockDownloadHints : public CPDF_DataAvail::DownloadHints {
TEST(CPDF_ReadValidatorTest, UnavailableData) {
std::vector<uint8_t> test_data(kTestDataSize);
- auto file = pdfium::MakeRetain<CFX_MemoryStream>(test_data.data(),
- test_data.size(), false);
+ auto file = pdfium::MakeRetain<CFX_BufferSeekableReadStream>(test_data);
MockFileAvail file_avail;
auto validator = pdfium::MakeRetain<CPDF_ReadValidator>(file, &file_avail);
@@ -91,8 +88,7 @@ TEST(CPDF_ReadValidatorTest, UnavailableData) {
TEST(CPDF_ReadValidatorTest, UnavailableDataWithHints) {
std::vector<uint8_t> test_data(kTestDataSize);
- auto file = pdfium::MakeRetain<CFX_MemoryStream>(test_data.data(),
- test_data.size(), false);
+ auto file = pdfium::MakeRetain<CFX_BufferSeekableReadStream>(test_data);
MockFileAvail file_avail;
auto validator = pdfium::MakeRetain<CPDF_ReadValidator>(file, &file_avail);
@@ -147,8 +143,7 @@ TEST(CPDF_ReadValidatorTest, ReadError) {
TEST(CPDF_ReadValidatorTest, IntOverflow) {
std::vector<uint8_t> test_data(kTestDataSize);
- auto file = pdfium::MakeRetain<CFX_MemoryStream>(test_data.data(),
- test_data.size(), false);
+ auto file = pdfium::MakeRetain<CFX_BufferSeekableReadStream>(test_data);
MockFileAvail file_avail;
auto validator = pdfium::MakeRetain<CPDF_ReadValidator>(file, &file_avail);
@@ -246,8 +241,7 @@ TEST(CPDF_ReadValidatorTest, SessionReset) {
TEST(CPDF_ReadValidatorTest, CheckDataRangeAndRequestIfUnavailable) {
std::vector<uint8_t> test_data(kTestDataSize);
- auto file = pdfium::MakeRetain<CFX_MemoryStream>(test_data.data(),
- test_data.size(), false);
+ auto file = pdfium::MakeRetain<CFX_BufferSeekableReadStream>(test_data);
MockFileAvail file_avail;
auto validator = pdfium::MakeRetain<CPDF_ReadValidator>(file, &file_avail);