From 70cca3663a0ea6c290b55c290ba5eb1f1c9db572 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Fri, 10 Aug 2018 18:55:46 +0000 Subject: 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 Reviewed-by: Lei Zhang Commit-Queue: Ryan Harrison --- public/fpdf_ext.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'public') diff --git a/public/fpdf_ext.h b/public/fpdf_ext.h index e488c5283b..a531f1407e 100644 --- a/public/fpdf_ext.h +++ b/public/fpdf_ext.h @@ -7,6 +7,8 @@ #ifndef PUBLIC_FPDF_EXT_H_ #define PUBLIC_FPDF_EXT_H_ +#include + // NOLINTNEXTLINE(build/include) #include "fpdfview.h" @@ -67,6 +69,14 @@ typedef struct _UNSUPPORT_INFO { FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info); +// Sets generator function for calls to time. +// +// This API is intended to be used only for testing, thus may cause PDFium to +// behave poorly in production environments. +// +// func - Function pointer to alternate implementation of time. +FPDF_EXPORT void FPDF_CALLCONV FSDK_SetTimeFunction(time_t (*func)()); + // Unknown page mode. #define PAGEMODE_UNKNOWN -1 // Document outline, and thumbnails hidden. -- cgit v1.2.3