summaryrefslogtreecommitdiff
path: root/public
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 /public
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 'public')
-rw-r--r--public/fpdf_ext.h10
1 files changed, 10 insertions, 0 deletions
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 <time.h>
+
// 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.