diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-01-07 12:14:49 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-01-07 12:14:49 -0800 |
commit | 5dc13d7858f9caf58b0e12f38823300a739302e2 (patch) | |
tree | f883ae2b246af537f8851b49b6f1a5eefae61800 /testing/test_support.cpp | |
parent | a462162a76b3f487e76d8cc1b1f917f0937ea040 (diff) | |
download | pdfium-5dc13d7858f9caf58b0e12f38823300a739302e2.tar.xz |
Disentangle fpdfsave_embeddertest's FPDF_FILEWRITE, use gmock matchers.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1561303002 .
Diffstat (limited to 'testing/test_support.cpp')
-rw-r--r-- | testing/test_support.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/testing/test_support.cpp b/testing/test_support.cpp index 96e01c5b01..da5ea7e9ee 100644 --- a/testing/test_support.cpp +++ b/testing/test_support.cpp @@ -172,3 +172,21 @@ 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; +} |