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

Side by Side Diff: testing/test_support.cpp

Issue 1952923002: Combine corpus runner into test_runner.py (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 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
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 <string> 10 #include <string>
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 v8::V8::SetFlagsFromString(predictable_flag, 70 v8::V8::SetFlagsFromString(predictable_flag,
71 static_cast<int>(strlen(predictable_flag))); 71 static_cast<int>(strlen(predictable_flag)));
72 } 72 }
73 #endif // PDF_ENABLE_V8 73 #endif // PDF_ENABLE_V8
74 74
75 } // namespace 75 } // namespace
76 76
77 std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename, 77 std::unique_ptr<char, pdfium::FreeDeleter> GetFileContents(const char* filename,
78 size_t* retlen) { 78 size_t* retlen) {
79 FILE* file = fopen(filename, "rb"); 79 FILE* file = fopen(filename, "rb");
80 if (!file) { 80 if (!file)
81 fprintf(stderr, "Failed to open: %s\n", filename);
82 return nullptr; 81 return nullptr;
83 } 82
84 (void)fseek(file, 0, SEEK_END); 83 (void)fseek(file, 0, SEEK_END);
85 size_t file_length = ftell(file); 84 size_t file_length = ftell(file);
86 if (!file_length) { 85 if (!file_length) {
87 return nullptr; 86 return nullptr;
88 } 87 }
89 (void)fseek(file, 0, SEEK_SET); 88 (void)fseek(file, 0, SEEK_SET);
90 std::unique_ptr<char, pdfium::FreeDeleter> buffer( 89 std::unique_ptr<char, pdfium::FreeDeleter> buffer(
91 static_cast<char*>(malloc(file_length))); 90 static_cast<char*>(malloc(file_length)));
92 if (!buffer) { 91 if (!buffer) {
93 return nullptr; 92 return nullptr;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 199 }
201 200
202 // static 201 // static
203 int TestSaver::WriteBlockCallback(FPDF_FILEWRITE* pFileWrite, 202 int TestSaver::WriteBlockCallback(FPDF_FILEWRITE* pFileWrite,
204 const void* data, 203 const void* data,
205 unsigned long size) { 204 unsigned long size) {
206 TestSaver* pThis = static_cast<TestSaver*>(pFileWrite); 205 TestSaver* pThis = static_cast<TestSaver*>(pFileWrite);
207 pThis->m_String.append(static_cast<const char*>(data), size); 206 pThis->m_String.append(static_cast<const char*>(data), size);
208 return 1; 207 return 1;
209 } 208 }
OLDNEW
« samples/pdfium_test.cc ('K') | « samples/pdfium_test.cc ('k') | testing/tools/pngdiffer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698