diff options
author | Lei Zhang <thestig@chromium.org> | 2015-11-04 14:40:02 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-11-04 14:40:02 -0800 |
commit | 8cadf995e9a0fec8da19f69edac9d10fccca7eed (patch) | |
tree | f9243907b097b72099dedbcb1b2a011911a4fcf6 /testing/test_support.cpp | |
parent | 9e48432750f7d86a43c3d10f47a057f8360f7619 (diff) | |
download | pdfium-8cadf995e9a0fec8da19f69edac9d10fccca7eed.tar.xz |
Make JS app.setTimeOut() work again.
This regressed in commit 794c9b6.
BUG=551248
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1424743006 .
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, |