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

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: 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
« testing/test_support.h ('K') | « 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 ce143ae8e9b75153f00c072fde2616eeec296445..1e5943be2805eae18153f855a459fad5c98b27c7 100644
--- a/testing/test_support.cpp
+++ b/testing/test_support.cpp
@@ -171,3 +171,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;
+}
« testing/test_support.h ('K') | « testing/test_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698