diff options
author | Lei Zhang <thestig@chromium.org> | 2015-11-04 16:02:47 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-11-04 16:02:47 -0800 |
commit | 79e893a1d0f2083f17c40ccadf2cc1250aad5a14 (patch) | |
tree | 114028fbcc6ba016620cba2981a512bea83128d5 /testing/test_support.cpp | |
parent | 8fec3e42ed57a988ad5e7faae5e6a83847a3267e (diff) | |
download | pdfium-79e893a1d0f2083f17c40ccadf2cc1250aad5a14.tar.xz |
Merge to XFA: Make JS app.setTimeOut() work again.
This regressed in commit 794c9b6.
BUG=551248
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1424743006 .
(cherry picked from commit 8cadf995e9a0fec8da19f69edac9d10fccca7eed)
(cherry picked from commit 955930dce7e4b5c764cdd34b134baea4207de523)
Review URL: https://codereview.chromium.org/1416663008 .
Diffstat (limited to 'testing/test_support.cpp')
-rw-r--r-- | testing/test_support.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/testing/test_support.cpp b/testing/test_support.cpp index 611ba5d580..49232990bc 100644 --- a/testing/test_support.cpp +++ b/testing/test_support.cpp @@ -98,6 +98,22 @@ char* GetFileContents(const char* filename, size_t* retlen) { return buffer; } +std::wstring GetWideString(FPDF_WIDESTRING wstr) { + if (!wstr) + return nullptr; + + size_t characters = 0; + while (wstr[characters]) + ++characters; + + std::wstring platform_string(characters, L'\0'); + for (size_t i = 0; i < characters + 1; ++i) { + const unsigned char* ptr = reinterpret_cast<const unsigned char*>(&wstr[i]); + platform_string[i] = ptr[0] + 256 * ptr[1]; + } + return platform_string; +} + #ifdef PDF_ENABLE_V8 #ifdef V8_USE_EXTERNAL_STARTUP_DATA bool InitializeV8ForPDFium(const std::string& exe_path, |