Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: testing/test_support.cpp

Issue 1561303002: Disentangle fpdfsave_embeddertest's FPDF_FILEWRITE, use gmock matchers. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Blank line Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing/test_support.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/test_support.cpp
diff --git a/testing/test_support.cpp b/testing/test_support.cpp
index 96e01c5b01cbf04ba989c83e58a6744a557f02d3..da5ea7e9ee5d06126ed8a149c3dca0b90444e52c 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;
+}
« no previous file with comments | « testing/test_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698