From 79e893a1d0f2083f17c40ccadf2cc1250aad5a14 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 4 Nov 2015 16:02:47 -0800 Subject: 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 . --- testing/test_support.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'testing/test_support.cpp') 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(&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, -- cgit v1.2.3