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

Side by Side Diff: testing/test_support.cpp

Issue 1561303002: Disentangle fpdfsave_embeddertest's FPDF_FILEWRITE, use gmock matchers. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
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
« testing/test_support.h ('K') | « 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 unsigned long pos, 164 unsigned long pos,
165 unsigned char* pBuf, 165 unsigned char* pBuf,
166 unsigned long size) { 166 unsigned long size) {
167 TestLoader* pLoader = static_cast<TestLoader*>(param); 167 TestLoader* pLoader = static_cast<TestLoader*>(param);
168 if (pos + size < pos || pos + size > pLoader->m_Len) 168 if (pos + size < pos || pos + size > pLoader->m_Len)
169 return 0; 169 return 0;
170 170
171 memcpy(pBuf, pLoader->m_pBuf + pos, size); 171 memcpy(pBuf, pLoader->m_pBuf + pos, size);
172 return 1; 172 return 1;
173 } 173 }
174
175 TestSaver::TestSaver() {
176 FPDF_FILEWRITE::version = 1;
177 FPDF_FILEWRITE::WriteBlock = WriteBlockCallback;
178 }
179
180 void TestSaver::ClearString() {
181 m_String.clear();
182 }
183
184 // static
185 int TestSaver::WriteBlockCallback(FPDF_FILEWRITE* pFileWrite,
186 const void* data,
187 unsigned long size) {
188 TestSaver* pThis = static_cast<TestSaver*>(pFileWrite);
189 pThis->m_String.append(static_cast<const char*>(data), size);
190 return 1;
191 }
OLDNEW
« testing/test_support.h ('K') | « testing/test_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698