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 #include "testing/embedder_test.h" | 5 #include "testing/embedder_test.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #ifdef PDF_ENABLE_V8 | 51 #ifdef PDF_ENABLE_V8 |
52 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 52 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
53 InitializeV8ForPDFium(g_exe_path_, std::string(), &natives_, &snapshot_, | 53 InitializeV8ForPDFium(g_exe_path_, std::string(), &natives_, &snapshot_, |
54 &platform_); | 54 &platform_); |
55 #else | 55 #else |
56 InitializeV8ForPDFium(&platform_); | 56 InitializeV8ForPDFium(&platform_); |
57 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 57 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
58 #endif // FPDF_ENABLE_V8 | 58 #endif // FPDF_ENABLE_V8 |
59 } | 59 } |
60 | 60 |
61 EmbedderTest::~EmbedderTest() {} | 61 EmbedderTest::~EmbedderTest() { |
| 62 #ifdef PDF_ENABLE_V8 |
| 63 v8::V8::ShutdownPlatform(); |
| 64 delete platform_; |
| 65 #endif // PDF_ENABLE_V8 |
| 66 } |
62 | 67 |
63 void EmbedderTest::SetUp() { | 68 void EmbedderTest::SetUp() { |
64 FPDF_LIBRARY_CONFIG config; | 69 FPDF_LIBRARY_CONFIG config; |
65 config.version = 2; | 70 config.version = 2; |
66 config.m_pUserFontPaths = nullptr; | 71 config.m_pUserFontPaths = nullptr; |
67 config.m_v8EmbedderSlot = 0; | 72 config.m_v8EmbedderSlot = 0; |
68 config.m_pIsolate = external_isolate_; | 73 config.m_pIsolate = external_isolate_; |
69 FPDF_InitLibraryWithConfig(&config); | 74 FPDF_InitLibraryWithConfig(&config); |
70 | 75 |
71 UNSUPPORT_INFO* info = static_cast<UNSUPPORT_INFO*>(this); | 76 UNSUPPORT_INFO* info = static_cast<UNSUPPORT_INFO*>(this); |
(...skipping 14 matching lines...) Expand all Loading... |
86 FPDFDOC_ExitFormFillEnvironment(form_handle_); | 91 FPDFDOC_ExitFormFillEnvironment(form_handle_); |
87 #else // PDF_ENABLE_XFA | 92 #else // PDF_ENABLE_XFA |
88 FPDFDOC_ExitFormFillEnvironment(form_handle_); | 93 FPDFDOC_ExitFormFillEnvironment(form_handle_); |
89 FPDF_CloseDocument(document_); | 94 FPDF_CloseDocument(document_); |
90 #endif // PDF_ENABLE_XFA | 95 #endif // PDF_ENABLE_XFA |
91 } | 96 } |
92 | 97 |
93 FPDFAvail_Destroy(avail_); | 98 FPDFAvail_Destroy(avail_); |
94 FPDF_DestroyLibrary(); | 99 FPDF_DestroyLibrary(); |
95 | 100 |
96 #ifdef PDF_ENABLE_V8 | |
97 v8::V8::ShutdownPlatform(); | |
98 delete platform_; | |
99 #endif // PDF_ENABLE_V8 | |
100 | |
101 delete loader_; | 101 delete loader_; |
102 } | 102 } |
103 | 103 |
104 bool EmbedderTest::CreateEmptyDocument() { | 104 bool EmbedderTest::CreateEmptyDocument() { |
105 document_ = FPDF_CreateNewDocument(); | 105 document_ = FPDF_CreateNewDocument(); |
106 if (!document_) | 106 if (!document_) |
107 return false; | 107 return false; |
108 | 108 |
109 SetupFormFillEnvironment(); | 109 SetupFormFillEnvironment(); |
110 return true; | 110 return true; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 | 318 |
319 // Can't use gtest-provided main since we need to stash the path to the | 319 // Can't use gtest-provided main since we need to stash the path to the |
320 // executable in order to find the external V8 binary data files. | 320 // executable in order to find the external V8 binary data files. |
321 int main(int argc, char** argv) { | 321 int main(int argc, char** argv) { |
322 g_exe_path_ = argv[0]; | 322 g_exe_path_ = argv[0]; |
323 testing::InitGoogleTest(&argc, argv); | 323 testing::InitGoogleTest(&argc, argv); |
324 testing::InitGoogleMock(&argc, argv); | 324 testing::InitGoogleMock(&argc, argv); |
325 return RUN_ALL_TESTS(); | 325 return RUN_ALL_TESTS(); |
326 } | 326 } |
OLD | NEW |