diff options
author | thestig <thestig@chromium.org> | 2016-10-13 06:48:47 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-13 06:48:47 -0700 |
commit | f2b940ce281ac5b690bf661fb686fcb5eed34d02 (patch) | |
tree | 6661a5a221303dda2e98f88371912317ce0f6269 | |
parent | 6c659ab22988716c0f578460a2048663ab93805a (diff) | |
download | pdfium-f2b940ce281ac5b690bf661fb686fcb5eed34d02.tar.xz |
Reduce missing evt file spam in pdfium_test.
Review-Url: https://codereview.chromium.org/2415663003
-rw-r--r-- | samples/pdfium_test.cc | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index 5c0f81b1b0..9bbd771780 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -26,20 +26,28 @@ #include "samples/image_diff_png.h" #include "testing/test_support.h" +#ifdef _WIN32 +#include <io.h> +#else +#include <unistd.h> +#endif + #ifdef PDF_ENABLE_V8 #include "v8/include/libplatform/libplatform.h" #include "v8/include/v8.h" #endif // PDF_ENABLE_V8 -#ifdef _WIN32 -#define snprintf _snprintf -#endif - #ifdef PDF_ENABLE_SKIA #include "third_party/skia/include/core/SkPictureRecorder.h" #include "third_party/skia/include/core/SkStream.h" #endif +#ifdef _WIN32 +#define access _access +#define snprintf _snprintf +#define R_OK 4 +#endif + enum OutputFormat { OUTPUT_NONE, OUTPUT_TEXT, @@ -905,11 +913,15 @@ int main(int argc, const char* argv[]) { size_t extension_pos = event_filename.find(".pdf"); if (extension_pos != std::string::npos) { event_filename.replace(extension_pos, 4, ".evt"); - std::unique_ptr<char, pdfium::FreeDeleter> event_contents = - GetFileContents(event_filename.c_str(), &event_length); - if (event_contents) { - fprintf(stderr, "Sending events from: %s\n", event_filename.c_str()); - events = std::string(event_contents.get(), event_length); + if (access(event_filename.c_str(), R_OK) == 0) { + fprintf(stderr, "Using event file %s.\n", event_filename.c_str()); + std::unique_ptr<char, pdfium::FreeDeleter> event_contents = + GetFileContents(event_filename.c_str(), &event_length); + if (event_contents) { + fprintf(stderr, "Sending events from: %s\n", + event_filename.c_str()); + events = std::string(event_contents.get(), event_length); + } } } } |