summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/embedder_test.cpp9
-rw-r--r--testing/embedder_test.h5
-rw-r--r--testing/resources/redirect.pdf22
3 files changed, 36 insertions, 0 deletions
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index 215009ceac..43f077ca01 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -241,6 +241,8 @@ FPDF_FORMHANDLE EmbedderTest::SetupFormFillEnvironment(
formfillinfo->FFI_SetTimer = SetTimerTrampoline;
formfillinfo->FFI_KillTimer = KillTimerTrampoline;
formfillinfo->FFI_GetPage = GetPageTrampoline;
+ formfillinfo->FFI_DoURIAction = DoURIActionTrampoline;
+
if (javascript_option == JavaScriptOption::kEnableJavaScript)
formfillinfo->m_pJsPlatform = platform;
@@ -478,6 +480,13 @@ FPDF_PAGE EmbedderTest::GetPageTrampoline(FPDF_FORMFILLINFO* info,
}
// static
+void EmbedderTest::DoURIActionTrampoline(FPDF_FORMFILLINFO* info,
+ FPDF_BYTESTRING uri) {
+ EmbedderTest* test = static_cast<EmbedderTest*>(info);
+ return test->delegate_->DoURIAction(uri);
+}
+
+// static
std::string EmbedderTest::HashBitmap(FPDF_BITMAP bitmap) {
uint8_t digest[16];
CRYPT_MD5Generate(static_cast<uint8_t*>(FPDFBitmap_GetBuffer(bitmap)),
diff --git a/testing/embedder_test.h b/testing/embedder_test.h
index 64707631b5..a6a4cf51e4 100644
--- a/testing/embedder_test.h
+++ b/testing/embedder_test.h
@@ -62,6 +62,9 @@ class EmbedderTest : public ::testing::Test,
virtual FPDF_PAGE GetPage(FPDF_FORMFILLINFO* info,
FPDF_DOCUMENT document,
int page_index);
+
+ // Equivalent to FPDF_FORMFILLINFO::FFI_DoURIAction().
+ virtual void DoURIAction(FPDF_BYTESTRING uri) {}
};
EmbedderTest();
@@ -245,6 +248,8 @@ class EmbedderTest : public ::testing::Test,
static FPDF_PAGE GetPageTrampoline(FPDF_FORMFILLINFO* info,
FPDF_DOCUMENT document,
int page_index);
+ static void DoURIActionTrampoline(FPDF_FORMFILLINFO* info,
+ FPDF_BYTESTRING uri);
static int WriteBlockCallback(FPDF_FILEWRITE* pFileWrite,
const void* data,
unsigned long size);
diff --git a/testing/resources/redirect.pdf b/testing/resources/redirect.pdf
new file mode 100644
index 0000000000..2dcc23b0be
--- /dev/null
+++ b/testing/resources/redirect.pdf
@@ -0,0 +1,22 @@
+%PDF-1.7
+trailer
+<<
+/Root 1 0 R
+>>
+1 0 obj
+<<
+/Type /Catalog
+/Pages 2 0 R
+/OpenAction 2 0 R
+>>
+endobj
+
+2 0 obj
+<<
+/Type /Action
+/S /URI
+/URI (http://evilzone.org) // URL HERE
+>>
+endobj
+
+%%EOF \ No newline at end of file