diff options
author | Nicolas Pena <npm@chromium.org> | 2017-07-05 11:55:35 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-05 17:08:57 +0000 |
commit | 3ff54008a163eea3158a7c107595daf79ccc7d44 (patch) | |
tree | f460b4f50863e65922799970208bf93bd845a7d8 /testing/test_support.cpp | |
parent | fb00ec2af390ccfe8f5e81f49b9113e044f5e5ad (diff) | |
download | pdfium-3ff54008a163eea3158a7c107595daf79ccc7d44.tar.xz |
Allow EmbedderTest to test saving
This CL adds helper methods for EmbedderTest to save. This means that
TestSaver is no longer needed and all the methods it uses are moved to
the EmbedderTest.
Change-Id: I740f29699bfd8c6b570cb1fd85e7aab9bc1d3f6f
Reviewed-on: https://pdfium-review.googlesource.com/7171
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'testing/test_support.cpp')
-rw-r--r-- | testing/test_support.cpp | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/testing/test_support.cpp b/testing/test_support.cpp index 681a7baca3..1ad8543bae 100644 --- a/testing/test_support.cpp +++ b/testing/test_support.cpp @@ -211,38 +211,3 @@ int TestLoader::GetBlock(void* param, memcpy(pBuf, pLoader->m_pBuf + pos, size); return 1; } - -TestSaver::TestSaver() { - FPDF_FILEWRITE::version = 1; - FPDF_FILEWRITE::WriteBlock = WriteBlockCallback; -} - -void TestSaver::ClearString() { - m_String.clear(); -} - -// static -int TestSaver::WriteBlockCallback(FPDF_FILEWRITE* pFileWrite, - const void* data, - unsigned long size) { - TestSaver* pThis = static_cast<TestSaver*>(pFileWrite); - pThis->m_String.append(static_cast<const char*>(data), size); - return 1; -} - -// static -int TestSaver::GetBlockFromString(void* param, - unsigned long pos, - unsigned char* buf, - unsigned long size) { - std::string* new_file = static_cast<std::string*>(param); - if (!new_file || pos + size < pos) - return 0; - - unsigned long file_size = new_file->size(); - if (pos + size > file_size) - return 0; - - memcpy(buf, new_file->data() + pos, size); - return 1; -} |