OLD | NEW |
1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TESTING_EMBEDDER_TEST_SUPPORT_H_ | 5 #ifndef TESTING_EMBEDDER_TEST_SUPPORT_H_ |
6 #define TESTING_EMBEDDER_TEST_SUPPORT_H_ | 6 #define TESTING_EMBEDDER_TEST_SUPPORT_H_ |
7 | 7 |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
| 11 #include "../public/fpdfview.h" |
| 12 |
11 #ifdef PDF_ENABLE_V8 | 13 #ifdef PDF_ENABLE_V8 |
12 #include "v8/include/libplatform/libplatform.h" | 14 #include "v8/include/libplatform/libplatform.h" |
13 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
14 #endif | 16 #endif |
15 | 17 |
16 // Reads the entire contents of a file into a newly malloc'd buffer. | 18 // Reads the entire contents of a file into a newly malloc'd buffer. |
17 char* GetFileContents(const char* filename, size_t* retlen); | 19 char* GetFileContents(const char* filename, size_t* retlen); |
18 | 20 |
| 21 // Converts a FPDF_WIDESTRING to a std::wstring. |
| 22 // Deals with differences between UTF16LE and wchar_t. |
| 23 std::wstring GetWideString(FPDF_WIDESTRING wstr); |
| 24 |
19 #ifdef PDF_ENABLE_V8 | 25 #ifdef PDF_ENABLE_V8 |
20 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 26 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
21 bool InitializeV8ForPDFium(const std::string& exe_path, | 27 bool InitializeV8ForPDFium(const std::string& exe_path, |
22 const std::string& bin_dir, | 28 const std::string& bin_dir, |
23 v8::StartupData* natives_blob, | 29 v8::StartupData* natives_blob, |
24 v8::StartupData* snapshot_blob, | 30 v8::StartupData* snapshot_blob, |
25 v8::Platform** platform); | 31 v8::Platform** platform); |
26 #else // V8_USE_EXTERNAL_STARTUP_DATA | 32 #else // V8_USE_EXTERNAL_STARTUP_DATA |
27 bool InitializeV8ForPDFium(v8::Platform** platform); | 33 bool InitializeV8ForPDFium(v8::Platform** platform); |
28 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 34 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
29 #endif // PDF_ENABLE_V8 | 35 #endif // PDF_ENABLE_V8 |
30 | 36 |
31 class TestLoader { | 37 class TestLoader { |
32 public: | 38 public: |
33 TestLoader(const char* pBuf, size_t len); | 39 TestLoader(const char* pBuf, size_t len); |
34 static int GetBlock(void* param, | 40 static int GetBlock(void* param, |
35 unsigned long pos, | 41 unsigned long pos, |
36 unsigned char* pBuf, | 42 unsigned char* pBuf, |
37 unsigned long size); | 43 unsigned long size); |
38 | 44 |
39 private: | 45 private: |
40 const char* const m_pBuf; | 46 const char* const m_pBuf; |
41 const size_t m_Len; | 47 const size_t m_Len; |
42 }; | 48 }; |
43 | 49 |
44 #endif // TESTING_EMBEDDER_TEST_SUPPORT_H_ | 50 #endif // TESTING_EMBEDDER_TEST_SUPPORT_H_ |
OLD | NEW |