summaryrefslogtreecommitdiff
path: root/testing/test_support.cpp
diff options
context:
space:
mode:
authorJane Liu <janeliulwq@google.com>2017-07-19 10:19:42 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-19 14:35:29 +0000
commit4442d453f570fda76ec4852e2bb03e7ec8bfb825 (patch)
treed0de96e6725c03af321cc3735b9aed46285da5f0 /testing/test_support.cpp
parentc5ea630cb5eecb7d4f7f20938b8e4b52a982c0a6 (diff)
downloadpdfium-4442d453f570fda76ec4852e2bb03e7ec8bfb825.tar.xz
Added testing flag --save-attachments that saves embedded attachments
1. Added --save-attachments flag in pdfium_test to save embedded attachments using fpdf_attachment APIs. Bug=pdfium:174 Change-Id: I62f09aeb0ab1431f6e127da389518878a7214423 Reviewed-on: https://pdfium-review.googlesource.com/7990 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'testing/test_support.cpp')
-rw-r--r--testing/test_support.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/testing/test_support.cpp b/testing/test_support.cpp
index 1ad8543bae..e5c3ab45a0 100644
--- a/testing/test_support.cpp
+++ b/testing/test_support.cpp
@@ -9,6 +9,7 @@
#include "core/fdrm/crypto/fx_crypt.h"
#include "core/fxcrt/fx_memory.h"
+#include "core/fxcrt/fx_string.h"
#include "testing/utils/path_service.h"
#ifdef PDF_ENABLE_V8
@@ -103,6 +104,13 @@ std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename,
return buffer;
}
+std::string GetPlatformString(FPDF_WIDESTRING wstr) {
+ return std::string(
+ CFX_WideString::FromUTF16LE(wstr, CFX_WideString::WStringLength(wstr))
+ .UTF8Encode()
+ .c_str());
+}
+
std::wstring GetPlatformWString(FPDF_WIDESTRING wstr) {
if (!wstr)
return nullptr;