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

Side by Side Diff: testing/test_support.cpp

Issue 1569973002: Merge to XFA: Disentangle fpdfsave_embeddertest's FPDF_FILEWRITE. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 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 | « testing/test_support.h ('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 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/test_support.h" 5 #include "testing/test_support.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "testing/utils/path_service.h" 10 #include "testing/utils/path_service.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 unsigned long pos, 165 unsigned long pos,
166 unsigned char* pBuf, 166 unsigned char* pBuf,
167 unsigned long size) { 167 unsigned long size) {
168 TestLoader* pLoader = static_cast<TestLoader*>(param); 168 TestLoader* pLoader = static_cast<TestLoader*>(param);
169 if (pos + size < pos || pos + size > pLoader->m_Len) 169 if (pos + size < pos || pos + size > pLoader->m_Len)
170 return 0; 170 return 0;
171 171
172 memcpy(pBuf, pLoader->m_pBuf + pos, size); 172 memcpy(pBuf, pLoader->m_pBuf + pos, size);
173 return 1; 173 return 1;
174 } 174 }
175
176 TestSaver::TestSaver() {
177 FPDF_FILEWRITE::version = 1;
178 FPDF_FILEWRITE::WriteBlock = WriteBlockCallback;
179 }
180
181 void TestSaver::ClearString() {
182 m_String.clear();
183 }
184
185 // static
186 int TestSaver::WriteBlockCallback(FPDF_FILEWRITE* pFileWrite,
187 const void* data,
188 unsigned long size) {
189 TestSaver* pThis = static_cast<TestSaver*>(pFileWrite);
190 pThis->m_String.append(static_cast<const char*>(data), size);
191 return 1;
192 }
OLDNEW
« no previous file with comments | « testing/test_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698