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

Side by Side Diff: samples/pdfium_test.cc

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
« no previous file with comments | « no previous file | testing/test_support.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium 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 <limits.h> 5 #include <limits.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 FSDK_SetUnSpObjProcessHandler(&unsuppored_info); 809 FSDK_SetUnSpObjProcessHandler(&unsuppored_info);
810 810
811 while (!files.empty()) { 811 while (!files.empty()) {
812 std::string filename = files.front(); 812 std::string filename = files.front();
813 files.pop_front(); 813 files.pop_front();
814 size_t file_length = 0; 814 size_t file_length = 0;
815 std::unique_ptr<char, pdfium::FreeDeleter> file_contents = 815 std::unique_ptr<char, pdfium::FreeDeleter> file_contents =
816 GetFileContents(filename.c_str(), &file_length); 816 GetFileContents(filename.c_str(), &file_length);
817 if (!file_contents) 817 if (!file_contents)
818 continue; 818 continue;
819 fprintf(stderr, "Rendering PDF file %s.\n", filename.c_str()); 819
820 std::string test_dir = "pdfium/testing/";
Tom Sepez 2016/05/05 16:39:08 Feels like this shouldn't have any knowledge of th
dsinclair 2016/05/05 16:45:08 This is just for the fprintf below. I was trying t
821 size_t pdfium_testing = filename.find(test_dir);
822 std::string log_name = filename;
823 if (pdfium_testing != std::string::npos)
824 log_name = filename.substr(pdfium_testing + test_dir.length());
825 fprintf(stderr, "Rendering PDF file %s.\n", log_name.c_str());
826
820 std::string events; 827 std::string events;
821 if (options.send_events) { 828 if (options.send_events) {
822 std::string event_filename = filename; 829 std::string event_filename = filename;
823 size_t event_length = 0; 830 size_t event_length = 0;
824 size_t extension_pos = event_filename.find(".pdf"); 831 size_t extension_pos = event_filename.find(".pdf");
825 if (extension_pos != std::string::npos) { 832 if (extension_pos != std::string::npos) {
826 event_filename.replace(extension_pos, 4, ".evt"); 833 event_filename.replace(extension_pos, 4, ".evt");
827 std::unique_ptr<char, pdfium::FreeDeleter> event_contents = 834 std::unique_ptr<char, pdfium::FreeDeleter> event_contents =
828 GetFileContents(event_filename.c_str(), &event_length); 835 GetFileContents(event_filename.c_str(), &event_length);
829 if (event_contents) { 836 if (event_contents) {
830 fprintf(stderr, "Sending events from: %s\n", event_filename.c_str()); 837 fprintf(stderr, "Sending events from: %s\n", event_filename.c_str());
831 events = std::string(event_contents.get(), event_length); 838 events = std::string(event_contents.get(), event_length);
832 } 839 }
833 } 840 }
834 } 841 }
835 RenderPdf(filename, file_contents.get(), file_length, options, events); 842 RenderPdf(filename, file_contents.get(), file_length, options, events);
836 } 843 }
837 844
838 FPDF_DestroyLibrary(); 845 FPDF_DestroyLibrary();
839 #ifdef PDF_ENABLE_V8 846 #ifdef PDF_ENABLE_V8
840 v8::V8::ShutdownPlatform(); 847 v8::V8::ShutdownPlatform();
841 delete platform; 848 delete platform;
842 #endif // PDF_ENABLE_V8 849 #endif // PDF_ENABLE_V8
843 850
844 return 0; 851 return 0;
845 } 852 }
OLDNEW
« no previous file with comments | « no previous file | testing/test_support.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698