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>
diff --git a/testing/test_support.cpp b/testing/test_support.cpp
index 1ad8543..e5c3ab4 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 @@
   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;