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

Side by Side Diff: testing/embedder_test.cpp

Issue 1137233002: Merge to XFA: Make (and verify) public/ files compile under C. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Test new XFA APIs. Created 5 years, 7 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/pdfium_test.cc ('k') | no next file » | 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 #include "embedder_test.h" 5 #include "embedder_test.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 int Get_Block(void* param, unsigned long pos, unsigned char* pBuf, 162 int Get_Block(void* param, unsigned long pos, unsigned char* pBuf,
163 unsigned long size) { 163 unsigned long size) {
164 TestLoader* pLoader = (TestLoader*) param; 164 TestLoader* pLoader = (TestLoader*) param;
165 if (pos + size < pos || pos + size > pLoader->m_Len) return 0; 165 if (pos + size < pos || pos + size > pLoader->m_Len) return 0;
166 memcpy(pBuf, pLoader->m_pBuf + pos, size); 166 memcpy(pBuf, pLoader->m_pBuf + pos, size);
167 return 1; 167 return 1;
168 } 168 }
169 169
170 bool Is_Data_Avail(FX_FILEAVAIL* pThis, size_t offset, size_t size) { 170 FPDF_BOOL Is_Data_Avail(FX_FILEAVAIL* pThis, size_t offset, size_t size) {
171 return true; 171 return true;
172 } 172 }
173 173
174 void Add_Segment(FX_DOWNLOADHINTS* pThis, size_t offset, size_t size) { 174 void Add_Segment(FX_DOWNLOADHINTS* pThis, size_t offset, size_t size) {
175 } 175 }
176 176
177 EmbedderTest::EmbedderTest() : 177 EmbedderTest::EmbedderTest() :
178 document_(nullptr), 178 document_(nullptr),
179 form_handle_(nullptr), 179 form_handle_(nullptr),
180 avail_(nullptr), 180 avail_(nullptr),
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 if (!FPDFAvail_IsLinearized(avail_)) { 256 if (!FPDFAvail_IsLinearized(avail_)) {
257 document_ = FPDF_LoadCustomDocument(&file_access_, NULL); 257 document_ = FPDF_LoadCustomDocument(&file_access_, NULL);
258 } else { 258 } else {
259 document_ = FPDFAvail_GetDocument(avail_, NULL); 259 document_ = FPDFAvail_GetDocument(avail_, NULL);
260 } 260 }
261 if (!document_) { 261 if (!document_) {
262 return false; 262 return false;
263 } 263 }
264 int docType = DOCTYPE_PDF; 264 int docType = DOCTYPE_PDF;
265 if (FPDF_HasXFAField(document_, docType)) 265 if (FPDF_HasXFAField(document_, &docType))
266 { 266 {
267 if (docType != DOCTYPE_PDF) 267 if (docType != DOCTYPE_PDF)
268 (void) FPDF_LoadXFA(document_); 268 (void) FPDF_LoadXFA(document_);
269 } 269 }
270 (void) FPDF_GetDocPermissions(document_); 270 (void) FPDF_GetDocPermissions(document_);
271 (void) FPDFAvail_IsFormAvail(avail_, &hints_); 271 (void) FPDFAvail_IsFormAvail(avail_, &hints_);
272 272
273 IPDF_JSPLATFORM* platform = static_cast<IPDF_JSPLATFORM*>(this); 273 IPDF_JSPLATFORM* platform = static_cast<IPDF_JSPLATFORM*>(this);
274 memset(platform, 0, sizeof(IPDF_JSPLATFORM)); 274 memset(platform, 0, sizeof(IPDF_JSPLATFORM));
275 platform->version = 1; 275 platform->version = 1;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 350 }
351 351
352 // Can't use gtest-provided main since we need to stash the path to the 352 // Can't use gtest-provided main since we need to stash the path to the
353 // executable in order to find the external V8 binary data files. 353 // executable in order to find the external V8 binary data files.
354 int main(int argc, char** argv) { 354 int main(int argc, char** argv) {
355 g_exe_path_ = argv[0]; 355 g_exe_path_ = argv[0];
356 testing::InitGoogleTest(&argc, argv); 356 testing::InitGoogleTest(&argc, argv);
357 testing::InitGoogleMock(&argc, argv); 357 testing::InitGoogleMock(&argc, argv);
358 return RUN_ALL_TESTS(); 358 return RUN_ALL_TESTS();
359 } 359 }
OLDNEW
« no previous file with comments | « samples/pdfium_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698