summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_ext.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-08-10 18:55:46 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-10 18:55:46 +0000
commit70cca3663a0ea6c290b55c290ba5eb1f1c9db572 (patch)
tree795a8448eb76b90320d46aca1808e6d64a6b3ae5 /fpdfsdk/fpdf_ext.cpp
parent6655d95a8586c1f272d5d418bb63514abbe1d695 (diff)
downloadpdfium-70cca3663a0ea6c290b55c290ba5eb1f1c9db572.tar.xz
Add proxy for syscall time
This CL adds a proxy, FXSYS_time, for the time syscall, so that a testing mechanism can be implemented. Specically there is now a flag for pdfium_test, --time=, that allows setting the time since the epoch that will be returned. This plumbed all the way down into the proxy and allows for stable results for tests that depend on getting the current time. There are other places in the code base that will need to be patched like this, that will be dealt with in follow on CLs. BUG=pdfium:1104 Change-Id: I2de185f8d47abe46704dd579c13a54948b7f81e0 Reviewed-on: https://pdfium-review.googlesource.com/39750 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_ext.cpp')
-rw-r--r--fpdfsdk/fpdf_ext.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index 6a2ab061fd..23c3d468c1 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -10,6 +10,7 @@
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfdoc/cpdf_interform.h"
#include "core/fpdfdoc/cpdf_metadata.h"
+#include "core/fxcrt/fx_extension.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
#ifdef PDF_ENABLE_XFA
@@ -76,6 +77,10 @@ FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) {
return true;
}
+FPDF_EXPORT void FPDF_CALLCONV FSDK_SetTimeFunction(time_t (*func)()) {
+ FXSYS_SetTimeFunction(func);
+}
+
FPDF_EXPORT int FPDF_CALLCONV FPDFDoc_GetPageMode(FPDF_DOCUMENT document) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)