Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: testing/embedder_test.h

Issue 1395733006: Allow compiling PDFium without V8. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: PDFium Authors Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « samples/samples.gyp ('k') | testing/embedder_test.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 PDFium Authors. All rights reserved. 1 // Copyright (c) 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_H_ 5 #ifndef TESTING_EMBEDDER_TEST_H_
6 #define TESTING_EMBEDDER_TEST_H_ 6 #define TESTING_EMBEDDER_TEST_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "../public/fpdf_dataavail.h" 11 #include "../public/fpdf_dataavail.h"
12 #include "../public/fpdf_ext.h" 12 #include "../public/fpdf_ext.h"
13 #include "../public/fpdf_formfill.h" 13 #include "../public/fpdf_formfill.h"
14 #include "../public/fpdfview.h" 14 #include "../public/fpdfview.h"
15 #include "../third_party/base/nonstd_unique_ptr.h" 15 #include "../third_party/base/nonstd_unique_ptr.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17
18 #ifdef PDF_ENABLE_V8
17 #include "v8/include/v8.h" 19 #include "v8/include/v8.h"
20 #endif // PDF_ENABLE_v8
18 21
19 class TestLoader; 22 class TestLoader;
20 23
21 // This class is used to load a PDF document, and then run programatic 24 // This class is used to load a PDF document, and then run programatic
22 // API tests against it. 25 // API tests against it.
23 class EmbedderTest : public ::testing::Test, 26 class EmbedderTest : public ::testing::Test,
24 public UNSUPPORT_INFO, 27 public UNSUPPORT_INFO,
25 public IPDF_JSPLATFORM, 28 public IPDF_JSPLATFORM,
26 public FPDF_FORMFILLINFO { 29 public FPDF_FORMFILLINFO {
27 public: 30 public:
(...skipping 26 matching lines...) Expand all
54 private: 57 private:
55 std::map<int, FPDF_PAGE> m_pageMap; 58 std::map<int, FPDF_PAGE> m_pageMap;
56 }; 59 };
57 60
58 EmbedderTest(); 61 EmbedderTest();
59 virtual ~EmbedderTest(); 62 virtual ~EmbedderTest();
60 63
61 void SetUp() override; 64 void SetUp() override;
62 void TearDown() override; 65 void TearDown() override;
63 66
67 #ifdef PDF_ENABLE_V8
64 // Call before SetUp to pass shared isolate, otherwise PDFium creates one. 68 // Call before SetUp to pass shared isolate, otherwise PDFium creates one.
65 void SetExternalIsolate(v8::Isolate* isolate) { external_isolate_ = isolate; } 69 void SetExternalIsolate(void* isolate) {
70 external_isolate_ = static_cast<v8::Isolate*>(isolate);
71 }
72 #endif // PDF_ENABLE_V8
66 73
67 void SetDelegate(Delegate* delegate) { 74 void SetDelegate(Delegate* delegate) {
68 delegate_ = delegate ? delegate : default_delegate_.get(); 75 delegate_ = delegate ? delegate : default_delegate_.get();
69 } 76 }
70 77
71 FPDF_DOCUMENT document() { return document_; } 78 FPDF_DOCUMENT document() { return document_; }
72 FPDF_FORMHANDLE form_handle() { return form_handle_; } 79 FPDF_FORMHANDLE form_handle() { return form_handle_; }
73 80
74 // Open the document specified by |filename|, and create its form fill 81 // Open the document specified by |filename|, and create its form fill
75 // environment, or return false on failure. 82 // environment, or return false on failure.
(...skipping 22 matching lines...) Expand all
98 105
99 protected: 106 protected:
100 Delegate* delegate_; 107 Delegate* delegate_;
101 nonstd::unique_ptr<Delegate> default_delegate_; 108 nonstd::unique_ptr<Delegate> default_delegate_;
102 FPDF_DOCUMENT document_; 109 FPDF_DOCUMENT document_;
103 FPDF_FORMHANDLE form_handle_; 110 FPDF_FORMHANDLE form_handle_;
104 FPDF_AVAIL avail_; 111 FPDF_AVAIL avail_;
105 FX_DOWNLOADHINTS hints_; 112 FX_DOWNLOADHINTS hints_;
106 FPDF_FILEACCESS file_access_; 113 FPDF_FILEACCESS file_access_;
107 FX_FILEAVAIL file_avail_; 114 FX_FILEAVAIL file_avail_;
115 #ifdef PDF_ENABLE_V8
108 v8::Platform* platform_; 116 v8::Platform* platform_;
109 v8::StartupData natives_; 117 v8::StartupData natives_;
110 v8::StartupData snapshot_; 118 v8::StartupData snapshot_;
111 v8::Isolate* external_isolate_; 119 #endif // PDF_ENABLE_V8
120 void* external_isolate_;
112 TestLoader* loader_; 121 TestLoader* loader_;
113 size_t file_length_; 122 size_t file_length_;
114 char* file_contents_; 123 char* file_contents_;
115 124
116 private: 125 private:
117 static void UnsupportedHandlerTrampoline(UNSUPPORT_INFO*, int type); 126 static void UnsupportedHandlerTrampoline(UNSUPPORT_INFO*, int type);
118 static int AlertTrampoline(IPDF_JSPLATFORM* plaform, 127 static int AlertTrampoline(IPDF_JSPLATFORM* plaform,
119 FPDF_WIDESTRING message, 128 FPDF_WIDESTRING message,
120 FPDF_WIDESTRING title, 129 FPDF_WIDESTRING title,
121 int type, 130 int type,
122 int icon); 131 int icon);
123 static int SetTimerTrampoline(FPDF_FORMFILLINFO* info, 132 static int SetTimerTrampoline(FPDF_FORMFILLINFO* info,
124 int msecs, 133 int msecs,
125 TimerCallback fn); 134 TimerCallback fn);
126 static void KillTimerTrampoline(FPDF_FORMFILLINFO* info, int id); 135 static void KillTimerTrampoline(FPDF_FORMFILLINFO* info, int id);
127 static FPDF_PAGE GetPageTrampoline(FPDF_FORMFILLINFO* info, 136 static FPDF_PAGE GetPageTrampoline(FPDF_FORMFILLINFO* info,
128 FPDF_DOCUMENT document, 137 FPDF_DOCUMENT document,
129 int page_index); 138 int page_index);
130 }; 139 };
131 140
132 #endif // TESTING_EMBEDDER_TEST_H_ 141 #endif // TESTING_EMBEDDER_TEST_H_
OLDNEW
« no previous file with comments | « samples/samples.gyp ('k') | testing/embedder_test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698